Rotate a token
client.moq.relays.tokens.rotate(stringrelayId, TokenRotateParams { account_id, type } params, RequestOptionsoptions?): TokenRotateResponse { token, type }
POST/accounts/{account_id}/moq/relays/{relay_id}/tokens/rotate
Generates a new token for the specified type. The old token is immediately invalidated. Token value is shown once in the response.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Rotate a token
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
const response = await client.moq.relays.tokens.rotate('a1b2c3d4e5f67890a1b2c3d4e5f67890', {
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
type: 'publish_subscribe',
});
console.log(response.token);{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"token": "eyJhbGciOiJFZDI1NTE5...",
"type": "publish_subscribe"
}
}Returns Examples
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"token": "eyJhbGciOiJFZDI1NTE5...",
"type": "publish_subscribe"
}
}