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

# Error Handling

<Panel>
  <RequestExample>
    ```bash cURL theme={null}
    curl https://api.chargeapi.co/v1/fleets/flt_61R9a6NUWsRmOW3RM41L6nFOS1ekDGHo \
      -H "Authorization: Bearer ch_sk_test_..."
    ```
  </RequestExample>

  <ResponseExample>
    ```json Response theme={null}
    {
        "code": "fleet_not_found",
        "doc_url": "https://docs.chargeapi.co/errors#fleet_not_found",
        "message": "Fleet not found.",
        "object": "error",
        "param": "fleet",
        "request": "req_6R3M9pQ4bV2kLs8nT1xY7wEf5cZa0HdJ",
        "status": 404,
        "type": "invalid_request_error"
    }
    ```
  </ResponseExample>
</Panel>

When a request fails, Charge returns a JSON `error` object. The shape stays consistent across the API so your client can handle failures in a predictable way instead of writing endpoint-specific parsing logic for every error response.

Charge uses standard HTTP status codes to signal what kind of failure happened. In general, `4xx` responses mean the request could not be completed as sent, while `5xx` responses mean something unexpected happened on Charge's side.

The most useful fields for debugging are usually `type`, `code`, `message`, and `request`. `type` tells you the broad category of failure, `code` identifies the specific condition when Charge has one, `message` is safe to show in logs and internal tooling, and `request` gives Charge support a concrete request to trace.

Endpoint reference pages may still call out especially relevant statuses or error codes when they matter for that operation, but they all use the same underlying `error` object described here.

## Attributes

<ResponseField name="code" type="string | null">
  Short error code you can use to identify the error.

  Available options: `account_not_found`, `charging_session_conflict`, `charging_session_dependency_not_found`, `charging_session_not_found`, `charging_session_state_conflict`, `charging_station_not_found`, `driver_fleet_conflict`, `driver_not_found`, `driver_or_fleet_not_found`, `estimation_not_found`, `estimation_validation_error`, `fleet_not_found`, `invoice_finalize_invalid_state`, `invoice_not_found`, `invoice_payment_invalid_state`, `invoice_update_invalid_state`, `invoice_validation_error`, `invoice_void_invalid_state`, `owner_scope_invalid`, `payment_authorization_failed`, `payment_method_invalid_input`, `payment_method_not_found`, `payment_method_owner_not_found`, `payment_method_scope_invalid`, `payment_method_scope_not_found`, `policy_blocked`, `policy_not_found`, `rate_limit_exceeded`, `report_not_found`, `report_validation_error`, `reservation_cancel_invalid_state`, `reservation_invalid_input`, `reservation_invalid_state`, `reservation_not_found`, `reservation_update_invalid_state`, `transaction_not_found`, `unsupported_expand_value`, `vehicle_not_found`, `vehicle_owner_not_found`, `vehicle_telemetry_not_found`, `webhook_endpoint_not_found`
</ResponseField>

<ResponseField name="message" type="string" required>
  Human-readable description of the error.
</ResponseField>

<ResponseField name="param" type="string | null">
  Name of the request parameter that caused the error, if applicable.
</ResponseField>

<ResponseField name="request" type="string" required>
  Unique identifier for the request. Include this when contacting Charge support about a specific error.
</ResponseField>

<ResponseField name="status" type="integer">
  HTTP status code returned with the error.
</ResponseField>

<ResponseField name="type" type="string" required>
  Broad category of error.

  Available options: `invalid_request_error`, `authentication_error`, `rate_limit_error`, `api_error`, `idempotency_error`
</ResponseField>

## More attributes

<ResponseField name="object" type="string" required>
  String representing the object's type. Objects of the same type share the same value.
</ResponseField>

<ResponseField name="doc_url" type="string | null">
  Link to the relevant section in the Charge API docs.
</ResponseField>

### HTTP Status Code Summary

| Status | Meaning           | Description                                                            |
| ------ | ----------------- | ---------------------------------------------------------------------- |
| `200`  | OK                | Everything worked as expected.                                         |
| `400`  | Bad Request       | The request is invalid for this Charge operation.                      |
| `401`  | Unauthorized      | The Charge API key is missing, invalid, or could not be authenticated. |
| `402`  | Payment Required  | The payment step failed or could not be authorized.                    |
| `403`  | Forbidden         | The request was blocked by a Charge policy or permission rule.         |
| `404`  | Not Found         | The requested resource does not exist.                                 |
| `409`  | Conflict          | The request conflicts with the current state of the resource.          |
| `429`  | Too Many Requests | Your integration is sending requests too quickly.                      |
| `5xx`  | Server Error      | An unexpected server-side error occurred while processing the request. |

### Most Common Error Types

| Error type              | Description                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------- |
| `invalid_request_error` | The request is malformed, incomplete, or incompatible with the current resource state. |
| `authentication_error`  | The API key is missing, invalid, or not allowed to access the request.                 |
| `rate_limit_error`      | The request rate is too high and the client should slow down before retrying.          |
| `api_error`             | An unexpected server-side failure occurred while processing the request.               |
