logoAccess

Authentication

How to authenticate with the Access API using API keys.

All API requests require authentication via an API key passed in the x-api-key header.

Obtaining an API Key

  1. Sign in to the Access dashboard
  2. Navigate to your merchant settings
  3. Create a new API key under the API Keys section

You can also create API keys programmatically:

Create an API key via API
curl -X POST https://api.tryaccess.xyz/api/v1/api-keys \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-existing-key" \
  -d '{ "name": "Production Key", "preset": "developer" }'

The full key is returned only once at creation time. Store it securely.

Using Your API Key

Include the key in every request via the x-api-key header:

curl https://api.tryaccess.xyz/api/v1/customers \
  -H "x-api-key: sk_..."

Key Format

API keys follow the format sk_<short_token>_<long_token>. The short token is used for lookup, and the long token is hashed and verified server-side. Keys created before the sk_ format start with ak_live and keep working until they are rolled, revoked or expire.

Key Options

When creating a key, you can configure:

OptionTypeDescription
namestringDisplay name for the key (required)
expires_innumberExpiry in seconds from creation (min 3600). Omit for no expiry
presetstringA named bundle of permissions, such as read_only or developer
permissionsstring[]Permissions such as customers:read, or wildcards like *:read

Send exactly one of preset or permissions. Permissions are fixed once the key is made; wildcards never match sensitive permissions such as refunds and payouts. See Permissions for every preset and permission, or fetch them from GET /api/v1/api-keys/catalog.

Key Management

ActionMethodEndpoint
Create keyPOST/api/v1/api-keys
List keysGET/api/v1/api-keys
Permission catalogGET/api/v1/api-keys/catalog
Get keyGET/api/v1/api-keys/:id
Update keyPATCH/api/v1/api-keys/:id
Revoke keyDELETE/api/v1/api-keys/:id
Roll keyPOST/api/v1/api-keys/:id/roll

Rolling a key generates a new token while keeping the same key ID. The old token is immediately invalidated. See the API Keys guide for full details.

Billing & Feature Gates

API key authentication also enforces billing plan limits. Each request is checked against your plan's feature gates and quotas:

  • Feature gates - Certain features (checkout, subscriptions, crypto, OAuth, portal, webhooks) may be restricted by your plan.
  • Verification quota - Plans may include a fixed number of verifications per billing period. Exceeding the quota returns 429 Too Many Requests if your plan's overage behavior is set to BLOCK.
  • API request quota - Plans may cap total API requests per period.

Quota alerts are triggered at 80% and 100% usage thresholds.

Rate Limits

Requests are counted per API key, per minute: 600 reads (GET) and 120 writes, counted separately. Every response says where you are:

RateLimit-Policy: 600;w=60
RateLimit: limit=600, remaining=598, reset=42

Over the limit, the API answers 429 with the rate_limited code and a Retry-After header. After 10 refused keys from one IP address in a minute, that address waits out the minute, even with a valid key.

Portal Authentication

The customer portal uses a separate token-based auth system. Merchantes create portal sessions via the API (using API key auth), and customers receive a short-lived HMAC-signed token.

Create a portal session
curl -X POST https://api.tryaccess.xyz/api/v1/portal/sessions \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_..." \
  -d '{ "customer_id": "cus_01HXYZ..." }'

Customer Portal API endpoints use Bearer token authentication instead of x-api-key. The hosted Customer Portal needs no customer credentials: you create a session with your API key and send the customer to its URL.

Error Responses

Invalid or missing keys return a 401 Unauthorized response:

{
  "error": {
    "type": "authentication_error",
    "code": "unauthorized",
    "message": "Invalid API key. Authentication failed.",
    "doc_url": "https://docs.tryaccess.xyz/docs"
  }
}
ScenarioHTTP StatusCode
Missing or invalid key401unauthorized
Disabled key403forbidden
Expired key401unauthorized
Too many requests429rate_limited
Feature not in plan403feature_not_available
Quota exceeded429quota_exceeded

How is this guide?