Authentication

API Keys

Protected SynapseX API requests accept bearer tokens and API keys.
curl https://api.synapsex.ai/v1/agents \
  -H "Authorization: Bearer sk_..."

curl https://api.synapsex.ai/v1/agents \
  -H "X-API-Key: sk_..."

Get an API Key

Use the CLI or the API key endpoint.
synapsex login --email user@example.com
synapsex keys --create "CI key"
Or call the API after login:
POST /v1/auth/keys
Authorization: Bearer <access-token>
Content-Type: application/json

{ "name": "CI key", "description": "Used by GitHub Actions" }

Key Format

sk_...
Older internal examples may show sx-, sx_live_, or sk-synapsex- placeholders. For current API-key auth, use the sk_... format accepted by the gateway and CLI.

Login Tokens

POST /v1/auth/login
Content-Type: application/json

{ "email": "user@example.com", "password": "..." }
Response shape depends on the auth service, but includes an access token and usually a refresh token:
{
  "access_token": "eyJ...",
  "refresh_token": "eyJ...",
  "token_type": "bearer",
  "expires_in": 3600,
  "user": {
    "id": "user-123",
    "email": "user@example.com",
    "tenantId": "tenant-123"
  }
}

Headers

HeaderRequiredDescription
Authorization: Bearer <token>Yes, unless using X-API-KeyJWT session token or API key
X-API-Key: sk_...Yes, unless using bearer authAPI-key auth alternative
X-Tenant-IdSDK-dependentTenant scoping header used by SDK clients

Plan Limits

PlanAPI KeysAPI Calls/month
Free21,000
Pro1050,000
TeamUnlimitedUnlimited
EnterpriseUnlimitedCustom

Token Validation

Gateway services validate bearer tokens with the auth service. Public clients should not call internal validation endpoints directly. Use GET /v1/auth/me to verify the active token:
curl https://api.synapsex.ai/v1/auth/me \
  -H "Authorization: Bearer eyJ..."