Error Response Format
The Taxwire API returns errors in a standardized format, inspired by the JSON:API spec:Error Codes
The Taxwire API uses the following standardized error codes:HTTP Status Codes
400 Bad Request
The request is invalid. The error response will include specific validation errors. The API also returns400 when you create a transaction with a reference_id
that already exists in your account. See
Create transaction.
Common error codes: validation_error
Action: Check your request parameters and ensure they match the API specifications.
401 Unauthorized
The request is unauthorized. This can happen when the API key provided is invalid or expired. Common error codes:auth_error, auth_api_key_not_found, auth_api_key_expired
Action: Verify your API key is valid and active.
403 Forbidden
The request is forbidden. This can happen for a number of reasons:- The API key header is missing
- The API key does not have access to the resource
auth_error
Action: Ensure you’re using the correct API key with appropriate permissions.
404 Not Found
The requested resource was not found. This can happen for a number of reasons:- The resource does not exist
- The resource is not accessible by the API key
409 Conflict
The request conflicts with a record that already exists, or it matches more than one record. The API returns409 when:
- You create a customer or product whose key is already taken
- A product preset leaves out
source_account_id, and itsidexists in more than one connected account
reference_id that already exists returns 400, not
409. See Create transaction.
Common error codes: conflict
Action: Resolve the conflict and try again.
413 Request Too Large
The request body is larger than the API accepts, which is 5 MB. The API refuses it before reading it, so nothing is processed. Common error codes:request_too_large
Action: Split the request into smaller ones. For example, send a large list
of customers as several POST /customers/batch requests.
422 Unprocessable Entity
The request contains valid data but the server cannot process it. This typically happens when:- The request is missing a required parameter
- Some data in the request is invalid
- The
currencyis one we do not support - A credit’s
parent_transaction_idis not one of your transactions - A credit’s sale, or an earlier credit against it, is still a
draft(credit_remainder_unknown, see the FAQ) - A transaction request contains a NUL character (
\u0000)
validation_error, validation_required_field,
validation_invalid_format
Action: Check the error details for specific information about what needs
be corrected.
429 Too Many Requests
The request was rate limited. This means you have made too many requests in a short period of time. See Rate limits for the limit and how to raise it. Common error codes:rate_limit_error
Action: The response will include a Retry-After header with the number of
seconds to wait before making the next
request. Implement exponential backoff in your client.
For example, a rate-limited response would include this header:
500 Internal Server Error
The server encountered an error while processing the request. Common error codes:system_internal_error
Action: This is likely a bug and should be reported to support if it persists.
Error Examples
Internal Server Error
Rate Limit Error
Validation Errors
API Key Error
Sample Error Handling
Here is a simple example of how to handle errors in Python:Python