Authentication

Two auth mechanisms: JWT for platform APIs (api.e2a.bot), API keys for control plane (api.e2a.bot).

Auth Types

Bearer JWT

Short-lived token from /v1/auth/verify-otp. Used for api.e2a.bot routes (account, API keys, billing, dashboard).

Bearer API key

Long-lived key from /v1/api-keys. Format: e2a_live_.... Used for api.e2a.bot routes (sandboxes, sessions, secrets).

Request OTP

POSTapi.e2a.bot/v1/auth/login

Request a one-time password sent to your email. Creates account if new.

Request

curl -X POST https://api.e2a.bot/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'
CodeMeaningWhen
200OKOTP sent (or queued)

Verify OTP

POSTapi.e2a.bot/v1/auth/verify-otp

Verify the OTP code to receive a JWT.

Request

curl -X POST https://api.e2a.bot/v1/auth/verify-otp \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "code": "123456"}'

Response (200)

{
  "token": "eyJ...",          // JWT — use as Bearer token
  "user_id": "usr_abc",
  "email": "you@example.com"
}
CodeMeaningWhen
200OKOTP valid, JWT issued
401UnauthorizedOTP invalid or expired

Create API Key

POSTapi.e2a.bot/v1/api-keys

Create a new API key. The full secret is returned once — save it!

Request

curl -X POST https://api.e2a.bot/v1/api-keys \
  -H "Authorization: Bearer eyJ..."    # JWT from verify-otp

Response (201)

{
  "key_id": "key_abc",
  "key": "e2a_live_...",      // SAVE THIS — only shown once!
  "prefix": "e2a_live_abc"
}
CodeMeaningWhen
201Createdkey issued

List API Keys

GETapi.e2a.bot/v1/api-keys

List all API keys. Secrets are NOT returned.

Response (200)

{
  "api_keys": [
    {
      "key_id": "key_abc",
      "prefix": "e2a_live_abc",
      "revoked": false,
      "created_at": "2026-04-18T12:34:56Z",
      "plan_tier": "free"
    }
  ]
}

Revoke API Key

DELETEapi.e2a.bot/v1/api-keys/{id}

Revoke an API key. Irreversible — revoked keys stop authenticating immediately.

Response (200)

{ "status": "revoked" }
CodeMeaningWhen
200OKkey revoked
404Not foundno such key_id for this user