API Keys
Create, manage, and rotate API keys programmatically.
API keys authenticate all requests to the Access API. You can manage keys from the dashboard or programmatically via the API.
Create a Key
curl -X POST https://api.tryaccess.xyz/api/v1/api-keys \
-H "Content-Type: application/json" \
-H "x-api-key: sk_..." \
-d '{
"name": "Production Key",
"expires_in": 2592000,
"preset": "developer"
}'Response:
{
"id": "key_01HXYZ...",
"name": "Production Key",
"key": "sk_G9XZC5pQ2wErTyUi_...",
"status": "active",
"permissions": ["checkout_sessions:*", "customers:read", "customers:write", "payments:read", "payments:create", "payment_methods:read", "webhooks:*", "verifications:*"],
"preset": "developer",
"expires_at": "2025-02-15T10:00:00.000Z",
"created_at": "2025-01-15T10:00:00.000Z"
}The full key value is returned only once at creation time. Store it securely it cannot be retrieved later.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable label (min 1 character) |
expires_in | number | No | Expiry in seconds from now (min 3600). Omit for no expiry |
preset | string | One of | A named bundle of permissions, such as read_only or developer |
permissions | string[] | One of | Permissions such as ["customers:read", "invoices:read"], or wildcards |
Send exactly one of preset or permissions; permissions are fixed once the key is made.
Permissions
Each permission is resource:action, such as payments:read. Wildcards are allowed: * (everything),
payments:* (every action on a resource) and *:read (one action on every resource). Wildcards never match
sensitive permissions (payments:refund, payouts:create, crypto_payments:refund, api_keys:*,
user:*); name those explicitly.
A key created through the API can't hold permissions the calling key doesn't, so a read-only key can only
create read-only keys. Requests that break this get a 403 forbidden; unknown
permissions or presets get a 422 parameter_invalid.
Today, permissions are checked when a key creates or rolls another key.
Keys made before permissions existed have none ("permissions": []). They keep working, but can't create
or roll keys through the API; create a new key from the dashboard instead.
Presets
A preset is stored on the key as the grants below (wildcards stay wildcards), and its name is returned
as preset. When you send permissions that exactly match a preset, preset is set too.
| Preset | Grants | Description |
|---|---|---|
full_access | * | Everything except sensitive permissions (refunds, payouts, API keys, owner account). |
read_only | *:read | View every non-sensitive resource. Cannot change anything. |
developer | checkout_sessions:*, customers:read, customers:write, payments:read, payments:create, payment_methods:read, webhooks:*, verifications:* | A typical integration: checkout, customers, payments, webhooks and verifications. |
checkout | checkout_sessions:*, customers:read, customers:write, payment_methods:read | Run checkout sessions and manage the customers attached to them. |
payments_only | payments:*, customers:read | View and create payments. No refunds. |
crypto_only | crypto_payments:*, customers:read | View and create crypto payments. No refunds. |
billing | subscriptions:*, invoices:*, customers:read, customers:write, payment_methods:* | Subscriptions, invoices and payment methods. Customers can be viewed and edited, not deleted. |
invoicing | invoices:*, customers:read, customers:write | Manage invoices and the customers they belong to. |
verification | verifications:*, payments:read, crypto_payments:read | Run payment verifications and read the payments they check. |
webhooks_only | webhooks:* | Manage webhook endpoints and nothing else. |
reporting | payments:read, crypto_payments:read, payouts:read, invoices:read, subscriptions:read, customers:read | Read-only access to payments, payouts, invoices, subscriptions and customers. |
support | *:read, subscriptions:cancel | View everything non-sensitive and cancel subscriptions. |
branding_editor | branding:*, settings:read | Edit branding and read settings. |
payouts_operator | payouts:read, payouts:create | View and create payouts. Includes the sensitive payouts:create permission. |
Resources and actions
| Resource | Actions |
|---|---|
customers | read, write, delete |
payments | read, create, refund (sensitive) |
subscriptions | read, write, cancel |
invoices | read, write, void |
checkout_sessions | read, create, expire |
webhooks | read, write, delete |
api_keys | read (sensitive), create (sensitive), revoke (sensitive) |
settings | read, write |
payouts | read, create (sensitive) |
crypto_payments | read, create, refund (sensitive) |
payment_methods | read, write, delete |
user | read (sensitive), write (sensitive), delete (sensitive) |
branding | read, write |
verifications | read, create |
Get the Permission Catalog
curl https://api.tryaccess.xyz/api/v1/api-keys/catalog \
-H "x-api-key: sk_..."Returns every resource with its actions, and every preset, so you can build a permission picker without hard-coding the lists above. It's the same for every merchant.
{
"resources": [
{
"key": "payments",
"label": "Payments",
"actions": [
{
"key": "refund",
"permission": "payments:refund",
"label": "Issue refunds",
"description": "Refund payments back to customers.",
"sensitive": true
}
]
}
],
"presets": [
{
"key": "read_only",
"label": "Read only",
"description": "View every non-sensitive resource. Cannot change anything.",
"grants": ["*:read"],
"resolved": ["customers:read", "payments:read", "subscriptions:read"]
}
]
}| Field | Description |
|---|---|
actions[].permission | The value to send in permissions when creating a key |
actions[].sensitive | Never granted by a wildcard; send it explicitly |
presets[].key | The value to send as preset when creating a key |
presets[].grants | What is stored on the key (wildcards stay wildcards) |
presets[].resolved | The permissions those grants match today, for a "this key can…" preview |
List Keys
curl https://api.tryaccess.xyz/api/v1/api-keys \
-H "x-api-key: sk_..."Returns all keys for the merchant. Full key values are never included.
{
"data": [
{
"id": "key_01HXYZ...",
"name": "Production Key",
"status": "active",
"request_count": 4523,
"last_request": "2025-01-15T10:30:00.000Z",
"expires_at": null,
"created_at": "2025-01-01T00:00:00.000Z",
"permissions": ["*:read"],
"preset": "read_only"
}
],
"has_more": false,
"next_cursor": null
}| Query Parameter | Description |
|---|---|
cursor | Pagination cursor |
limit | Results per page (1-100, default 20) |
Get a Key
curl https://api.tryaccess.xyz/api/v1/api-keys/key_01HXYZ... \
-H "x-api-key: sk_..."Returns key details including request_count, last_request, permissions and preset.
Update a Key
curl -X PATCH https://api.tryaccess.xyz/api/v1/api-keys/key_01HXYZ... \
-H "Content-Type: application/json" \
-H "x-api-key: sk_..." \
-d '{ "status": "revoked" }'Updatable fields: name, status (active or revoked).
Set status to revoked to disable a key without deleting it.
Revoke (Delete) a Key
curl -X DELETE https://api.tryaccess.xyz/api/v1/api-keys/key_01HXYZ... \
-H "x-api-key: sk_..."Permanently deletes the key. This action cannot be undone.
Roll (Regenerate) a Key
curl -X POST https://api.tryaccess.xyz/api/v1/api-keys/key_01HXYZ.../roll \
-H "x-api-key: sk_..."Response:
{
"id": "key_01HXYZ...",
"key": "sk_Etf5YrbXaQ9mLpZk_..."
}Rolling generates a new key token while keeping the same key ID and permissions. The old token is immediately invalidated. The new key is returned only once. Request count is reset to 0.
The calling key must hold every permission of the key it rolls (403 otherwise). Keys made before permissions can't be rolled (409): create a new key with the permissions it needs, then revoke the old one.
Endpoint Summary
| Action | Method | Endpoint |
|---|---|---|
| Create | POST | /api/v1/api-keys |
| Catalog | GET | /api/v1/api-keys/catalog |
| List | GET | /api/v1/api-keys |
| Get | GET | /api/v1/api-keys/:id |
| Update | PATCH | /api/v1/api-keys/:id |
| Revoke | DELETE | /api/v1/api-keys/:id |
| Roll | POST | /api/v1/api-keys/:id/roll |
How is this guide?