Skip to main content
Use these endpoints to manage API keys for a user account. These endpoints require a valid Firebase ID token (not an API key) because they create or revoke keys.

Authentication

Provide an ID token using one of these methods:
  • Authorization: Bearer <ID_TOKEN>
  • x-id-token: <ID_TOKEN>
  • JSON body field idToken

Base URL

Endpoints

List API keys

GET /api/api-keys Response
Example requests

Create API key

POST /api/api-keys Body
Response
Example requests
Notes
  • The full key value is returned only once. Store it securely.
  • The UI and API store only a SHA-256 hash of the key.

Revoke API key

DELETE /api/api-keys Body
Response
Example requests

Example UI

Use a lightweight UI library like shadcn/ui with a free placeholder API to prototype your API-key dashboard layout before wiring it to the Lettuce Stream endpoints.

Limits

  • Maximum active keys per user: API_KEYS_MAX_ACTIVE (default 10).
  • Key prefix format: API_KEY_PREFIX (default ls_live_).
  • Prefix preview length: API_KEY_PREFIX_LENGTH (default 12).

Errors

  • 400 — Missing label or key id, or maximum active keys reached.
  • 401 — Missing or invalid authentication token.
  • 403 — Attempted to revoke a key not owned by the user.
  • 404 — API key not found.
  • 405 — Method not allowed (allowed: GET, POST, DELETE).
  • 500 — Server error.

Example (curl)

Using API keys on other endpoints

Other protected endpoints accept API keys via:
  • x-api-key: <API_KEY>
  • Authorization: Bearer <API_KEY>