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

# Errors & Status Codes

> Standardized HTTP status codes, unified JSON error structure, and actionable business error codes.

## Unified Error Response

Every failed API call returns an HTTP `4xx` or `5xx` status code and a JSON body containing `error`:

```json theme={null}
{
  "error": {
    "code": "FACILITY_OFFLINE",
    "message": "Facility MY-KL-001 is temporarily unreachable. Please retry shortly.",
    "requestId": "req_01JDR9Y5G9Z0K",
    "details": null
  }
}
```

Always log `requestId` when reporting support issues so our team can trace your request end-to-end.

## HTTP Status Codes

| HTTP Status | Category | Handling Guidance |
| - | - | - |
| `200 OK` | Success | Action completed and payload returned directly. |
| `400 Bad Request` | Client error | Missing required fields or malformed JSON; fix payload before retrying. |
| `401 Unauthorized` | Auth error | Missing, expired, or invalid `Authorization: Bearer ...` key. |
| `403 Forbidden` | Permission error | Key lacks the required Scope or `facilityId` is not bound to this key. |
| `404 Not Found` | Resource missing | Facility, active session, subscription, or validation does not exist. |
| `409 Conflict` | State conflict | Already paid, validation already claimed/redeemed, or mismatched `Idempotency-Key`. |
| `422 Unprocessable Entity` | Business rule error | Valid JSON, but quote expired, amount mismatch, or merchant validation quota exhausted. |
| `429 Too Many Requests` | Rate limited | Respect the `Retry-After` response header and use exponential backoff. |
| `503 Service Unavailable` | Facility offline | Target facility is temporarily unreachable (`FACILITY_OFFLINE`); safe to retry briefly or show fallback message. |

## Standard Business Error Codes

| `error.code` | HTTP Status | Description |
| - | - | - |
| `INVALID_REQUEST` | `400` | Input failed schema or parameter validation. |
| `UNAUTHORIZED` | `401` | Invalid, revoked, or missing API Key. |
| `INSUFFICIENT_SCOPE` | `403` | API Key does not include the scope required by this endpoint. |
| `FACILITY_ACCESS_DENIED` | `403` | Requested `facilityId` is not bound to your API Key. |
| `FACILITY_NOT_FOUND` | `404` | The specified `facilityId` does not exist. |
| `SESSION_NOT_FOUND` | `404` | No active parking session matched the provided `sessionId` or `credential`. |
| `VALIDATION_NOT_FOUND` | `404` | Validation code or claim code was not found. |
| `SUBSCRIPTION_NOT_FOUND` | `404` | Subscription `subscriptionId` was not found. |
| `ALREADY_PAID` | `409` | The target session currently has `payableAmount == 0` within its exit grace period (for example, settled by an on-site kiosk). If the grace period expires and additional overstay charges accrue, `POST /v1/fees/quote` returns a fresh `payableAmount > 0` and incremental top-up via `POST /v1/payments/notify` is permitted on the same `sessionId`. |
| `VALIDATION_ALREADY_REDEEMED` | `409` | Validation has already been used and cannot be revoked or reclaimed. |
| `IDEMPOTENCY_CONFLICT` | `409` | Reused `Idempotency-Key` with a different request payload. |
| `QUOTE_EXPIRED` | `422` | `quoteId` exceeded its validity window; call `POST /v1/fees/quote` again. |
| `AMOUNT_MISMATCH` | `422` | `paidAmount` does not match the current payable fee for the session. |
| `QUOTA_EXHAUSTED` | `422` | Merchant validation pool has insufficient remaining quota. |
| `RATE_LIMITED` | `429` | API rate limit exceeded. |
| `FACILITY_OFFLINE` | `503` | Target facility is temporarily offline or unreachable. Real-time quotes and remote gate commands fail fast without blocking. |


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