Create Workspace Key

Changed on

Create a new workspace key/secret pair for this workspace.

post/v1/{workspace}/ws_key/

Request

  • Base URL: https://management-api.suprsend.com
  • URL: https://management-api.suprsend.com/v1/{workspace}/ws_key/
  • Auth: API key in header ServiceToken <token>

Path parameters

workspacestring required

Workspace slug (e.g. staging, production).

Request body

namestring required

Label for the workspace key. Must be unique across the workspace's existing ws_key records.

Example request

{
  "name": "ops-cli"
}

Response

Workspace key created. The full key and secret are returned in plain text.

idstring

Unique identifier of the workspace key. Format is ws_key_ followed by a 26-character ULID.

namestring

Label for the workspace key. Unique across the workspace's ws_key records.

keystring

Full workspace key value. This is the workspace_key passed to backend SDKs when authenticating (Suprsend(workspace_key, workspace_secret)). Returned in plain text on every response.

Rotation does not change key - only secret is regenerated.

secretstring

Full workspace secret. This is the workspace_secret passed to backend SDKs when authenticating (Suprsend(workspace_key, workspace_secret)). Returned in plain text on every response, not masked and not "returned once".

Anyone with read access to this response can authenticate as this workspace. Handle every list, detail, create and rotate response as sensitive data.

is_defaultboolean

Whether this is the workspace's default key/secret pair. The default record cannot be deleted; it can be rotated.

is_activeboolean

Whether this workspace key can authenticate requests.

is_deletedboolean

Whether this workspace key has been deleted.

allowed_domainsstring[]

Array of domain strings associated with the workspace key.

created_atstring date-time

Timestamp when the workspace key was created.

rotated_atstring date-time nullable

Timestamp when the workspace secret was last rotated.

deleted_atstring date-time nullable

Timestamp when the workspace key was deleted, if applicable.

Example response

{
  "id": "ws_key_01ABCDEFGHJKMNPQRSTVWXYZ0",
  "name": "ops-cli",
  "key": "SS.WSK.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "secret": "SS.WSS.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "created_by": {
    "name": "System User",
    "email": "user@example.com"
  },
  "rotated_by": {
    "name": "System User",
    "email": "user@example.com"
  },
  "deleted_by": {
    "name": "System User",
    "email": "user@example.com"
  }
}

Changes