Skip to main content
POST
Creates an API key. The full key is returned only in this response. Owners, Admins and Developers can create keys. Viewers can’t.

Request body

string
required
A name for the key, 3 to 100 characters. Use something that says what the key is for, such as CI deploy key.
string[]
required
At least one scope:
  • clusters:read: view services, including their backups, poolers and database users
  • clusters:write: create and change services, backups, poolers and database users. Includes read.
  • clusters:delete: delete services and backups. Includes read and write.
  • organizations:read: view organization details
  • billing:read: view billing details and spending caps
  • billing:write: manage spending caps. Includes read.
  • *: everything your role allows
integer
Days until the key expires. Leave it out for a key that never expires.
string
The organization the key belongs to. Defaults to your current organization.

Response

201 Created
string
The key’s ID.
string
The key’s name.
string
The full key, starting with mpg_. Store it now, because it is never shown again.
string
The 8 characters after mpg_, used to identify the key.
string[]
The scopes granted to the key.
string | null
When the key expires, or null if it never does.
string
When the key was created.
string
A reminder that the key is shown only once.