Create an API key
Creates a key for this workspace. The secret is in the key field of this response and is never shown again, so store it now. The key acts as you and can only reach this workspace. Give it an expiry when it is for a short-lived job, and an allowedIps list to pin it to known source addresses. Both are set at creation only, so revoke and reissue to change them.
Limited to 20 requests a minute for each workspace, after which it answers 429 with a Retry-After header.
Requires the admin role on the workspace and the api_keys plan feature.
AuthorizationBearer <JWT>An OpenID Connect access token from signing in to CentralCSP, acting as the signed-in user.
workspaceId*stringThe workspace's id.
application/json- body
name*stringDisplay name, so you can tell your keys apart later.
1 <= length <= 255expiresAt?stringWhen the key should stop working. Leave it out for a key that never expires.
date-timeallowedIps?array<>IP addresses and CIDR ranges the key may be used from, IPv4 or IPv6, like 203.0.113.10 or 203.0.113.0/24. Requests from any other address are rejected. Leave it out for a key that works from anywhere. Set at creation only.
items <= 50A new API key, including its secret.
application/json- response
id*stringUnique identifier of the key.
workspaceId*stringThe only workspace this key can reach.
name*stringDisplay name.
prefix*stringFirst characters of the key, enough to tell keys apart in a list.
createdBy*stringThe user this key acts as when it makes requests.
createdByUser*|Profile of the user who created the key.
allowedIps*array<string>|IP addresses and CIDR ranges the key may be used from, or null when it works from anywhere.
expiresAt*|When the key stops working, or null when it never does.
lastUsedAt*|When the key was last used, or null if never. Can lag by up to a minute.
createdAt*stringWhen the key was created.
date-timeupdatedAt*stringWhen the key was last changed.
date-timekey*stringThe secret to send as a bearer token. This is the only time it is returned, so store it now.
curl -X POST 'https://api.centralcsp.com/v1/workspaces/01936b7a-6f2e-7c31-9a4d-2f8e1c5b7d90/api-keys' \ -H 'Content-Type: application/json' \ -d '{ "name": "CI pipeline"}'{ "id": "string", "workspaceId": "string", "name": "CI pipeline", "prefix": "ccsp_a1", "createdBy": "string", "createdByUser": { "id": "string", "email": "string", "firstName": "string", "lastName": "string", "picture": "string" }, "allowedIps": [ "string" ], "expiresAt": "2019-08-24T14:15:22Z", "lastUsedAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "key": "ccsp_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v"}