logoAccess

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

Create API 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

FieldTypeRequiredDescription
namestringYesHuman-readable label (min 1 character)
expires_innumberNoExpiry in seconds from now (min 3600). Omit for no expiry
presetstringOne ofA named bundle of permissions, such as read_only or developer
permissionsstring[]One ofPermissions 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.

PresetGrantsDescription
full_access*Everything except sensitive permissions (refunds, payouts, API keys, owner account).
read_only*:readView every non-sensitive resource. Cannot change anything.
developercheckout_sessions:*, customers:read, customers:write, payments:read, payments:create, payment_methods:read, webhooks:*, verifications:*A typical integration: checkout, customers, payments, webhooks and verifications.
checkoutcheckout_sessions:*, customers:read, customers:write, payment_methods:readRun checkout sessions and manage the customers attached to them.
payments_onlypayments:*, customers:readView and create payments. No refunds.
crypto_onlycrypto_payments:*, customers:readView and create crypto payments. No refunds.
billingsubscriptions:*, invoices:*, customers:read, customers:write, payment_methods:*Subscriptions, invoices and payment methods. Customers can be viewed and edited, not deleted.
invoicinginvoices:*, customers:read, customers:writeManage invoices and the customers they belong to.
verificationverifications:*, payments:read, crypto_payments:readRun payment verifications and read the payments they check.
webhooks_onlywebhooks:*Manage webhook endpoints and nothing else.
reportingpayments:read, crypto_payments:read, payouts:read, invoices:read, subscriptions:read, customers:readRead-only access to payments, payouts, invoices, subscriptions and customers.
support*:read, subscriptions:cancelView everything non-sensitive and cancel subscriptions.
branding_editorbranding:*, settings:readEdit branding and read settings.
payouts_operatorpayouts:read, payouts:createView and create payouts. Includes the sensitive payouts:create permission.

Resources and actions

ResourceActions
customersread, write, delete
paymentsread, create, refund (sensitive)
subscriptionsread, write, cancel
invoicesread, write, void
checkout_sessionsread, create, expire
webhooksread, write, delete
api_keysread (sensitive), create (sensitive), revoke (sensitive)
settingsread, write
payoutsread, create (sensitive)
crypto_paymentsread, create, refund (sensitive)
payment_methodsread, write, delete
userread (sensitive), write (sensitive), delete (sensitive)
brandingread, write
verificationsread, create

Get the Permission Catalog

List API key permissions
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"]
    }
  ]
}
FieldDescription
actions[].permissionThe value to send in permissions when creating a key
actions[].sensitiveNever granted by a wildcard; send it explicitly
presets[].keyThe value to send as preset when creating a key
presets[].grantsWhat is stored on the key (wildcards stay wildcards)
presets[].resolvedThe permissions those grants match today, for a "this key can…" preview

List Keys

List API 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 ParameterDescription
cursorPagination cursor
limitResults 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

Revoke 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

Revoke API 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

Roll API 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

ActionMethodEndpoint
CreatePOST/api/v1/api-keys
CatalogGET/api/v1/api-keys/catalog
ListGET/api/v1/api-keys
GetGET/api/v1/api-keys/:id
UpdatePATCH/api/v1/api-keys/:id
RevokeDELETE/api/v1/api-keys/:id
RollPOST/api/v1/api-keys/:id/roll

How is this guide?