CentralCSP
APIAPI Keys

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.

Requires the admin role on the workspace and the api_keys plan feature.

POST
/v1/workspaces/{workspaceId}/api-keys

Authorization

AuthorizationBearer <token>

An OpenID Connect access token issued by Keycloak, acting as the signed-in user.

In: header

Path Parameters

workspaceId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name*string

Display name, so you can tell your keys apart later.

Length1 <= length <= 255
expiresAt?string

When the key should stop working. Leave it out for a key that never expires.

Formatdate-time
allowedIps?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.

Itemsitems <= 50

Response Body

application/json

curl -X POST "https://api-next.centralcsp.com/v1/workspaces/string/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"}