# API reference (/docs/api)

The endpoint pages in this section are generated from RunePay's OpenAPI 3.1 spec, [`/openapi/runepay-v1.json`](/openapi/runepay-v1.json), which is generated from the same schemas that validate requests. If a page and the API disagree, that is a bug.

## Base URL and authentication [#base-url-and-authentication]

```http
POST https://runepay.co/api/v1/checkout_sessions
Authorization: Bearer sk_test_...
Content-Type: application/json
```

Send a secret key as a bearer token ([Keys and security](/docs/keys)). The API is server to server: it sends no CORS headers.

## Requests [#requests]

- Request bodies are JSON objects, at most 256 KB.
- `POST` creates objects and runs actions; `GET` reads and lists. Updating a webhook endpoint uses `PATCH` today; payment links update with `POST`.
- Unknown body parameters are rejected (`parameter_unknown`), so a typo fails instead of being ignored.
- Every `POST`, `PATCH` and `DELETE` accepts an `Idempotency-Key` header. See [Idempotency](/docs/api/idempotency).

## Responses [#responses]

- Objects have an `id` with a type prefix (`cs_`, `pay_`, `re_`, `dp_`, `plink_`, `evt_`, `we_`), `livemode`, and a `created` time.
- Times are unix timestamps in seconds.
- Money is an integer in the currency's smallest unit (`1999` is $19.99) with a three-letter `currency`, uppercase in responses and any case in requests. USD is the currency enabled today.
- `metadata` is a set of string keys and string values you attach and get back. Today, non-string values are dropped.
- Every response, errors included, has a `Request-Id` header (`req_…`) and `Cache-Control: no-store`.
- Errors share one shape. See [Errors](/docs/api/errors).
- Lists are paged. See [Pagination](/docs/api/pagination).

## Resources [#resources]

| Resource | What it is |
| --- | --- |
| [Checkout sessions](/docs/api/checkout-sessions/create-checkout-session) | A hosted checkout page for one payment. The main way to take payments. |
| [Payments](/docs/api/payments/list-payments) | Card payments, created by checkout. |
| [Refunds](/docs/api/refunds/create-refund) | Money returned to the buyer for a payment. |
| [Disputes](/docs/api/disputes/list-disputes) | Chargebacks and inquiries raised by the buyer's bank. |
| [Payment links](/docs/api/payment-links/list-payment-links) | Reusable checkout URLs you can share. |
| [Balance](/docs/api/balance/retrieve-balance) | Funds RunePay holds for you, by state. |
| [Payouts](/docs/api/payouts/list-payouts) | Transfers of your available balance to your bank or wallet. |
| [Events](/docs/api/events/list-events) | Things that happened in your account; the same objects webhooks deliver. |
| [Webhook endpoints](/docs/api/webhook-endpoints/list-webhook-endpoints) | URLs RunePay sends signed events to. |

Webhook payloads are listed in the [event reference](/docs/webhooks/events).