# Errors (/docs/api/errors)

Every non-2xx response has the same body. Branch on `type` and `code`; `message` is for people and may change.

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_amount",
    "message": "amount is required, in minor units (e.g. 1999 for $19.99).",
    "param": "amount",
    "request_id": "req_01KA4XZY8T2R5M7P1Q4W6E8R0T",
    "doc_url": "https://runepay.co/docs/api/errors#invalid_amount"
  }
}
```

| Field | |
| --- | --- |
| `type` | One of the 6 types below. |
| `code` | A stable, machine-readable code from the tables below. |
| `message` | A human-readable explanation. |
| `param` | The parameter at fault, as a path such as `enabled_events[1]`, when there is one. |
| `object_id` | Only on `secret_not_replayable`: the object the original request created or changed. |
| `request_id` | The same value as the `Request-Id` response header. Quote it when you contact support. |
| `doc_url` | A link to this page, at the code. |

Unknown body parameters are rejected with `parameter_unknown`, so typos fail loudly instead of being ignored.

## `invalid_request_error` [#invalid_request_error]

The request was wrong: a missing or malformed parameter, an object that does not exist, or one in the wrong state. Fix the request before retrying.

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="invalid_json">invalid_json</code> | 400 | The request body is not valid JSON or is not a JSON object. |
| <code id="body_too_large">body_too_large</code> | 413 | The request body is larger than 256 KB. |
| <code id="invalid_line_items">invalid_line_items</code> | 400 | Pass 1–100 valid inline price_data line items. |
| <code id="invalid_expires_at">invalid_expires_at</code> | 400 | expires_at must be 30 minutes to 24 hours from now. |
| <code id="parameter_missing">parameter_missing</code> | 400 | A required parameter is missing. |
| <code id="parameter_unknown">parameter_unknown</code> | 400 | The request has a parameter this endpoint does not accept. |
| <code id="parameter_invalid_string">parameter_invalid_string</code> | 400 | The parameter must be a string. |
| <code id="parameter_invalid_integer">parameter_invalid_integer</code> | 400 | The parameter must be an integer. |
| <code id="parameter_invalid_number">parameter_invalid_number</code> | 400 | The parameter must be a number. |
| <code id="parameter_invalid_boolean">parameter_invalid_boolean</code> | 400 | The parameter must be true or false. |
| <code id="parameter_invalid_array">parameter_invalid_array</code> | 400 | The parameter must be an array. |
| <code id="parameter_invalid_object">parameter_invalid_object</code> | 400 | The parameter must be an object. |
| <code id="parameter_invalid_empty">parameter_invalid_empty</code> | 400 | The parameter must not be empty. |
| <code id="parameter_invalid_value">parameter_invalid_value</code> | 400 | The parameter's value is not allowed (out of range, wrong format, or not one of the listed values). |
| <code id="invalid_limit">invalid_limit</code> | 400 | `limit` must be an integer from 1 to 100. |
| <code id="invalid_cursor">invalid_cursor</code> | 400 | `starting_after` is not an object this key can see. |
| <code id="invalid_created">invalid_created</code> | 400 | A `created[…]` filter is not a unix timestamp in seconds. |
| <code id="invalid_status">invalid_status</code> | 400 | `status` is not one of the allowed values. |
| <code id="invalid_amount">invalid_amount</code> | 400 | The amount is missing, not a positive integer in minor units, or outside what the object allows. |
| <code id="invalid_currency">invalid_currency</code> | 400 | The currency is not a three-letter ISO 4217 code. |
| <code id="unsupported_currency">unsupported_currency</code> | 400 | The currency is not enabled for this account. |
| <code id="invalid_url">invalid_url</code> | 400 | The URL is not an allowed absolute URL (http(s) for redirects, public HTTPS for webhooks). |
| <code id="invalid_email">invalid_email</code> | 400 | The email address is not valid. |
| <code id="invalid_name">invalid_name</code> | 400 | `name` is missing or too long. |
| <code id="invalid_description">invalid_description</code> | 400 | `description` is not a string or is too long. |
| <code id="invalid_active">invalid_active</code> | 400 | `active` must be true or false. |
| <code id="invalid_events">invalid_events</code> | 400 | `enabled_events` must be a nonempty list of event types. |
| <code id="invalid_event">invalid_event</code> | 400 | `event_id` is required. |
| <code id="invalid_immediate">invalid_immediate</code> | 400 | `immediate` must be a boolean. |
| <code id="invalid_request">invalid_request</code> | 400 | Required parameters are missing or malformed. |
| <code id="invalid_input">invalid_input</code> | 400 | The hosted checkout request is malformed. |
| <code id="invalid_action">invalid_action</code> | 400 | The hosted checkout action is not recognised. |
| <code id="invalid_dispute">invalid_dispute</code> | 400 | The dispute data from the processor is not valid. |
| <code id="missing_payment">missing_payment</code> | 400 | `payment` is required. |
| <code id="missing_token">missing_token</code> | 400 | The card token is missing. |
| <code id="unsupported">unsupported</code> | 400 | The operation is not supported for this payment or processor. |
| <code id="not_found">not_found</code> | 404 | No such object for this key's organization and mode. |
| <code id="payment_link_unavailable">payment_link_unavailable</code> | 404 | The payment link cannot take payments right now (503 when the cause is temporary). |
| <code id="payment_link_inactive">payment_link_inactive</code> | 410 | The payment link is deactivated. |
| <code id="checkout_expired">checkout_expired</code> | 410 | The checkout session has expired. |
| <code id="checkout_closed">checkout_closed</code> | 409 | The checkout session is already complete. |
| <code id="amount_out_of_range">amount_out_of_range</code> | 400 | The buyer-chosen amount is outside the payment link's min_amount and max_amount. |
| <code id="invalid_payment_transition">invalid_payment_transition</code> | 409 | The payment cannot move to that status from its current one. |
| <code id="payment_in_progress">payment_in_progress</code> | 409 | The payment already has a processor attempt in progress. |
| <code id="payment_not_confirmable">payment_not_confirmable</code> | 409 | The payment cannot be confirmed in its current status. |
| <code id="not_refundable">not_refundable</code> | 409 | The payment cannot be refunded in its current status, or the amount exceeds what is left. |
| <code id="refund_not_ready">refund_not_ready</code> | 409 | The processor reported a refund before RunePay recorded it. |
| <code id="processor_mismatch">processor_mismatch</code> | 409 | The processor's data does not match the payment. |
| <code id="endpoint_disabled">endpoint_disabled</code> | 409 | The webhook endpoint is disabled. Enable it first. |
| <code id="rotation_in_progress">rotation_in_progress</code> | 409 | A previous signing secret is still in its overlap window. Wait, or rotate with `immediate: true`. |

## `authentication_error` [#authentication_error]

No API key, or an unknown or revoked one.

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="invalid_api_key">invalid_api_key</code> | 401 | No API key, or the key is unknown or revoked. Send `Authorization: Bearer sk_…`. |

## `permission_error` [#permission_error]

The key is valid but may not do this: a publishable key, a live key on an account that is not live yet, or a paused account.

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="secret_key_required">secret_key_required</code> | 403 | The endpoint needs a secret key (`sk_…`); publishable keys are refused. |
| <code id="permission_denied">permission_denied</code> | 403 | The key lacks the scope this endpoint needs. Reserved for restricted keys (`rk_…`). |
| <code id="account_not_ready">account_not_ready</code> | 403 | The merchant account is not set up to take payments. |
| <code id="account_not_live">account_not_live</code> | 403 | The organization is not approved for live payments yet; use a test key. |
| <code id="account_paused">account_paused</code> | 403 | Payments are paused for this account. |
| <code id="checkout_challenge_required">checkout_challenge_required</code> | 403 | The buyer must complete a challenge before paying. |
| <code id="checkout_challenge_invalid">checkout_challenge_invalid</code> | 403 | The buyer's challenge response is not valid. |

## `idempotency_error` [#idempotency_error]

The `Idempotency-Key` conflicts with an earlier request. See [Idempotency](/docs/api/idempotency).

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="key_reused">key_reused</code> | 422 | The Idempotency-Key was already used with a different request. |
| <code id="in_progress">in_progress</code> | 409 | A request with this Idempotency-Key is still in progress. |
| <code id="secret_not_replayable">secret_not_replayable</code> | 409 | The request with this Idempotency-Key succeeded, but its response held a secret that is never stored. `object_id` names the object: retrieve it, or rotate its secret. |

## `rate_limit_error` [#rate_limit_error]

Too many requests. Back off and retry.

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="rate_limited">rate_limited</code> | 429 | Too many requests. Reserved; rate limits are not enforced yet. |
| <code id="checkout_rate_limited">checkout_rate_limited</code> | 429 | Too many checkout attempts from this buyer. Try again later. |
| <code id="checkout_attempt_limit">checkout_attempt_limit</code> | 429 | Too many payment attempts on this checkout. |

## `api_error` [#api_error]

A problem on RunePay's side or upstream. A retry with the same `Idempotency-Key` returns this same stored error and never runs the operation twice; see [Idempotency](/docs/api/idempotency) before retrying with a new key.

| Code | Status | Meaning |
| --- | --- | --- |
| <code id="not_configured">not_configured</code> | 503 | The API is not configured on this deployment. |
| <code id="internal">internal</code> | 500 | Something went wrong on RunePay's side. Retry with the same Idempotency-Key. |
| <code id="checkout_unavailable">checkout_unavailable</code> | 503 | Checkout is temporarily unavailable. |
| <code id="payment_unavailable">payment_unavailable</code> | 503 | The payment could not be processed right now. Try again. |
| <code id="processor_unavailable">processor_unavailable</code> | 503 | The card processor is unavailable. Try again. |
| <code id="risk_screening_unavailable">risk_screening_unavailable</code> | 503 | Risk screening is unavailable, so the payment was not attempted. Try again. |
| <code id="no_test_processor">no_test_processor</code> | 500 | Test mode has no processor configured. |