> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yondatax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Understand validation, authentication, and calculation errors.

Handled API errors use an `error` object with a machine-readable `code` and a diagnostic `message`:

```json theme={null}
{
  "error": {
    "code": "invalid_input",
    "message": "line_items.0.amount: Input should be a valid integer"
  }
}
```

| HTTP status | Code | Meaning |
| - | - | - |
| 400 | `invalid_input` | Invalid JSON or fields, duplicate line numbers, a missing selected customer address, or an oversized authorization header. |
| 401 | `authentication_failed` | Missing, malformed, unknown, or inactive API key. |
| 429 | `rate_limit_exceeded` | The installation's request budget is exhausted. Includes `Retry-After: 1`. |
| 500 | `calculation_failed` | The calculation failed or its result could not be represented in the response. |
| 503 | `service_unavailable` | Authentication is not configured, or the request limit could not be checked. Only the request-limit failure includes `Retry-After: 1`. |

> [!NOTE]
>
> Request validation returns HTTP 400. Validation messages include field paths where possible. Use the error code for handling and the message for diagnosis.

## Request IDs

Every response from the API, including errors, has an `X-Request-ID` header. Yonda generates the value for each request and records it with that request. A request ID you send is ignored. A response without the header, such as a gateway timeout, did not come from the API.

```http theme={null}
X-Request-ID: 7d9f2c41b6e84a0f9c3d5e1a2b4c6d8e
```

Log it with your own records and quote it when contacting Yonda about a response.

## Common request fixes

| Problem | Fix |
| - | - |
| Money sent as `"1000"` or `10.5` | Send an integer number of minor units, such as `1000`. |
| Zero or negative quantity | Send a JSON number greater than zero; fractions are allowed. |
| Unsupported currency code | Use a currency supported for calculation. |
| Missing selected address | Supply `billing_address` or `shipping_address` to match `customer.address_source`. |
| Duplicate line numbers | Give each line a unique positive `number`. |
| Unknown fields | Use the documented snake\_case names. The API rejects unknown fields. |

## Handling failures

Requests are limited per installation after authentication and before calculation. Rotated keys for the same installation share the budget. Test and live installations have separate budgets. Invalid request bodies from authenticated callers still count.

For HTTP 400 `invalid_input` and HTTP 401 `authentication_failed`, correct the request or credentials. Do not retry the request unchanged.

For HTTP 429 `rate_limit_exceeded`, wait at least the number of seconds in `Retry-After` and add jitter before retrying.

HTTP 500 `calculation_failed` means the calculation failed or its result could not be represented in the response. Retry a limited number of times with backoff. Repeating the request recalculates tax. Contact Yonda with the `X-Request-ID`, endpoint, status, and non-sensitive request details if failures persist.

For HTTP 503 `service_unavailable` with `Retry-After`, wait at least the indicated number of seconds before retrying with backoff and jitter. Without `Retry-After`, authentication is not configured; contact Yonda and retry after it is restored. Contact Yonda if 503 responses persist.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.