Management

Rolls (rotates) the public API key associated with the specified project, generating a new key value while deprecating the previous one. The new key becomes immediately active. This endpoint requires the write:all scope.

If the public key is not currently enabled for the project, a 403 error response is returned. If the project cannot be found, a 404 error response is returned. An optional expirationIn parameter can be provided in the request body to set when the previous key should expire.

post/management/projects/{projectId}/api-keys/public/roll

Request

  • Base URL: https://api.liveblocks.io/v2
  • URL: https://api.liveblocks.io/v2/management/projects/{projectId}/api-keys/public/roll
  • Auth: none declared

Path parameters

projectIdstring required

ID of the project

Example:683d49ed6b4d1cec5a597b13

Request body

expirationIn'now' | '1h' | '1hour' | '1 hour' | '24hrs' | '24hours' | '24 hours' | '3d' | '3days' | '3 days' | '7d' | '7days' | '7 days'

Example request

{
  "expirationIn": "1 hour"
}

Response

Success. Returns the rolled public key.

Example response

{
  "publicKey": {
    "activated": true,
    "createdAt": "2024-09-03T12:34:56.000Z",
    "value": "pk_dev_123"
  }
}

Changes