Authentication

Authentication

Every endpoint under /v2/* except the few listed at the bottom requires a Bearer token.

Get an API key

Self-serve from the developer portal:

  1. Open developer.piratecrew.fun.
  2. Sign in with Google.
  3. Click Generate Key, give it a label, and copy the value immediately. The full key is shown once — store it in your secrets manager.
  4. Manage, revoke, or adjust scopes from the same dashboard.

Each key is backed by a row in the api_keys Supabase table.

Sending the key

Authorization: Bearer <your-api-key>

If you're using the SDK, pass the key once to the constructor — every method attaches the header for you.

FailureHTTPerror.codeMessage
Header missing or not Bearer <key>401unauthorizedMissing or invalid API key
Key not found or revoked403forbiddenInvalid or revoked API key
Per-minute quota exceeded429rate_limitedToo many requests this minute
Per-day quota exceeded429rate_limitedDaily quota exceeded
Concurrent-write race lost429rate_limitedRate limit exceeded (concurrent)
Missing required scope (signed-mode endpoints)403forbiddenAPI key missing required scope(s): …

Errors are wrapped in the standard envelope:

{
  "error": {
    "code": "forbidden",
    "message": "API key missing required scope(s): fees:claim",
    "doc_url": "https://docs.piratecrew.fun/docs/scopes-and-permissions"
  },
  "meta": { "request_id": "req_01HXYZ…" }
}

See Errors & Retries for the full code catalog.

Rate limits

Each key carries its own rate_limit_per_minute and rate_limit_per_day. Counters reset on a rolling window. A 429 response tells you which ceiling tripped — retry with exponential backoff starting at 1 second.

Do not retry 4xx responses other than 429.

Scopes

See Scopes & Permissions.

Idempotency

See Idempotency.

Public endpoints (no key required)

  • GET /v2/health — liveness probe
  • GET /v2/openapi.json — live OpenAPI document
  • GET /v2/docs — Swagger UI
  • GET /v2/webhook-event-types — webhook event catalog (public read)