Febasidocs
Integrations

Summary

Create-key body, headers, common errors — the cheat sheet.

Create a key

curl -X POST https://auth.febasi.com.br/api/v1/client-keys \
  -H "Authorization: Bearer $ADMIN_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme signup proxy",
    "scopes": ["users:create"],
    "tenantAccessLevel": "specific",
    "allowedTenantIds": ["01HX0..."],
    "allowedOrigins": null,
    "allowedIps": ["10.0.0.0/16"]
  }'

Response includes the full key once — store it immediately:

{
  "success": true,
  "data": {
    "id": "01HZ8...",
    "keyPrefix": "ck_abc1234",
    "fullKey": "ck_abc1234_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    ...
  }
}

Use a key

GET /api/v1/users
X-API-Key: ck_abc1234_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-Tenant-Code: acme
  • X-API-Key carries the secret. Authorization: ApiKey <key> also works.
  • X-Tenant-Code is mandatory for tenant-scoped operations. Without it, dual-auth routes reject with MISSING_TENANT_CONTEXT.

Body fields at a glance

FieldRequiredNotes
nameyesHuman-readable identifier surfaced in usage logs.
scopesyesAt least one. Use the narrowest scope possible.
tenantAccessLevelyesnone / specific (with allowedTenantIds) / global (requires admin:*).
allowedTenantIdswhen specificTenant UUIDs the key can act against.
allowedOriginsnoPer-key CORS allowlist. null inherits from the tenant.
allowedIpsnoPer-key source-IP allowlist (CIDR-capable). null inherits from the tenant.
expiresAtnoISO 8601 timestamp. Strongly recommended for broader scopes.

Common errors

CodeStatusWhen
MISSING_API_KEY401Dual-auth route hit without X-API-Key (and no Bearer JWT either).
INVALID_API_KEY401Key unknown, revoked, or expired.
MISSING_TENANT_CONTEXT401Client Key call without X-Tenant-Code, or the code does not resolve.
INSUFFICIENT_SCOPE403Key lacks the scope the route requires.
TENANT_ACCESS_DENIED403Key tried to act against a tenant outside its allowedTenantIds / tenantAccessLevel.

Operational checklist

  • Store the full key in a secret manager the moment it's returned. The API never reproduces it.
  • Rotate on schedule and on suspected leak — revoke + create a new one, never reuse keys.
  • Audit via GET /api/v1/client-keys/:id/logs for the last N requests + IPs.
  • Pin allowedIps when the egress is known. Pin allowedOrigins if the key is exposed to browsers.

See Client Keys for the full lifecycle and scope catalog.

On this page