VAT
Use a VAT connection from Authorisation basics. The Quickstart contains complete runnable PHP, Python, Node.js and curl examples; this page explains the VAT fields and results.
| Signed POST endpoint | Key permission | Purpose |
|---|---|---|
/api/v1/authorise/vat | authorisation:write / authorisation:read | Start (naming the client's vat_number) or renew authorisation, or check completion. |
/api/v1/vat | vat:read | Retrieve VAT information or a filing receipt. |
/api/v1/vat/prepare | vat:prepare | Validate or prepare a return for hosted approval. |
Retrieve information
Post to /api/v1/vat:
{"connection_id":"hmc_000000000000000000000000","vat_number":"999999999"}
999999999 is dummy simulator data. Use the customer's actual nine-digit VAT number in live mode. HMRC must permit that connection to act for the taxpayer.
In live, HMRC decides which VAT numbers a connection can act for: an agent's connection covers the clients linked to its agent services account, and a business's own connection covers only that business. For any other VAT number the read returns state: action_required with authorisation.state: unauthorised, authorisation.reason: client_not_authorised, and null obligations, balance and history. A filing for it cannot reach HMRC: it fails with client_not_authorised at preparation or approval. No other taxpayer's information is ever returned.
Sandbox simulator
Sandbox keys use a built-in simulator that sends nothing to HMRC. Unlike live, it treats any nine-digit VAT number as a client of the connection, so you can test several clients on one connection. Each has one open quarter and four filed quarters with figures. Filing the open quarter closes it; use another VAT number for a fresh open period. A simulated return that is not yet due shows as an outstanding liability; a payment appears once its due date has passed.
| Sandbox VAT number | Behaviour |
|---|---|
999900001 | The connection is not authorised for this client (client_not_authorised), as in live. |
999900002 | Authorised, with nothing to file (no_open_obligation when preparing without period). |
999900003 | Two open periods (period_required when preparing without period). |
999900004 | Normal until submission, which HMRC rejects. |
999900005 | HMRC unavailable for every call. |
Result in data | Meaning |
|---|---|
authorisation | HMRC access standing. When top-level state is action_required, follow authorisation.continue_url if supplied. An agent-client relationship may instead need repair at HMRC. |
obligations.open | Outstanding periods, due dates and any existing filing to resume. filing.continue_url is null unless the key also has vat:prepare. Use the returned period when preparing. |
obligations.fulfilled | Filed periods, with nine-box figures when available. return_status explains missing figures. hmrc_confirmed: false means GoFile has filed but HMRC's obligation ledger has not yet confirmed it. |
balance | Liabilities and payments. These amounts are decimal-pound strings, such as "1234.56". |
history | syncing while older obligations are being collected, then complete. |
data_as_of | Last ledger reconciliation time. fetched_at is the response time, not the age of the HMRC data. |
Reads serve GoFile's ledger immediately; a read that finds it older than five minutes queues a background refresh. A client's first sync normally completes during the authorisation journey; a read that arrives while it is still running returns HTTP 202 with state: syncing — honour Retry-After (normally a few seconds). Balance/history can still be syncing after obligations become available.
Beyond that, VAT information refreshes weekly, and 30 minutes after a return filed through GoFile (to confirm HMRC's record and pick up the new liability). These are scheduling intervals, not a maximum-age guarantee: HMRC outages, throttling and retries can delay reconciliation. Check data_as_of even when state is ready. See ledger freshness.
Prepare a return
Post to /api/v1/vat/prepare. Required body fields:
| Field | Value |
|---|---|
connection_id, vat_number | Same connection and taxpayer as the read. |
software_user_id, software_user_login | Current authenticated user from your backend; see user identity. |
return | All nine integer-pence fields below. |
Use period: {"start":"2026-04-01","end":"2026-06-30"} copied from an open obligation. It may be omitted only when exactly one obligation is open.
| Box | Field inside return |
|---|---|
| 1 | vat_due_sales_pence |
| 2 | vat_due_acquisitions_pence |
| 3 | total_vat_due_pence |
| 4 | vat_reclaimed_current_period_pence |
| 5 | net_vat_due_pence |
| 6 | total_value_sales_ex_vat_pence |
| 7 | total_value_purchases_ex_vat_pence |
| 8 | total_value_goods_supplied_ex_vat_pence |
| 9 | total_acquisitions_ex_vat_pence |
Every box is an integer number of pence: 12500 means £125.00. Boxes 6-9 must represent whole pounds, so be divisible by 100. Box 3 equals boxes 1 + 2; box 5 is the absolute difference between boxes 3 and 4. GoFile rejects incorrect arithmetic rather than silently correcting it. HMRC's ranges apply: boxes 1-4 up to ±999,999,999,999,999 pence, box 5 from 0 to 9,999,999,999,999 pence, and boxes 6-9 up to ±999,999,999,999,900 pence.
Add validate_only: true to check the draft without creating a filing; read data.valid, not just HTTP 200. It checks fields, figures and the shape of MFA evidence, but not whether the period is open or already filed, so figures can be checked before a period ends. See what validation checks. Preparation requires an Idempotency-Key header. Save and send the same key with the unchanged draft for safe retries. external_filing_id is an optional local reference. Live requests also need MFA evidence. Full optional fields are in OpenAPI.
Approve and retrieve the receipt
Preparation returns data.submission_id (vfs_ and 48 hexadecimal characters; Income Tax update IDs are itu_ and 24) and data.continue_url. Save the ID against the return before opening the URL for the responsible user. Preparation does not submit. The hosted page shows the frozen figures and declaration; Confirm & Submit makes one HMRC attempt and displays its result. There is no filing queue or automatic resend.
To retrieve that filing later, post to /api/v1/vat:
{"connection_id":"hmc_000000000000000000000000","vat_number":"999999999","submission_id":"vfs_000000000000000000000000000000000000000000000000"}
Read top-level state. A submitted filing has data.receipt; a failed one has data.failure with GoFile's code, HMRC's messages in errors and, when HMRC answered, HMRC's own provider_code. data.submission_occurred is true only when HMRC accepted the return; a return HMRC received and rejected is false, with state: rejected. an open filing can have a fresh data.continue_url if the key also has vat:prepare. A read-only key never receives approval credentials. Successful submission updates GoFile's local obligation record immediately.
The approval URL lasts five minutes; use data.continue_url_expires_at. If it expires, retrieve the existing open filing with a key that also has vat:prepare to obtain a fresh link. Live MFA evidence must still be recent. This does not create a second return.
If state is submission_unconfirmed, HMRC may have received the return. Do not resubmit; retrieve the existing filing for recovery. See Errors and troubleshooting for failures, retries and duplicate protection.
The hosted approval page asks whether the filer represents the business or is its agent, displays the corresponding VAT declaration, and records the confirmed wording with the return. This choice does not change the HMRC connection.
