Skip to main content
POST
/
v1
/
api_keys
/
{id}
/
actions
/
rotate
Rotate
curl --request POST \
  --url https://api.incident.io/v1/api_keys/{id}/actions/rotate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "grace_period_minutes": 30
}
'
{
  "api_key": {
    "created_at": "2021-08-17T13:28:57.801578Z",
    "creator": {
      "api_key": {
        "id": "01FCNDV6P870EA6S7TK1DSYDG0",
        "name": "My test API key"
      },
      "user": {
        "email": "lisa@incident.io",
        "id": "01FCNDV6P870EA6S7TK1DSYDG0",
        "name": "Lisa Karlin Curtis",
        "role": "viewer",
        "slack_user_id": "U02AYNF2XJM"
      }
    },
    "id": "01FCNDV6P870EA6S7TK1DSYDG0",
    "name": "My test API key",
    "roles": [
      {
        "description": "Can create incidents",
        "name": "viewer"
      }
    ],
    "team_ids": [
      "01FCNDV6P870EA6S7TK1DSYDG0"
    ],
    "team_roles": [
      {
        "description": "Can read schedules",
        "name": "schedules_editor"
      }
    ],
    "token_last_issued_at": "2021-08-17T13:28:57.801578Z"
  },
  "token": "inc_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}

Authorizations

Authorization
string
header
required

API key from your incident.io dashboard (Settings → API keys)

Path Parameters

id
string
required

Unique identifier of the API key to rotate

Example:

"01FCNDV6P870EA6S7TK1DSYDG0"

Body

application/json
grace_period_minutes
integer<int64>
default:30
required

How many minutes to keep the old access token alive.

Required range: 0 <= x <= 60
Example:

30

Response

201 - application/json

Created response.

api_key
object
required
Example:
{
  "created_at": "2021-08-17T13:28:57.801578Z",
  "creator": {
    "api_key": {
      "id": "01FCNDV6P870EA6S7TK1DSYDG0",
      "name": "My test API key"
    },
    "user": {
      "email": "lisa@incident.io",
      "id": "01FCNDV6P870EA6S7TK1DSYDG0",
      "name": "Lisa Karlin Curtis",
      "role": "viewer",
      "slack_user_id": "U02AYNF2XJM"
    }
  },
  "id": "01FCNDV6P870EA6S7TK1DSYDG0",
  "name": "My test API key",
  "roles": [
    {
      "description": "Can create incidents",
      "name": "viewer"
    }
  ],
  "team_ids": ["01FCNDV6P870EA6S7TK1DSYDG0"],
  "team_roles": [
    {
      "description": "Can read schedules",
      "name": "schedules_editor"
    }
  ],
  "token_last_issued_at": "2021-08-17T13:28:57.801578Z"
}
token
string
required

The new bearer token to use in API requests. This is the only time the token is returned — store it securely.

Example:

"inc_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"