Errors and other HTTP response codes

HTTP response codes for troubleshooting: declines, invalid data, network problems, and more.

Overview

Conventional HTTP response codes indicate the success or failure of an API request.

Responses are grouped into standard classes:

  • Successful responses (200 – 299)
  • Redirection messages (300 – 399)
  • Client error responses (400 – 499)
  • Server error responses (500 – 599)

Standard Error Response Body

When an error occurs, the DigiTax UAE API returns a standardized JSON error envelope:

{
  "code": 400,
  "message": "invalid tax category code",
  "metadata": {
    "field": "items[0].tax_category_code",
    "details": "Tax category 'X' is not valid in UAE PINT-AE specification."
  }
}

DigiTax API HTTP Response Status Codes

For the interactive DigiTax UAE API, these are the primary HTTP response codes:

  • 200 OK: Request succeeded.
  • 201 Created: Resource created successfully.
  • 400 Bad Request: Request payload validation failed.
  • 401 Unauthorized: Authentication failed (missing or invalid X-API-Key).
  • 403 Forbidden: Authenticated business lacks permissions for this operation.
  • 404 Not Found: Resource or endpoint path not found.
  • 409 Conflict: Duplicate unique constraint (e.g., duplicated trader_invoice_number or existing party TRN for branch).
  • 412 Precondition Failed: Business logic precondition not met.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: Internal server issue.
  • 503 Service Unavailable: Temporary maintenance or downtime.

Further Context and Action Points

Successful Responses

HTTP Status CodeScenario in DigiTax APIAction
200 OKTypical for successful GET and PUT requestsUse the API response data as needed
201 CreatedTypical for successful POST creation requestsUse the newly created entity response

Client Error Responses

HTTP Status CodeScenario in DigiTax APIContext & Action
400 Bad RequestSchema or field validation failedExamples: Invalid tax category code, missing mandatory address fields (city_name, street_name), invalid TRN format.
Action: Fix the request body against the schema and retry.
401 UnauthorizedMissing, expired, or invalid API KeyReturned when X-API-Key header is missing or inactive ({"message": "bad credentials"}).
Action: Verify your API Key from the DigiTax dashboard.
403 ForbiddenInsufficient permissionsThe API Key does not have rights to access this branch or resource.
404 Not FoundResource or route not foundAction: Check the URL path and ID parameter.
409 ConflictUnique constraint violationExample: trader_invoice_number must be unique across all invoices/credit notes issued by the business. A duplicate number triggers a 409 Conflict.
Action: Retry with a unique identifier.
412 Precondition FailedBusiness state precondition failedExample: In credit notes, items sent are more than those in the original invoice.
Action: Verify that references to the original document match before issuing the credit note.
429 Too Many RequestsRate limit quota reachedAction: Back off and retry requests with exponential backoff.
5XX Server ErrorsService interruption or upstream errorAction: Check DigiTax status advisories or reach out to [email protected].