Every request to the Marlin API must include an API key. The key identifies your merchant account and determines which environment — live or test — your request targets. This page explains how to create keys, how to pass them, and what to expect when authentication fails.Documentation Index
Fetch the complete documentation index at: https://yanhgming.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Create an API key
API keys are managed in Settings → API Keys on the Marlin dashboard. Click Create key, give it a name that describes where you’ll use it (for example,production-server or ci-tests), and copy the value immediately. For security reasons the full key is only shown once.
You can create multiple keys and revoke any of them without affecting the others — useful for rotating credentials or isolating access across services.
Pass the key in requests
Include the key in theAuthorization header of every API request:
Using the SDK
The SDK handles the header for you. Pass your key when you instantiate the client:MARLIN_API_KEY in your deployment environment or a .env file (and add .env to .gitignore).
Using curl
Key prefixes
Every Marlin API key starts with a prefix that tells you which environment it targets:| Prefix | Environment | Description |
|---|---|---|
sk_live_ | Production | Processes real on-chain payments. Use in your production servers only. |
sk_test_ | Test mode | Safe for development and CI. No real funds move. |
sk_test_ keys during development so you can create invoices, fire webhooks, and run through checkout flows without touching real funds.
Authentication errors
If your key is missing, malformed, or revoked, the API returns a401 response:
- The
Authorizationheader is absent - The key was revoked in Settings
- You’re using a
sk_test_key against the production API (or vice versa)
Rate limits
The Marlin API enforces rate limits to keep the service stable. Every response includes three headers that tell you where you stand:| Header | Type | Description |
|---|---|---|
X-RateLimit-Limit | number | Maximum requests allowed in the current window |
X-RateLimit-Remaining | number | Requests remaining in the current window |
X-RateLimit-Reset | number | Unix timestamp (seconds) when the window resets |
429 Too Many Requests response. The SDK automatically retries requests that fail with 500, 502, 503, or 504 status codes (up to two retries with exponential backoff), but does not retry 429 — you should implement backoff based on the X-RateLimit-Reset value.