Star
API reference

SDK keys

Each key belongs to one environment. Server keys get the rules; client and mobile keys get answers only.

List keys

GET/v1/admin/projects/{project}/environments/{env}/keys

Auth: Personal access token or dashboard session, role admin or higher.

Never the secret. publicKey is set for client and mobile keys, which are public by design, and null for server keys.

Path parameters

NameTypeDescription
projectstringProject key.
envstringEnvironment key.

Responses

{
  "keys": [
    {
      "id": "a8b9c0d1-e2f3-4a4b-9c5d-6e7f80910213",
      "kind": "server",
      "name": "api",
      "revokedAt": null,
      "publicKey": null
    },
    {
      "id": "b9c0d1e2-f3a4-4b5c-8d6e-7f8091021324",
      "kind": "client",
      "name": "web",
      "revokedAt": null,
      "publicKey": "fk_clt_3kX9vR2mQ7pL8nW4"
    }
  ]
}
{
  "error": "NOT_FOUND",
  "message": "no such environment"
}
Common errors (401, 403, 500)
{
  "error": "MISSING_TOKEN",
  "message": "an access token is required"
}
{
  "error": "TOKEN_REJECTED",
  "message": "access token rejected"
}
{
  "error": "SESSION_REJECTED",
  "message": "session expired or rejected"
}
{
  "error": "INSUFFICIENT_ROLE",
  "message": "requires admin or higher"
}
{
  "error": "INTERNAL_ERROR"
}

Example

curl http://127.0.0.1:3000/v1/admin/projects/acme/environments/production/keys -H "Authorization: Bearer $FEATUREKIT_TOKEN"

Create a key

POST/v1/admin/projects/{project}/environments/{env}/keys

Auth: Personal access token or dashboard session, role admin or higher.

The response holds the only copy of the key. Store it now.

Path parameters

NameTypeDescription
projectstringProject key.
envstringEnvironment key.

Body

FieldTypeRequiredDescription
kindstringyesserver, client or mobile.
namestringnoWhere it's used, like api or ios.
expiresAtstringnoISO 8601 date-time.

Responses

{
  "id": "a8b9c0d1-e2f3-4a4b-9c5d-6e7f80910213",
  "kind": "server",
  "key": "fk_srv_7Hq2LmX9pR4vN8kW3tY6bZ1c"
}
{
  "error": "INVALID_BODY",
  "message": "kind: Invalid option: expected one of \"server\"|\"client\"|\"mobile\""
}
{
  "error": "NOT_FOUND",
  "message": "no such environment"
}
Common errors (401, 403, 400, 409, 422, 413, 500)
{
  "error": "MISSING_TOKEN",
  "message": "an access token is required"
}
{
  "error": "TOKEN_REJECTED",
  "message": "access token rejected"
}
{
  "error": "SESSION_REJECTED",
  "message": "session expired or rejected"
}
{
  "error": "CSRF_HEADER_REQUIRED",
  "message": "x-featurekit-csrf is required for cookie auth"
}
{
  "error": "INSUFFICIENT_ROLE",
  "message": "requires admin or higher"
}
{
  "error": "INVALID_IDEMPOTENCY_KEY",
  "message": "Idempotency-Key must be at most 200 characters of [A-Za-z0-9._:-]"
}
{
  "error": "IDEMPOTENCY_IN_FLIGHT",
  "message": "a request with this Idempotency-Key is still being processed"
}
{
  "error": "IDEMPOTENCY_KEY_REUSED",
  "message": "this Idempotency-Key was already used for a different request body"
}
{
  "error": "INVALID_JSON",
  "message": "request body is not valid JSON"
}
{
  "error": "PAYLOAD_TOO_LARGE",
  "message": "body exceeds 4096 bytes"
}
{
  "error": "INTERNAL_ERROR"
}

Example

curl -X POST http://127.0.0.1:3000/v1/admin/projects/acme/environments/production/keys \
  -H "Authorization: Bearer $FEATUREKIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "server", "name": "api" }'

Revoke a key

DELETE/v1/admin/projects/{project}/environments/{env}/keys/{keyId}

Auth: Personal access token or dashboard session, role admin or higher.

The key stops authenticating on this node at once, and on every node within SDK_KEY_CACHE_TTL_MS (30 seconds by default). Open streams are closed on their next push. Revoked keys stay listed, since the audit log refers to them.

Path parameters

NameTypeDescription
projectstringProject key.
envstringEnvironment key.
keyIdstringFrom the list above.

Responses

{
  "revoked": true
}
{
  "error": "NOT_FOUND",
  "message": "no such key"
}
Common errors (401, 403, 400, 409, 422, 500)
{
  "error": "MISSING_TOKEN",
  "message": "an access token is required"
}
{
  "error": "TOKEN_REJECTED",
  "message": "access token rejected"
}
{
  "error": "SESSION_REJECTED",
  "message": "session expired or rejected"
}
{
  "error": "CSRF_HEADER_REQUIRED",
  "message": "x-featurekit-csrf is required for cookie auth"
}
{
  "error": "INSUFFICIENT_ROLE",
  "message": "requires admin or higher"
}
{
  "error": "INVALID_IDEMPOTENCY_KEY",
  "message": "Idempotency-Key must be at most 200 characters of [A-Za-z0-9._:-]"
}
{
  "error": "IDEMPOTENCY_IN_FLIGHT",
  "message": "a request with this Idempotency-Key is still being processed"
}
{
  "error": "IDEMPOTENCY_KEY_REUSED",
  "message": "this Idempotency-Key was already used for a different request body"
}
{
  "error": "INTERNAL_ERROR"
}

Example

curl -X DELETE http://127.0.0.1:3000/v1/admin/projects/acme/environments/production/keys/a8b9c0d1-e2f3-4a4b-9c5d-6e7f80910213 -H "Authorization: Bearer $FEATUREKIT_TOKEN"