Create

Create a new API Key.

API key names may only contain underscores and alphanumeric characters. WarpStream will assign the provided name to the new key after adding an akn_ prefix.

Create requests must provide a list of access grants to associate with the new key. For simplicity we recommend assigning each key a single access grant.

An access grant is an object with three fields: principal_kind, resource_kind, and resource_id. They are subject to the following restrictions.

  • principal_kind may be application or agent. These correspond to application keys and agent keys respectively.

  • resource_kind may be * or virtual_cluster. For now, * is only supported for grants with principal kind application. virtual_cluster is only supported for grants with principal kind agent.

  • resource_id: may be * or one of your virtual cluster IDs. Agent keys may be granted access to a single virtual cluster via its ID, or to all virtual clusters in your account by setting this field to *.

Request

curl https://api.prod.us-east-1.warpstream.com/api/v1/create_api_key \
-H 'warpstream-api-key: XXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{"name":"example_agent_key", "access_grants": [
    {"principal_kind": "agent", "resource_kind": "virtual_cluster", "resource_id": "vci_1d4930d7_8e6d_4ad9_b27a_654ed4aaa3ee"}
]}'

Response

{
  "id": "aki_007f0341_3ab3_457a_a513_2b2c9415582f",
  "name": "akn_example_agent_key",
  "key": "aks_a51b1fb20ac4a3af549503bb08cd309672fcada1030c5a494850e87ce5d4c613",
  "created_at": "2024-06-14T09:36:06.781306362Z",
  "access_grants": [
    {
      "principal_kind": "agent",
      "resource_kind": "virtual_cluster",
      "resource_id": "vci_1d4930d7_8e6d_4ad9_b27a_654ed4aaa3ee"
    }
  ]
}

Last updated