The Relayer API supports three authentication modes. Which one you use depends on who is making the call.Documentation Index
Fetch the complete documentation index at: https://docs.relayer.fi/llms.txt
Use this file to discover all available pages before exploring further.
API Key
Caller: your backend.
Header:
Authorization: ApiKey rk_...Agent HMAC
Caller: an agent at runtime.
Four headers, HMAC-SHA256 signed.
Session JWT
Caller: browser session in the Relayer dashboard.
Header:
Authorization: Bearer <jwt>1. API Key (backend → Relayer)
This is the primary mode for any server-side integration. Your backend authenticates to Relayer with a long-lived API key tied to your workspace.Key format
Making a request
Pass the key in theAuthorization header with the ApiKey scheme:
Scopes
API keys have scopes that limit what they can call:| Scope | What it accesses |
|---|---|
integrator | Standard SDK-grade endpoints (signing, payouts, agents, widgets) |
integrator:read | Read-only subset |
integrator:write | Write-only subset |
internal | Workspace-management endpoints (issued to Relayer’s own dashboard only) |
403 Forbidden — Insufficient permissions, your key’s scope doesn’t cover the endpoint you called.
2. Agent HMAC (agent SDK → Relayer)
Agents authenticate with a per-agent secret that is provisioned at agent-creation time. The Relayer Agent SDK (@relayerfi/agent-sdk) signs every request automatically — you should not handcraft these headers unless you’re writing your own client.
Headers
Every agent request must include:The agent’s UUID (issued by
POST /v1/agents/confirm-policies).The HMAC-SHA256 signature of the canonical request, hex-encoded.
Unix epoch seconds. Must be within ±60 seconds of server time.
Optional. SDK version string (e.g.
@relayerfi/agent-sdk@0.4.1) for telemetry.Signature payload
The signed string is:METHOD— uppercase HTTP method (POST,GET, …)path— request path including/v1prefix (e.g./v1/agents/{id}/x402-pay)timestamp— same value asx-request-timestampsha256(body)— hex-encoded SHA-256 of the JSON body. Usesha256('')for empty bodies.
x-agent-auth.
Reference implementation (for client authors)
Failure modes
| Response | Cause |
|---|---|
401 invalid_auth | Missing one of the required headers, agent not found, or signature mismatch |
401 expired_timestamp | Timestamp drift exceeds 60 seconds |
401 agent_killed | The agent’s status is killed — re-provision before retrying |
3. Session JWT (browser → Relayer dashboard)
The Relayer dashboard (relayer.fi/app) authenticates browser sessions with a JWT in theAuthorization: Bearer header. This mode is for the dashboard product itself — you only need it if you’re building a UI that proxies the user’s session JWT.
Environments
Relayer provides two environments:| Environment | Base URL | Purpose |
|---|---|---|
| Sandbox | https://testnet.relayer.fi/v1 | Testing and development |
| Production | https://api.relayer.fi/v1 | Live operations |
Response envelope
Every response — success or error — uses the same envelope:- Success
- Error
Common auth errors
| Status | Meaning | Fix |
|---|---|---|
401 Unauthorized | Missing or malformed key/JWT/HMAC | Verify header format. ApiKey requires the ApiKey prefix — Bearer is for JWT only |
403 Forbidden | Key is valid but scope doesn’t cover this endpoint | Use a key with the correct scope, or check that the endpoint isn’t internal-only |
404 Not Found | API key does not exist in this environment | Sandbox keys don’t work against production and vice versa |
401 expired_timestamp | Agent HMAC timestamp drift > 60s | Sync your clock (NTP); regenerate timestamp on retry |
Security best practices
Use environment variables
Store keys and agent secrets in
.env files or your platform’s secret manager (Vercel, AWS Secrets Manager, Doppler). Never hardcode them.Server-side only for ApiKey
Never include an
ApiKey in client-side JavaScript, mobile apps, or browser requests. For browser-side use, generate a short-lived client key from the dashboard with limited scope.Rotate regularly
Rotate API keys every 90 days, or immediately if a leak is suspected. Old keys can be revoked from the dashboard.
Pin an IP allowlist
Per-key IP allowlists are configurable from the dashboard. Restrict production keys to your backend’s egress IPs.
Next Steps
Quickstart
Make your first API call in under 5 minutes.
AI Assistants
Connect Relayer docs to Claude Code, Cursor, ChatGPT, and other AI tools via MCP.