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
- Sign in to the Access dashboard
- Navigate to your merchant settings
- Create a new API key under the API Keys section
You can also create API keys programmatically:
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:
| Option | Type | Description |
|---|---|---|
name | string | Display name for the key (required) |
expires_in | number | Expiry in seconds from creation (min 3600). Omit for no expiry |
preset | string | A named bundle of permissions, such as read_only or developer |
permissions | string[] | 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
| Action | Method | Endpoint |
|---|---|---|
| Create key | POST | /api/v1/api-keys |
| List keys | GET | /api/v1/api-keys |
| Permission catalog | GET | /api/v1/api-keys/catalog |
| Get key | GET | /api/v1/api-keys/:id |
| Update key | PATCH | /api/v1/api-keys/:id |
| Revoke key | DELETE | /api/v1/api-keys/:id |
| Roll key | POST | /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 Requestsif your plan's overage behavior is set toBLOCK. - 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=42Over 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.
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"
}
}| Scenario | HTTP Status | Code |
|---|---|---|
| Missing or invalid key | 401 | unauthorized |
| Disabled key | 403 | forbidden |
| Expired key | 401 | unauthorized |
| Too many requests | 429 | rate_limited |
| Feature not in plan | 403 | feature_not_available |
| Quota exceeded | 429 | quota_exceeded |
How is this guide?