FeatureGate

Create runtime key

Creates a runtime key for a project environment and returns the raw key once. Store the raw key immediately; future reads return metadata only.

POSThttps://api.featuregate.dev/v1/projects/{projectId}/environments/{environmentKey}/runtime-keys
Authenticate with a management automation key in the Authorization header.management:runtime-keys:write

Path parameters

projectIdstringrequired

Stable project_ identifier.

Pattern: ^project_.+

environmentKeystringrequired

Lowercase letters, numbers, and hyphens only.

Length: 1-80Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$

Body parameters

namestringrequired

Display name for operators and audit history.

Length: 1-80

scopes"runtime:evaluate" | "runtime:snapshot"[]required

Runtime capabilities granted to the generated key.

Items: 1+

Request
sh
curl -X POST https://api.featuregate.dev/v1/projects/project_example/environments/production/runtime-keys \
  -H "Authorization: Bearer fg_ak_test_0123456789abcdef0123456789abcdef0123456789abcdef" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Production server",
  "scopes": [
    "runtime:evaluate",
    "runtime:snapshot"
  ]
}'

Returns

runtimeKeyobjectrequired
idstringrequired

Stable API key identifier, prefixed with key_.

Length: 1+

createdAtstringrequired

Key creation timestamp.

updatedAtstringrequired

Last key metadata update timestamp.

namestringrequired

Operator-facing key name.

Length: 1+

keyPrefixstringrequired

Non-secret key fingerprint shown for identification.

Length: 1+

scopes"runtime:evaluate" | "runtime:snapshot"[]required

Runtime scopes granted to this key.

organisationIdstringrequired

Owning organisation identifier.

Length: 1+

projectIdstring | nullrequired

Bound project identifier.

Length: 1+

environmentIdstring | nullrequired

Bound environment identifier.

Length: 1+

createdByUserIdstring | nullrequired

Creating user, when available.

Length: 1+

lastUsedAtstring | nullrequired

Last successful use timestamp, when known.

revokedAtstring | nullrequired

Revocation timestamp, or null while active.

rawKeystringrequired

Length: 1+

Example response · 201
json
{
  "runtimeKey": {
    "id": "key_example",
    "createdAt": "2026-06-18T00:00:00.000Z",
    "updatedAt": "2026-06-18T00:00:00.000Z",
    "name": "Production server",
    "keyPrefix": "fg_sk_test_0123456789abcdef0123",
    "scopes": [
      "runtime:evaluate",
      "runtime:snapshot"
    ],
    "organisationId": "org_example",
    "projectId": "project_example",
    "environmentId": "env_example",
    "createdByUserId": null,
    "lastUsedAt": null,
    "revokedAt": null
  },
  "rawKey": "fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef"
}

Responses

201The created runtime key metadata plus the one-time raw key.
400Validation failed.
401Authentication failed.
403The key is not allowed to access this resource.
429Rate limit exceeded.
500Unexpected server error.