/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/rotateAuthRotate the SDK key
Mints a new primary key. The current primary becomes the secondary key and keeps working for `grace_hours` (default 24, at most 168; `0` revokes it at once); a previous secondary key is revoked. SDK servers pick up the change within about 5 seconds. The response is masked: reveal the new key separately.
Path parameters
config_id*string · uuidId of the config.
environment_id*string · uuidId of an environment of the same project.
workspace_id*string · uuidId of the workspace.
Headers
Idempotency-KeystringIdempotency key (1-256 characters, `[A-Za-z0-9._:-]`). A retry with the same key and body returns the first response for 24 h.
Request body
grace_hoursintegerHow long the current key keeps working as the secondary key, in hours (0 to 168). `0` revokes it at once. An existing secondary key is revoked by the rotation.
notestringWhy, recorded in the history.
Response · 200 The masked keys after the rotation.
data*arrayThe primary key, then the secondary key while a grace period runs.
Example
Request
POST https://api.flags.productcraft.co/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/rotate
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"grace_hours": 0,
"note": "string"
}Response
{
"data": [
{
"slot": {},
"key_prefix": "pcf_sdk_4fQx",
"last4": "k9Zt",
"created_at": "2026-01-01T00:00:00.000Z",
"expires_at": "2026-01-01T00:00:00.000Z"
}
]
}