# Troubleshooting

Errors come back in one of three shapes: `{"detail": "..."}` for authentication and permission errors, `{"field": ["message"]}` for validation errors, and `{"error": "...", "code": "..."}` for order errors. These are the errors clients hit most often:

| Status | Message or code | What it means | How to fix it |
| --- | --- | --- | --- |
| `401` | `Invalid or inactive API key` | The key is wrong, revoked or inactive, or the `X-Api-Key` header is missing. | Check the header name and the key. Use an `sk_test_` key on staging and an `sk_live_` key in production. |
| `401` | `API key has expired.` | The key passed its expiry date. | Create a new key in the dashboard. |
| `403` | `Access denied: unauthorized IP for this company.` | Your account has an IP allowlist and this call came from an address not on it. | Add the address of **every** server that calls the API, including pollers, to the allowlist in the dashboard. Do not retry until it is added. |
| `403` | `API access is not enabled for your account. ...` | TGR has not enabled API access for your account yet. It is enabled by TGR after a compliance review, not in the dashboard or in code. | Contact support at support@thegreatrenter.com to request access. Do not retry until it is enabled. |
| `403` | `You do not have permission to perform this action.` | The key's scope does not allow this call (for example a `read` key placing an order), or the endpoint is a dashboard endpoint that does not accept API keys. | Use a `read_write` key, and only the endpoints on this page. |
| `403` | `billing_suspended` | Your billing account is suspended. | Contact support at support@thegreatrenter.com. |
| `400` | `Residence history must cover at least ... Add the previous address.` | The oldest residence `start_date` is too recent. | Add the applicant's previous addresses until the history covers the period in the message. |
| `400` | `Residence start_date cannot be in the future.` / `Two residences cannot share the same start_date.` / `At least one residence is required.` | A residence breaks the date rules. | Fix the `start_date`s: none in the future, no two the same. |
| `400` | `The applicant must be at least 18 years old to be screened.` / `Please check the date of birth — it looks incorrect.` | `date_of_birth` is outside 18 to 120 years, or in the future. | Send the date as `YYYY-MM-DD` and check it. |
| `400` | `This field is required.` | A required field is missing. | See the endpoint's payload rules. `middle_name` is required: send `""` when there is none. |
| `402` | `payment_failed` | Your account pays per API call and has no card on file, or the card was declined. | Add or update the card in the dashboard, or contact support at support@thegreatrenter.com about monthly invoicing for higher volumes. |
| `409` | `duplicate_daily_order` | An order for this applicant and product already exists today (America/Toronto). | Reuse the existing order, or order again on a later day. A `failed` order does not count. |
| `409` | Idempotency conflict | The `Idempotency-Key` was already used with a different body. | Use a new key for each new order. |
| `422` | `billing_incomplete` / `tax_unavailable` | Billing is not fully set up, or no billing address is on file. | Complete billing and add a billing address in the dashboard. |
| `400` | `Not a recognised country. Use a two-letter country code, such as CA or US.` | A residence `country` is neither a two-letter country code nor one of the accepted names: `Canada` and `United States` and their usual abbreviations (`CAN`, `USA`). | Send the two-letter code, such as `CA`, `US` or `VN`. |
| `502` / order `failed` | `A required applicant detail is missing, ...` | A residence is missing its province or state. | Send `province` with every residence, as a two-letter code such as `ON` or `NY`. |
| `400` | `validation_failed`: `A credit check needs at least one residence in Canada, or a current residence in the United States.` | The order includes a credit check, and none of the applicant's residences is in Canada and the current one is not in the United States. Nothing is charged. | Include the applicant's Canadian address in `residences`, if they have one. A US credit check needs the current residence (the one with the latest `start_date`) to be in the United States. |
| `502` / order `failed` | `The order could not be submitted for screening. ...` | The screening provider rejected the order for another reason, or was unavailable. | Check the applicant's details against the endpoint's payload rules, then place a new order. If it keeps failing, contact support at support@thegreatrenter.com with the order `reference`. |
| `404` | `Not found.` | The `reference` doesn't exist, or you are reading it from a different product endpoint than it was ordered on. | Read each order from the endpoint you created it on, for example `GET /credit_check/{reference}/` for a credit check. |
| `429` | Rate limited | Too many requests for this API key. | Wait for the `Retry-After` interval, then back off. |

When an order is rejected by the screening provider, it is recorded as `failed`, its `message` says why, and a card charge is refunded automatically. Fix the payload and place a new order.
