Skip to main content
POST
Create a key

Authorizations

Authorization
string
header
required

An API key that starts with cs_sk_, created under API and MCP, API keys. A key covers every site of its workspace or a chosen list, and carries permissions per resource (Analytics, Revenue and payments, Goals and events, Funnels, Sites, Notes, Alerts) and extras (Visitor details, Raw events export, Team members, Workspace name, See API keys, Manage API keys). A change acts for the key's creator, with their current role. A request outside them answers 403 naming the missing permission.

Body

application/json
name
string
required
Required string length: 1 - 80
permissions
string[]
required

What the key may do: analytics:read, visitors:details, revenue:read, revenue:write, goals:read, goals:write, funnels:read, funnels:write, sites:read, sites:write, notes:read, notes:write, alerts:read, alerts:write, team:read, team:write, keys:read, keys:write, events:raw. Never more than the key making the request holds.

Required array length: 1 - 19 elements
Maximum string length: 40
siteIds
string[] | null

The sites the key may use, or null (the default) for every site. Never outside the requesting key's own sites.

Required array length: 1 - 500 elements
Maximum string length: 80
expiresAt
string<date-time> | null

When the key stops working. Required, and no later, when the requesting key itself expires.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

Response

Done.

key
object
required

A key as the API shows it: never its hash, and its secret only in the answer that made it.

secret
string
required

The full key. Shown once: store it now.