Skip to content

CMK API ​

Everything you can do in the CMK UI, you can also do through the CMK REST API, for example to automate the setup of key configurations or to connect systems from a deployment pipeline. This page explains how to call the API, and the conventions it uses.

Base URL ​

https://<API host>/cmk/v1/<tenant ID>

Your cloud service provider gives you the API host and your tenant ID. All paths on this page are relative to this base URL. The API is described in OpenAPI format in the CMK repository: apis/cmk/cmk-ui.yaml.

Authentication ​

Every request passes the API gateway, which checks who you are before CMK sees the request. The gateway accepts three kinds of callers:

CallerHow it authenticatesTypical use
BrowserSession cookie from the sign-in, plus the X-CSRF-Token headerThe CMK UI
Technical user or automationAuthorization: Bearer <access token> from an identity provider that your provider has configuredScripts, pipelines
Technical systemClient certificate (mutual TLS) with a subject that your provider has registeredServices of the cloud service

The token or certificate must carry the groups that give the caller a role in your tenant, exactly as for people; see Sign-in, groups and roles. Ask your provider which identity provider, audience and group claim to use for technical users.

bash
curl -H "Authorization: Bearer $TOKEN" \
  https://api.example.com/cmk/v1/acme/keyConfigurations

Conventions ​

TopicConvention
FormatsJSON. PATCH requests use Content-Type: application/merge-patch+json
Paging$top (default 20) and $skip (default 0). Add $count=true to get the total number of items
Filtering$filter with eq and and on the fields that each list documents, and $search for free text where supported
KeysGET /keys requires the query parameter keyConfigurationID
IdentifiersObjects are identified by UUIDs, for example keyConfigurationID

Example: the first 50 systems in region eu10, with the total count:

bash
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.example.com/cmk/v1/acme/systems?\$filter=region%20eq%20'eu10'&\$top=50&\$count=true"

Errors ​

Errors have the same structure everywhere:

json
{
  "error": {
    "code": "KEY_LIMIT_EXCEEDED",
    "message": "…",
    "status": 409,
    "requestID": "…"
  }
}

Quote the requestID when you contact your provider about an error.

CodeStatusMeaning
FORBIDDEN403Your role does not allow this action, or the object belongs to a key configuration of another group
ZERO_ROLES_NOT_ALLOWED403The caller's groups do not match any CMK group
MULTIPLE_ROLES_NOT_ALLOWED403The caller's groups map to more than one role
ACTION_REQUIRE_WORKFLOW400The change needs approval; create an approval request instead
UNIQUE_ERROR409An object with this name already exists
KEY_CONFIG_LIMIT_EXCEEDED, KEY_LIMIT_EXCEEDED, SYSTEM_LIMIT_EXCEEDED409A tenant limit is reached
BYOK_NOT_ALLOWED, HYOK_NOT_ALLOWED4xxThe key type or provider is not enabled for your tenant

A 401 or 403 with a short message from the gateway means the gateway did not accept your credentials; check the token or certificate.

Common tasks ​

TaskRequestGuide
Create a key configurationPOST /keyConfigurationsKey configurations
Create a BYOK keyPOST /keysKeys
Get the BYOK wrapping keyGET /keys/{keyID}/importParamsKeys
Import BYOK key materialPOST /keys/{keyID}/importKeyMaterialKeys
Enable or disable a BYOK keyPATCH /keys/{keyID} with {"enabled": false}Keys
Set the primary keyPATCH /keyConfigurations/{keyConfigurationID} with {"primaryKeyID": "…"}Key configurations
Connect a systemPATCH /systems/{systemID}/linkSystems
Disconnect a systemDELETE /systems/{systemID}/linkSystems
Retry or cancel a failed changePOST /systems/{systemID}/recoveryActions with {"action": "RETRY"}Systems
Request an approvalPOST /workflowsApprovals
Manage groupsGET, POST /groups, PATCH, DELETE /groups/{groupID}Groups
Your own identity and roleGET /userInfo

See also ​

EU and German government funding logos

Funded by the European Union – NextGenerationEU.

The views and opinions expressed are solely those of the author(s) and do not necessarily reflect the views of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.