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

# Authentication

> Bearer keys, livemode, scopes, and idempotency.

Every `v1` call uses a secret key. **Banking**, **Checkout** and **Connect** share one API at `https://api.easner.com/v1` and the same key prefixes (`easner_sk_test_…`, `easner_sk_live_…`). Scopes on each key decide which product routes it can call. A Banking integration needs `accounts.*` and optionally `transfers.write`; Checkout needs `checkout`; Connect needs `payees.*`, `payees.credit` and `payouts.write`. See [Connect](https://docs.easner.com/connect.md#keys) for Connect-mode defaults and [API keys and scopes](https://docs.easner.com/api-keys.md).

Mint keys in Console: Settings → API keys. A key with `keys.manage` can list and revoke keys over the API, see [API keys](https://docs.easner.com/api-keys.md). The list is the **current** Test or Live mode from the header. Create as many as you need. Each new key is a pair: a secret key (`easner_sk_…`) and a publishable key (`easner_pk_…`). The secret is shown **once**. Easner stores only a hash, so a lost secret cannot be recovered. Create a new key instead.

Creating a key asks for a security code. A test key needs nothing else. A live key needs your business verified, and a live key with Checkout permissions also needs online payments on and set up. See [Test and live](https://docs.easner.com/test-and-live.md#what-a-live-key-needs).

```bash theme={null}
export EASNER_SECRET_KEY=easner_sk_test_…
```

```bash theme={null}
curl https://api.easner.com/v1/accounts \
  -H "Authorization: Bearer easner_sk_test_…"
```

`Bearer` is required. A bare key is also accepted. Missing or unknown keys return `401`.

Secret keys stay on the server. Never put one in browser code, a mobile app, a repository, a chat or a prompt. Read it from the environment.

## Secret and publishable keys

| | Secret key | Publishable key |
| - | - | - |
| Looks like | `easner_sk_test_…`, `easner_sk_live_…` | `easner_pk_test_…`, `easner_pk_live_…` |
| Lives | Your server only | In your page's HTML or JavaScript |
| Can | Every `/v1` call its scopes allow | Only start Checkout.js on a session you already created |
| Cannot | Be used in a browser | Create sessions, read data, refund, or call any other route |

The overlay and inline Checkout call `GET /v1/checkout/publishable-keys/validate?key=easner_pk_…` from the browser to load your branding. Nothing else is open to a publishable key. The hosted page and `button.js` need no key.

New keys can include Banking scopes (`accounts.read`, `accounts.write`, `transfers.write`), Checkout, Connect (`payees.read`, `payees.write`, `payees.credit`, `payouts.write`, `payees.tax_forms.read`), and the two management scopes (`keys.manage`, `webhooks.manage`). **Developer / Agency** businesses default to `checkout`, `accounts.read` and `accounts.write`; tick `transfers.write` when you create quotes and transfers. **Connect mode** uses a different form: Checkout plus payee scopes, and a Connect key cannot also hold Banking scopes — see [Connect](https://docs.easner.com/connect.md#keys) and [Test and live](https://docs.easner.com/test-and-live.md#what-a-live-key-needs). The management scopes are never on by default. Restricted keys use a subset of the scopes their mode allows.

## Rotate a key

There is no in-place rotation, so there is no downtime:

1. Create a new key in Settings → API keys.
2. Deploy the new `EASNER_SECRET_KEY` (and the new `easner_pk_…` in your pages).
3. Revoke the old key in the same list. Revoked keys answer `401 invalid_api_key` immediately.

If a secret leaks, revoke it first. Webhook signing secrets rotate separately, per endpoint, in Settings → Webhooks (Rotate secret). The old secret stops working at once.

## Livemode

Livemode comes from the key prefix, not from a body field.

| Prefix | Mode |
| - | - |
| `easner_sk_test_` | Test |
| `easner_sk_live_` | Live |
| `easner_pk_test_` | Publishable, Checkout.js only |
| `easner_pk_live_` | Publishable, Checkout.js only |

A test key never sees live objects. A live key never sees test objects.

## Scopes

| Scope | Used for |
| - | - |
| `checkout` | `POST /v1/checkout/sessions`, `POST /v1/customer_portal/sessions`, the subscription actions, `POST /v1/products`, `POST /v1/prices` and `POST /v1/promotion_codes` (and their `/:id` routes). Also every Checkout read, like `checkout.read` |
| `checkout.read` | Every Checkout `GET`: sessions, payments, subscriptions, checkout customers, refunds, products, prices and promotion codes. For a reporting or dashboard key that must not create anything. A key with `checkout` already has it |
| `refunds.write` | `POST /v1/refunds`. Off by default, because a refund returns money to the payer. Tick it on purpose when you create the key |
| `accounts.read` | `GET` customers, accounts, deposit instructions, deposit addresses, payment methods, destinations, transfers, transactions |
| `accounts.write` | `POST /v1/customers`, `POST /v1/accounts`, `POST /v1/customers/:id/verification`, `POST /v1/accounts/:id/onramp_sessions`, `POST /v1/destinations` |
| `transfers.write` | `POST /v1/quotes`, `POST /v1/transfers`, `POST /v1/transfers/:id/cancel` |
| `payees.read` | Connect reads: payees, balances, payouts, ledger entries, payout limits, reconciliations, tax form metadata |
| `payees.write` | `POST /v1/payees`, link sessions, and test controls (`POST /v1/test/…` on payees) |
| `payees.credit` | `POST /v1/payees/:id/credits`, `POST /v1/credits/batch`, `POST /v1/credits/:id/reversals` |
| `payouts.write` | `POST /v1/payouts`, `POST /v1/payout_sessions` |
| `payees.tax_forms.read` | `GET /v1/payees/:id/tax_form` after the payee consented |
| `keys.manage` | `GET /v1/api_keys`, `POST /v1/api_keys/:id/revoke`. Revoking only, creating stays in Console. See [API keys](https://docs.easner.com/api-keys.md) |
| `webhooks.manage` | `GET`, `POST` `/v1/webhook_endpoints`, `POST` and `DELETE` `/v1/webhook_endpoints/:id`. See [Webhooks](https://docs.easner.com/webhooks.md#manage-endpoints-via-the-api) |

The route-by-route matrix, with the money-out switch, restrictions and verification gates, is on [API keys and scopes](https://docs.easner.com/api-keys.md).

A key without the required scope returns `403`. A missing, unknown or revoked key returns `401` `invalid_api_key`:

```json theme={null}
{
  "error": {
    "type": "permission",
    "code": "key_forbidden",
    "message": "This key cannot transfers.write"
  }
}
```

If a call returns `key_forbidden`, mint a new key from Settings → API keys with the missing scope. A key's scopes cannot be edited later.

## Idempotency

Send `Idempotency-Key` on every `POST` that creates something or changes a subscription. Only the routes in the table honour it. On every other `POST` the header is accepted and recorded in your request log but nothing is deduplicated: creating a customer, destination, quote, account, onramp session or portal session twice creates two objects.

| Route | Honours `Idempotency-Key` | Replay | Same key, different body |
| - | - | - | - |
| `POST /v1/checkout/sessions` | Yes | `200` with the session stored the first time (a first call is `201`) | `409` `idempotency_mismatch`. `409` `idempotency_in_progress` while the first call is still running |
| `POST /v1/refunds` | Yes | `201` with the original refund id and status, and `amount_refunded_total` as it is now | `409` `idempotency_mismatch` when the payment or (if you sent one) the `amount` differs. `reason` is not compared |
| `POST /v1/subscriptions/:id/cancel`, `POST /v1/subscriptions/:id/pause`, `POST /v1/subscriptions/:id/resume` | Yes | `200` with the subscription as it is now, when the change is already made. Payment processing is not run again | Not compared. The key is kept per business, subscription and action. A different body with the same key acts on the subscription as it is when the request arrives |
| `POST /v1/transfers` | Yes | `201` with the original transfer in its current state, the same test-mode `client_secret` as the first response, and no second email | `409` `idempotency_mismatch` when `quote`, `source`, `destination`, `amount` or `currency` differs. Fields left out are not compared |
| `POST /v1/customers`, `/v1/accounts`, `/v1/destinations`, `/v1/quotes`, `/v1/customer_portal/sessions`, `/v1/customers/:id/verification`, `/v1/accounts/:id/onramp_sessions`, `/v1/transfers/:id/cancel` | No | Creates again (cancel is naturally repeatable) | Not applicable |
| `POST /v1/products`, `POST /v1/prices`, `POST /v1/promotion_codes` | Yes | `200` with the object the first call made (the first call is `201`). The key is kept per business and mode | Not compared. A different body with the same key returns the first object |
| `POST /v1/webhook_endpoints` | No | Creates a second endpoint with its own signing secret. Look for the first one in `GET /v1/webhook_endpoints` before you retry | Not applicable |
| `POST /v1/webhook_endpoints/:id`, `DELETE /v1/webhook_endpoints/:id`, `POST /v1/api_keys/:id/revoke` | No | Repeatable: the same change again changes nothing | Not applicable |
| `POST /v1/transfers/:id/confirm` | No. Uses the transfer `client_secret` (`easner_ta_…`) | A confirm after `completed` returns the same transfer | Not applicable |
| `POST /v1/payees/:id/credits`, `POST /v1/credits/:id/reversals` | Yes. If you omit the header, the `reference` is the key | `200` with the first result (the first call is `201`) | `409` `idempotency_key_reused` |
| `POST /v1/credits/batch` | Yes. The header is required | `200` with the first batch | `409` `idempotency_key_reused` when the credits differ |
| `POST /v1/payouts` | Yes. The header is required | The same payout | `409` `idempotency_key_reused` when the terms differ |
| `POST /v1/payees` | No. The same `reference` returns the same payee | The existing payee | Not applicable |

Rules that apply to every `/v1` route:

* The key is trimmed, at most 255 characters. Longer is `400` `invalid_idempotency_key`, checked before anything else (it used to be ignored, which silently dropped your retry protection).
* Keys are scoped to your business, so another merchant's key can never collide with yours. For transfers the key is also scoped to the mode.
* No expiry is defined in code. Easner does not delete a key on a timer, but do not rely on keys living forever: use one stable key per logical operation (for example `checkout-ord_1042`) and treat it as valid for a day or so of retries.
* A new random key on every retry gives no protection.
* A merchant key on confirm returns `403` `customer_action_required`.

```bash theme={null}
curl https://api.easner.com/v1/checkout/sessions \
  -H "Authorization: Bearer $EASNER_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: checkout-ord_1042" \
  -d '{"mode":"payment","currency":"usd","amount":4900,"success_url":"https://yoursite.com/thanks"}'
```

## Rate limits

An over-limit call answers `429` with `Retry-After: 60` (seconds) and this body:

```json theme={null}
{ "error": { "type": "rate_limit", "code": "rate_limit", "message": "Too many requests" } }
```

There are no `X-RateLimit-*` headers. `Retry-After` is the only signal and it is always `60`. Wait that long, then retry the same request with the same `Idempotency-Key`. Do not open a new send.

What is enforced today:

| Limit | Per minute | Applies to | Notes |
| - | - | - | - |
| Per IP, reads | 120 | Every `GET` on `/v1` | Approximate. Counted in memory on each server instance, so the real ceiling depends on which instance answers and resets when it restarts |
| Per IP, writes | 30 | Every `POST` on `/v1` | Same caveat |
| Per business, reads | 300 | Every `GET` on `/v1` with a secret key | Shared across all your keys, counted in the database. `429` `rate_limit` with `Retry-After: 60` |
| Per business, writes | 40 | Calls that use `accounts.write` or `transfers.write` (customers, accounts, verification, onramp, destinations, quotes, transfers, cancel), plus `POST /v1/checkout/sessions`, `POST /v1/refunds` and `POST /v1/customer_portal/sessions`, and every `POST` or `DELETE` on `/v1/api_keys` and `/v1/webhook_endpoints` | Shared across all your keys, counted in the database |
| Per business, checkout sessions | 100 | `POST /v1/checkout/sessions` | On top of the write budget |

The per-business read budget is the figure Console, Usage shows as reads per minute. It is enforced on every `GET` on `/v1` that needs a secret key (not on the browser call `GET /v1/checkout/publishable-keys/validate`).

If the shared counter store is unavailable, the business limits let the call through rather than fail. The per-IP limits still apply. All numbers can change: build for `429`, do not build for a number.

## Restrictions

If Easner restricts your business, matching writes return `403` with `ACCOUNT_RESTRICTED` or `ACCOUNT_LOCKED`. Which routes check this is listed on [API keys and scopes](https://docs.easner.com/api-keys.md#restrictions). Sending money over the API also needs the money-out switch: see [Send](https://docs.easner.com/send.md).

> [card] [Errors](https://docs.easner.com/errors.md)
>
> Envelope, status codes, and common codes.


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