> ## 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.

# API keys and scopes

> Create keys in Console, revoke over the API, and see which scope each route needs.

Every key belongs to one business and one mode (test or live). The same key type authenticates **Banking**, **Checkout** and **Connect** routes on `https://api.easner.com/v1`; only the scopes on the key differ. Over the API a key can see and revoke the keys of its own mode, if it carries the `keys.manage` scope. Creating a key is a Console action. Bearer auth and rotation: [Authentication](https://docs.easner.com/authentication.md).

## What the API does

| Method and path | Scope | Purpose |
| - | - | - |
| `GET /v1/api_keys` | `keys.manage` | Lists the keys of your mode, revoked ones included |
| `POST /v1/api_keys/:id/revoke` | `keys.manage` | Revokes one key of your mode. Instant |

A key in the list has these fields, and no others:

| Field | Type | Notes |
| - | - | - |
| `id` | string | The key id. Use it to revoke |
| `object` | string | `api_key` |
| `name` | string \| null | The name given at creation |
| `mode` | string | `test` or `live` |
| `scopes` | string\[] | The scopes fixed at creation |
| `created` | string | When the key was created |
| `last_used_at` | string \| null | The last time a call used the key. `null` if it has not been used |
| `revoked_at` | string \| null | When the key was revoked. `null` while it works |

The list is paged and newest first, like every list. See [Pagination and filtering](https://docs.easner.com/reference.md#pagination-and-filtering).

## What the API does not do

* **Create a key.** Creating a key needs a security code in Console, and the secret is shown in the browser. Make keys in Console: Settings → API keys, then Create test key or Create live key. Choose the scopes there.
* **Show a secret.** The secret, the publishable key and the stored hash are never returned by the API, not even to a key with `keys.manage`.
* **Change a key.** A key's name and scopes are fixed. To change what a key can do, create a new key in Console and revoke the old one.
* **Undo a revoke.** A revoked key cannot be revived. Create a new key.
* **Revoke a key of the other mode.** A test key sees only test keys and a live key only live keys. Another key's id is `404` `not_found`.

## Secrets are shown once

A secret key (`easner_sk_…`) is shown once, when it is created in Console. Easner keeps only a hash, so a lost secret cannot be read back. If a secret is lost or leaked, create a new key in Console, deploy it, then revoke the old one through the API or in Console. Rotation is covered on [Authentication](https://docs.easner.com/authentication.md#rotate-a-key).

## Revoking

`POST /v1/api_keys/:id/revoke` takes no body. It works at once: the next call with the revoked key answers `401` `invalid_api_key`.

* A key can revoke itself. The response is the key with `revoked_at` set, and the calling request is the last one that key makes.
* Revoking a key that is already revoked answers `200` with the key unchanged, and writes nothing.
* An id that is not a key of your business and mode is `404` `not_found`.
* The change is written to the audit log. It is credited to the person who created the calling key, or to the business owner if that is not known. The owner is not emailed about a revoke.

```text theme={null}
POST https://api.easner.com/v1/api_keys/{id}/revoke
Authorization: Bearer easner_sk_…
```

## Errors

| Status | `code` | When |
| - | - | - |
| `401` | `invalid_api_key` | The calling key is missing, unknown or revoked |
| `403` | `key_forbidden` | The calling key lacks `keys.manage` |
| `404` | `not_found` | The id is not a key of this business and mode |
| `429` | `rate_limit` | Over the write budget (a revoke counts as a write). Wait `Retry-After` seconds |

See [Errors](https://docs.easner.com/errors.md) for every code.

## Console

Settings → API keys, in Console, is where you create keys, see their scopes, and revoke them with a security code. Use the API for automation that only needs to look at or revoke keys.

## Scope matrix

| Method and path | Scope | Money-out switch | Restriction check | Verification | Mode |
| - | - | - | - | - | - |
| `GET /v1/customers`, `GET /v1/customers/:id` | `accounts.read` | No | No | No | Key mode only |
| `POST /v1/customers` | `accounts.write` | No | Yes, send check | No | Key mode |
| `POST /v1/customers/:id/verification` | `accounts.write` | No | No | Starts it | Test approves at once |
| `GET /v1/accounts`, `GET /v1/accounts/:id` | `accounts.read` | No | No | No | Key mode only |
| `POST /v1/accounts` | `accounts.write` | No | Yes, deposit check | No | Key mode |
| `GET /v1/accounts/:id/deposit_instructions` | `accounts.read` | No | Yes, deposit check | Live: customer `approved` | Test returns sandbox details |
| `GET /v1/accounts/:id/deposit_addresses` | `accounts.read` | No | Yes, deposit check | Live: customer `approved` | Test skips verification |
| `POST /v1/accounts/:id/onramp_sessions` | `accounts.write` | No | Yes, deposit check | Live: customer `approved` | Test completes on the hosted page |
| `GET /v1/payment_methods` | `accounts.read` | No | No | No | Same catalog in both |
| `GET /v1/destinations` | `accounts.read` | No | No | No | Key mode only |
| `POST /v1/destinations` | `accounts.write` | **Yes** | No | No | Key mode |
| `POST /v1/quotes` | `transfers.write` | No | No | No | Test is priced 1:1 |
| `GET /v1/transfers`, `GET /v1/transfers/:id` | `accounts.read` (or the transfer `easner_ta_…` secret on the id route) | No | No | No | Key mode only, on list and by id |
| `POST /v1/transfers` | `transfers.write` | **Yes** | Yes, send check | Live: customer needs an email | Test returns a `client_secret` |
| `POST /v1/transfers/:id/cancel` | `transfers.write` | No | No | No | Key mode only |
| `POST /v1/transfers/:id/confirm` | None. The customer's `easner_ta_…` secret. A merchant key gets `403` `customer_action_required` | **Yes** | No | No | The transfer's own mode |
| `GET /v1/transactions`, `GET /v1/transactions/:id` | `accounts.read` | No | No | No | Key mode only |
| `POST /v1/checkout/sessions` | `checkout` | No | No | Live: business verified and online payments set up. Test: none | Test sessions are test objects |
| `GET /v1/checkout/sessions`, `GET /v1/checkout/sessions/:id`, `GET /v1/checkout/sessions?id=` | `checkout.read` | No | No | No | Key mode only |
| `GET /v1/customers/checkout`, `GET /v1/customers/checkout/:id` | `checkout.read` | No | No | No | Key mode only. UUID customers, not `cus_` |
| `GET /v1/payments`, `GET /v1/payments/:id` | `checkout.read` | No | No | No | Key mode only. Settled payments only |
| `GET /v1/subscriptions`, `GET /v1/subscriptions/:id` | `checkout.read` | No | No | No | Key mode only |
| `POST /v1/subscriptions/:id/cancel`, `POST /v1/subscriptions/:id/pause`, `POST /v1/subscriptions/:id/resume` | `checkout` | No | No | No | Key mode only. None moves money: `refund_unused` is Console only |
| `POST /v1/subscriptions/:id` | `checkout` | No | No | No | Key mode only. Changes seats or price; prorates by default, and a removed seat is credited, never refunded |
| `GET /v1/subscriptions/:id/preview` | `checkout.read` | No | No | No | Key mode only. Changes nothing |
| `GET /v1/discounts`, `GET /v1/discounts/:id` | `checkout.read` | No | No | No | Key mode only |
| `POST /v1/discounts`, `POST /v1/discounts/:id` | `checkout` | No | No | No | Key mode only. Grants a discount to an email, or switches it off with `active` |
| `POST /v1/refunds` | `refunds.write` | No | No | No | Key mode only |
| `GET /v1/refunds` | `checkout.read` | No | No | No | Key mode only |
| `POST /v1/customer_portal/sessions` | `checkout` | No | No | No | Key mode decides test or live customers |
| `GET /v1/products`, `GET /v1/products/:id`, `GET /v1/prices`, `GET /v1/prices/:id` | `checkout.read` | No | No | No | Key mode only |
| `POST /v1/products`, `POST /v1/products/:id`, `POST /v1/prices`, `POST /v1/prices/:id` | `checkout` | No | No | No | Key mode. A price is immutable: only `active` changes |
| `GET /v1/promotion_codes`, `GET /v1/promotion_codes/:id` | `checkout.read` | No | No | No | Key mode only |
| `POST /v1/promotion_codes`, `POST /v1/promotion_codes/:id` | `checkout` | No | No | No | Key mode. A code is immutable: only `active` changes |
| `GET /v1/checkout/publishable-keys/validate` | None. A publishable key in `?key=` | No | No | No | Key mode |
| `GET /v1/payees`, `GET /v1/payees/:id`, `GET /v1/payees/:id/balance`, `GET /v1/payouts`, `GET /v1/payouts/:id`, `GET /v1/payee_entries`, `GET /v1/payout_limits` | `payees.read` | No | No | Connect is live for the business | Key mode only. Connect mode only |
| `POST /v1/payees` | `payees.write` | No | No | Connect is live | Key mode only. Finds or creates by your `reference`. Needs no signature: it moves no money and sets no payout destination |
| `POST /v1/payees/:id` | `payees.write` | No | No | Connect is live | Changes name, email, country or income type. `reference` never changes. Every change is recorded |
| `GET /v1/payees/:id/tax_form` | `payees.tax_forms.read` | No | No | The payee has consented | Type, dates and the last four digits. Every read is logged |
| `POST /v1/link_sessions` | `payees.write` | No | No | Connect is live | 60 minute connect session. `code_challenge`, `state` and `redirect_uri`, plus an existing payee or the fields for a new one |
| `POST /v1/link_sessions/:id/redeem` | `payees.write` | No | No | Connect is live | `code_verifier` and `code`. The verifier must match the challenge. Finishes the link on your server |
| `POST /v1/link_sessions/:id/confirm` | `payees.write` | No | No | Connect is live | Confirms a link the email rule held back |
| `POST /v1/payout_sessions` | `payouts.write` | No | No | Connect is live | 15 minute secret for the Withdraw sheet |
| `POST /v1/payees/:id/credits`, `POST /v1/credits/:id/reversals` | `payees.credit` | No | No | Connect is live | Adds or takes back earnings. Moves no money itself, but decides what a person is owed. `Idempotency-Key` defaults to the `reference` |
| `POST /v1/credits/batch` | `payees.credit` | No | No | Connect is live | Up to 1,000 credits, all or nothing, with required control totals. `Idempotency-Key` is required |
| `POST /v1/payouts` | `payouts.write` | No | No | Connect is live | The secret key is enough in test and live. `Idempotency-Key` is required |
| `POST /v1/reconciliations` | `payees.read` | No | No | Connect is live | Compares your ledger totals with Easner's balances. Changes nothing |
| `POST /v1/test/fund`, `POST /v1/test/settle`, `POST /v1/test/payees/:id/approve_link`, `POST /v1/test/payees/:id/unlink` | `payees.write` | No | No | Test keys only | A live key gets `403` `test_mode_only` |
| `GET /v1/api_keys` | `keys.manage` | No | No | No | Key mode only |
| `POST /v1/api_keys/:id/revoke` | `keys.manage` | No | No | No | Key mode only. Instant |
| `GET /v1/webhook_endpoints` | `webhooks.manage` | No | No | No | Key mode only |
| `POST /v1/webhook_endpoints`, `POST /v1/webhook_endpoints/:id`, `DELETE /v1/webhook_endpoints/:id` | `webhooks.manage` | No | No | No | Key mode only. The owner is emailed |

Notes:

* `keys.manage` and `webhooks.manage` are never on by default. Tick them on purpose when you create a key in Console, or leave them off. Detail on [API keys](#what-the-api-does) and [Webhooks](https://docs.easner.com/webhooks.md#manage-endpoints-via-the-api).
* Money-out switch: live only, off by default. Live calls return `403` `payouts_disabled` until Easner enables it for you. Test calls are never held by it. See [Send](https://docs.easner.com/send.md).
* Quotes and cancel are not behind the money-out switch, and neither check restrictions. Only creating the transfer is.
* A key sees only objects of its own mode. A wrong-mode id is `404` `not_found`.

## Restrictions

Easner can restrict a business for sending, for deposits, or lock it. The restriction answers `403` with `type: permission` and one of two codes:

| Check | When it runs | Code returned |
| - | - | - |
| Send check | `POST /v1/customers`, `POST /v1/transfers` | `ACCOUNT_LOCKED` if the business is locked, otherwise `ACCOUNT_RESTRICTED` |
| Deposit check | `POST /v1/accounts`, `POST /v1/accounts/:id/onramp_sessions`, `GET /v1/accounts/:id/deposit_instructions`, `GET /v1/accounts/:id/deposit_addresses` | `ACCOUNT_RESTRICTED` (also when locked) |

`POST /v1/destinations` does not check restrictions (it checks the money-out switch only), and neither do Checkout routes or reads such as `GET /v1/accounts`. Resolve a restriction in Console or with support, then retry. Branch on `code`.

## Rate limits and headers

Over a limit, the call answers `429` with `Retry-After: 60` and the usual error body (`type` `rate_limit`, `code` `rate_limit`). Response headers on `/v1` calls:

| Header | When | Value |
| - | - | - |
| `Retry-After` | Only on `429` | Always `60` (seconds) |
| `access-control-allow-origin` | Only on `GET /v1/checkout/publishable-keys/validate` | `*` |

There are no `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` headers, and no `Idempotency-Key` echo header. The numbers (per IP: 120 reads and 30 writes a minute, approximate; per business: 300 reads and 40 writes a minute, each shared across all your keys; 100 checkout sessions a minute) and what counts as a write are on [Authentication](https://docs.easner.com/authentication.md#rate-limits). `POST /v1/customer_portal/sessions` counts as a write, and so does every `POST` and `DELETE` on `/v1/api_keys`, `/v1/webhook_endpoints` and `/v1/subscriptions/:id/…` (cancel, pause, resume). Their `GET` calls count as reads.

> [card] [Errors](https://docs.easner.com/errors.md)
>
> Every code, with the status it comes back with.


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