Authentication

Authentication

API Keys

y0 uses API keys for authentication. API keys are scoped to a tier (Free, Growth, Business, Enterprise).

Getting an API Key

  1. Sign up at y0.exchange/business
  2. Create a new project
  3. Generate an API key (prefix: y0_)
  4. Set it as an environment variable

Using Your API Key

MCP Server:

{
  "mcpServers": {
    "y0": {
      "command": "npx",
      "args": ["@y0exchange/mcp"],
      "env": {
        "Y0_API_KEY": "y0_your-api-key"
      }
    }
  }
}

REST API:

curl -H "Authorization: Bearer y0_your-api-key" \
  https://api.y0.exchange/v1/balance?address=0xd8dA...

Sessions

For write tools, the signing service creates sessions that link an API key to a user’s wallet address.

Session Management

POST /api/sessions       — Create session (returns session ID + API key)
GET  /api/sessions       — List active sessions
DELETE /api/sessions/:id — Revoke session

Session Properties

PropertyDescription
idUnique session ID
userAddressLinked wallet address
apiKeyHashHashed API key (never stored in plain text)
permissionsJSON: allowed tools, chains, token pairs
spendingLimitsJSON: per-tx and daily USD limits

Rate Limits

TierRate LimitMonthly Limit
Free10 req/minUnlimited
Growth60 req/minUnlimited
Business300 req/minUnlimited
EnterpriseCustomUnlimited

Security

  • API keys are hashed (SHA-256) before storage
  • All API traffic is HTTPS-only
  • Sessions can be revoked at any time
  • Spending limits are enforced server-side
  • Users can disconnect wallet and revoke all sessions