Errors and troubleshooting
Every signed API response has request_id, fetched_at, state and data. Errors use state: error, a stable data.code and a readable data.message. Keep the request ID when diagnosing a failure; switch on codes rather than message text.
{
"request_id": "req_000000000000000000000000",
"fetched_at": "2026-09-17T12:00:00Z",
"state": "error",
"data": {
"code": "validation_failed",
"message": "Check the VAT return figures.",
"errors": [{
"code": "vat_box_3_mismatch",
"path": "/return/total_vat_due_pence",
"message": "Total VAT due must equal VAT due on sales plus acquisitions.",
"expected_value": 12500,
"actual_value": 12499,
"auto_correctable": true
}]
}
}
data.errors identifies fields using JSON Pointer paths. auto_correctable means the expected value is mathematically determined; GoFile still never changes your figures silently. Optional data.next_action describes a recovery action when available.
Common problems
| HTTP / code | What to check |
|---|---|
401 unauthorised | data.errors[0].code names the cause: missing_authentication_headers, invalid_key_format, invalid_timestamp (use seconds), timestamp_outside_window (server clock), invalid_nonce, invalid_signature_format, nonce_reused, or invalid_credentials (key, secret, path or body bytes did not verify). See signing. |
403 scope_required | Enable the operation's key permission in the portal. HMRC consent and API key permissions are separate. |
403 method_not_enabled | The tax service (VAT or Income Tax) is not enabled for your integration. Its authorisation start, retrieval and preparation are all refused, before any HMRC consent. The integration owner can enable it under API keys > Tax services. |
403 terms_acceptance_required | The integration owner must follow the returned continuation URL and accept the current Connect terms. |
403 integration_suspended | Contact the integration owner or GoFile support. |
404 connection_not_found / not_found | Use the correct saved ID, integration, service and sandbox/live key. The message names the identifier that did not match. Other integrations' resources are never accessible. Removed routes also return 404. |
404 tax_account_not_found / taxpayer_not_found | Check the VAT number or NINO. HMRC holds no matching tax account; this is different from no open periods. |
403 hmrc_authorisation_required / hmrc_authorisation_invalid | Renew HMRC consent for the connection. |
403 client_not_authorised | Check the taxpayer and agent-client relationship at HMRC. |
403 mfa_reauthentication_required | Obtain recent software-user MFA evidence; see live filing. |
400 invalid_json / 413 payload_too_large / 405 method_not_allowed | Send one JSON object, at most 1 MB, using POST, with each key at most once per object. No query parameters. An empty body is treated as {}. |
422 validation_failed | Inspect data.errors for missing, unexpected or invalid fields; see validation issue codes. Identifiers belong in the JSON body. |
409 idempotency_conflict | Reuse the original unchanged draft and retry key, or use a new key for a genuinely new intent. |
| VAT: 200 with the existing filing | Preparing a VAT period that already has an open filing returns that filing (HTTP 200) when the draft is identical, even with a new Idempotency-Key; different figures return 409 idempotency_conflict. Resume the existing filing; nothing new is created. |
409 quarterly_update_in_progress | Income Tax refuses a second preparation while another update for the business is open or unconfirmed. Retrieve and finish the existing one. |
409 period_submission_in_progress | Final VAT submission found the same period being submitted at that moment. Retrieve the filing; do not submit again. |
409 obligation_not_open / period_not_ended | Income Tax preparation for an obligation that is already fulfilled, or whose period has not ended. Use an open obligation with can_submit: true. |
422 no_open_obligation / period_required | VAT preparation without period: HMRC holds no open period, or several are open (the message lists them). Supply period from an open obligation. |
409 period_already_submitted | The VAT period was already filed through GoFile. Retrieve the existing filing and its receipt instead of preparing it again. |
409 external_filing_id_conflict | That external_filing_id already belongs to a different draft. Reuse the original draft or choose a new reference. |
409 period_unavailable / no_matching_obligation | Refresh information and use the exact returned open period or obligation ID. |
402 billing_required | Enable live billing in the developer portal; sandbox remains available. |
429 rate_limited | Honour the returned retry guidance and Retry-After. |
503 hmrc_unavailable / service_unavailable | HMRC or GoFile is temporarily unavailable and nothing was changed. These responses carry Retry-After and data.retry.safe: true: retry the same request after the interval. |
503 submissions_disabled | Submissions are paused. Check the returned message. |
Do not round or change a customer's figures without approval.
Validation issue codes
Each data.errors[] item has a code and a JSON Pointer path. The codes below are stable. Some endpoints use different names for the same kind of problem; they are kept unchanged so existing integrations keep working. New codes may be added, so handle an unknown code by its path and message.
| Code | Meaning | Returned by |
|---|---|---|
invalid_field | A missing or malformed routing value: connection_id, vat_number, national_insurance_number, tax_year, submission_id, authorisation_session_id, or software_user_id on authorisation; an unexpected retrieval field; the missing Idempotency-Key header (path /Idempotency-Key); or a malformed client_action.authentication field. | All endpoints |
required | A live authorisation start without vat_number or national_insurance_number. | Authorise |
unsupported_field | A field the authorisation body does not accept, including scopes. | Authorise |
invalid_string | A string is empty, too long or contains control characters: software_user_id, external_filing_id, external_update_id. | Authorise, preparation |
invalid_return_url, return_origin_not_allowed, reserved_query_parameter | return_url is not an absolute HTTPS URL without a fragment, its origin is not registered, or it contains gofile_session. | Authorise |
invalid_idempotency_key | Idempotency-Key is longer than 120 characters. | Authorise |
required_string | software_user_id or software_user_login is missing, empty, too long or contains control characters. | Preparation |
required_object | period, return or cumulative is not an object. | Preparation |
required_field | A required VAT box or Income Tax total is missing. | Preparation |
unexpected_field | A field the preparation body does not accept. | Preparation |
server_owned_field | A field GoFile sets itself, such as period_key or finalised. | VAT preparation |
invalid_boolean, invalid_object | validate_only is not a JSON boolean, or client_action / client_action.authentication is not an object. | Preparation |
invalid_date, invalid_period | A period date is not a real YYYY-MM-DD date, or the end is not after the start. | Preparation |
integer_pence_required, whole_pounds_required, value_out_of_range | A figure is not integer pence, boxes 6-9 are not whole pounds, or a figure is outside HMRC's range. Box 5 must be 0 to 9,999,999,999,999 pence. | Preparation |
vat_box_3_mismatch, vat_box_5_mismatch | VAT arithmetic. expected_value gives the figure that would be correct. | VAT preparation |
consolidated_and_itemised_expenses | An Income Tax update sends both consolidated_expenses_pence and itemised expenses; choose one route. | Income Tax preparation |
invalid_business_id, invalid_obligation_id, unsupported_tax_year, unsupported_itsa_feature, unsupported_business_type | The Income Tax draft names an invalid business, obligation or tax year, or an unsupported feature. | Income Tax preparation |
business_not_found, obligation_not_found, obligation_mismatch | The obligation does not resolve in the cached Income Tax information: refresh it and copy the returned obligation_id. A missing obligation_id is 422 validation_failed with required_field at /obligation_id. obligation_mismatch means an optional tax_year, business_id or period differs from the obligation. | Income Tax preparation |
unsupported_header | A Gov-* header was sent. | All endpoints |
Unit, range and arithmetic checks run together. A box that fails its unit or range check is left out of the arithmetic, and the other boxes are still checked in the same response.
Statuses and retries
The table describes top-level state. VAT filing states also appear when retrieving a submission ID; ledger status is a separate result.
| Endpoint / operation | Possible states | What to do next |
|---|---|---|
/authorise/vat, /authorise/itsa | pending, authorising, exchanging | Open the returned URL once; check the saved attempt through the same endpoint. |
| Authorisation result | completed; failed, expired | Save data.connection_id on completion. Otherwise start a new attempt. |
/vat, /itsa account information; preparation awaiting account readiness | ready, syncing, action_required | Use the data; wait as instructed; or repair HMRC authorisation. |
/vat/prepare, /itsa/prepare with validate_only | valid, invalid | Check data.valid and fix validation errors. No submission exists. |
| VAT preparation / filing result | requires_client_context, awaiting_hmrc_auth, validating, awaiting_approval, requires_review, auth_expired | Open data.continue_url when supplied; the hosted journey performs capture, authorisation checks and review. |
| Income Tax preparation / update result | awaiting_approval | Open data.continue_url for the user's confirmation. |
| Either submission result | submitted | Save the receipt. |
| Either submission result | submission_unconfirmed | Retrieve the existing submission; never resend while the outcome is unknown. |
| Either submission result | failed, expired; VAT also rejected, reconciliation_blocked | Inspect the returned error/reconciliation details and apply the recovery rules below. |
| Any endpoint | error | Inspect data.code and any field/retry guidance. |
All endpoint paths above have the /api/v1 prefix. history.state and other nested ledger fields describe that portion of the cached data, not the authorisation or submission journey.
ready means information is available. HTTP 202 with state: syncing means the account's first sync has not completed yet: honour Retry-After (normally a few seconds). A read of stale information queues a refresh in the background but never waits for it. action_required is normally HTTP 200; follow data.authorisation.continue_url when supplied. A valid empty obligations list does not mean an error.
For failures, retry automatically only when data.retry.safe is true. Use the Retry-After header first, then data.retry.after_seconds, with jitter. Missing guidance means no automatic retry. Reads are replay-safe despite using POST. Each retry needs a new timestamp, nonce and signature.
Preparation is retry-safe with a saved Idempotency-Key and unchanged draft. Both VAT and Income Tax require that header when preparing a submission. HTTP 201 means a submission was prepared, not filed.
validate_only: true runs preparation's field, unit, range and arithmetic checks, and checks the shape of any client_action.authentication, without creating anything or needing an Idempotency-Key. HTTP 200 means the draft was checked: read data.valid and data.errors. Checks that depend on the moment of filing are left to preparation:
| Check | validate_only | Preparation |
|---|---|---|
| Fields, units, ranges and arithmetic | Yes | Yes |
MFA evidence shape (mfa_type, mfa_at, factor_reference) | Yes | Yes |
VAT period is open and not already filed (no_open_obligation, period_required, period_already_submitted) | No, so figures can be checked before a period ends | Yes |
| Income Tax obligation resolves in cached information | Yes | Yes |
| Income Tax obligation is open and its period has ended | Reported in data.warnings (obligation_not_open, period_not_ended); the draft stays valid | Refused with 409 |
| Income Tax figures above the £90,000 consolidated-expenses limit, or lower than the last cumulative submission | data.warnings (consolidated_expenses_limit, cumulative_lower_than_previous); never blocking | Shown to the person approving; never blocking |
| Live MFA recency, billing, daily limits and idempotency | No | Yes |
Errors in the request around the draft are returned before validation runs, as HTTP 422 validation_failed with no data.valid: identifiers and routing fields, a validate_only that is not a JSON boolean (a quoted "true" is refused), and a malformed client_action. Errors in the draft itself return HTTP 200 with state: invalid.
An unused Income Tax approval link expires after five minutes. Retrieval or an identical preparation retry returns state: expired. To continue, prepare a new update with a new Idempotency-Key, a new external_update_id if you supply one and current MFA evidence where required. The expired record stays available; its old link cannot submit. No housekeeping wait is required.
Hosted confirmation makes one HMRC attempt, never an automatic resend. If state is submission_unconfirmed, the write may have reached HMRC: never resubmit or create a replacement to bypass the lock. Retrieve the existing filing/update for read-only recovery. A definite rejection or proven non-delivery requires a fresh human decision before another attempt.
Browser redirects and timeouts
After HMRC consent the hosted page spends up to three seconds fetching the client's information, then redirects to your return_url or shows the completion page. An HTTP redirect finishes your PHP request. It does not return control to that script after HMRC consent. Save the temporary authorisation session on your backend, then check it from another request. The complete VAT and Income Tax browser examples do this without a long PHP polling loop.
If decoding returns null, inspect the raw HTTP response, status and curl error. HTML from a proxy or a wrong URL is not a JSON API response. A Cloudflare 502 identifies a failure between Cloudflare and the named host; use that host's server logs and request time to locate it. Do not output debug text before sending a PHP Location header.
Ledger freshness
| Ledger | When it refreshes |
|---|---|
| VAT information | During the authorisation journey; when a read finds it older than five minutes; 30 minutes after a return filed through GoFile; otherwise weekly. |
| Income Tax information | During the authorisation journey; when a read finds it older than five minutes; 30 minutes after an update submitted through GoFile; otherwise weekly. |
These are scheduling rules, not maximum-age guarantees. A new account is due at once and is normally synced while the user is still on the hosted page; the continuous worker picks up anything left within moments, followed by HMRC response time. Worker downtime, backlog, rate limits and HMRC failures can make data older. Historical VAT obligations and balances can still be syncing after current obligations are ready.
fetched_at tells you when GoFile produced this response. data.data_as_of tells you when the ledger last successfully reconciled. ready means usable cached information exists; it does not promise that information is recent. Use its age in your UI. A stale read queues one background refresh (at most every five minutes per account); polling faster does not accelerate it. An accepted submission is recorded locally immediately; HMRC ledger confirmation may follow later.
Operational limits
| Item | Limit / handling |
|---|---|
| Signature timestamp | Unix seconds, within 300 seconds (five minutes) of GoFile's server time in either direction. Synchronise your server clock. |
| Signature nonce | 16–64 letters, digits, _ or -; fresh for every request, including retries. |
| Authorisation attempt | 20 minutes from creation; use returned expires_at. Start again after expiry. |
| VAT approval URL | Five minutes; use continue_url_expires_at. Retrieve the existing open filing with vat:prepare permission for a fresh link. Live MFA must still qualify. |
| Income Tax approval URL | Five minutes; unused expired updates require a new preparation and retry key, as described above. |
| JSON request body | At most 1,048,576 bytes (1 MiB). |
Idempotency-Key | 1–120 characters; required for preparation except validate_only. A missing key returns 422 validation_failed with code invalid_field and path /Idempotency-Key (a header, not a body field). Save it with the unchanged draft. |
| Request rate | Integration/key limits apply; honour HTTP 429 and Retry-After. Successful responses carry no rate-limit headers. There is no universal requests-per-second promise. |
An approval URL's lifetime is separate from retention of its submission record and receipt. Never infer a reusable approval capability from a saved submission ID.
Diagnosing hosted submission checks
The hosted page loads browser capture automatically. A rejected capture does not call HMRC or consume the approval action. Its browser protocol is separate from the signed API and returns error, detail, safe_to_retry and request_id. A submission that did not complete also returns user (outcome, title, message): plain-English wording for the person on the page, such as HMRC's reason for a rejection and what to do next. GoFile.actions.execute passes it on as error.user. Retry only as instructed; share the request ID with GoFile support, never the private approval URL or captured values.
Unavailable JavaScript user-agent data is recorded and omitted; it does not by itself block approval. Other missing browser or network facts can block the submission. Developers supply the current software_user_id, software_user_login and live MFA evidence; GoFile supplies the browser and network capture.
For GoFile operators: capture logs list failed-check names without the private values. vendor_public_ip, client_public_ip and vendor_forwarded require checking the real receiving/proxy path; never substitute a proxy socket for the user's address or port. Behind Cloudflare the browser source port arrives only in the zone's X-Client-Port Transform Rule header and is omitted when that header is absent, so client_public_port appears only for a malformed value. client_public_ip_timestamp indicates stale or invalid capture time; user_reference indicates missing software identity; capture_storage indicates database/capture persistence. Verify deployment facts with HMRC's fraud-prevention Test API; local sandbox tests cannot prove the production network path.
