Skip to main content
POST
/
v1
/
api_keys
Create
curl --request POST \
  --url https://api.incident.io/v1/api_keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My test API key",
  "role_names": [
    "viewer",
    "incident_creator"
  ],
  "team_ids": [
    "01FCNDV6P870EA6S7TK1DSYDG0"
  ],
  "team_role_names": [
    "schedules_editor"
  ]
}
'
{
  "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)

Body

application/json
name
string
required

Human-readable name for the new API key

Required string length: 1 - 200
Example:

"My test API key"

role_names
enum<string>[]
required

Account-level roles to assign to the API key. These roles apply across the entire account, not scoped to specific teams. Pass an empty array if no account-level roles are needed.

Available options:
viewer,
incident_creator,
incident_editor,
manage_settings,
global_access,
catalog_viewer,
catalog_editor,
incident_memberships_editor,
schedules_editor,
schedules_reader,
schedule_overrides_editor,
workflows_editor,
private_workflows_editor,
on_call_editor,
escalation_creator,
post_incident_flow_opt_out,
security_settings_editor,
investigation_download,
team_memberships_manage,
status_page_publisher,
postmortems_manage,
api_keys_manage
Example:
["viewer", "incident_creator"]
team_ids
string[]
required

IDs of teams to scope the team_role_names to. If provided, team_role_names must also be a non-empty array, and vice versa. Pass an empty array if the key should not be scoped to any teams.

Example:
["01FCNDV6P870EA6S7TK1DSYDG0"]
team_role_names
enum<string>[]
required

Roles to grant for the teams specified in team_ids. If provided, team_ids must also be a non-empty array, and vice versa. Pass an empty array if no team-level roles are needed.

Available options:
schedules_editor,
schedules_reader,
schedule_overrides_editor,
on_call_editor,
escalation_creator,
api_keys_manage
Example:
["schedules_editor"]

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 bearer token to use in API requests. This is the only time the token is returned — store it securely.

Example:

"inc_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"