Create Service Key
POST /service-keysThe only response in the API that carries a key. It is stored nowhere.
Request body — ServiceKeyCreate
Section titled “Request body — ServiceKeyCreate”| Field | Type | Notes | |
|---|---|---|---|
name | string | required | min length 1 max length 120 |
role | viewer | member | admin | owner | operator | optional | Default "member". |
scope | workspace | organization | platform | optional | Default "workspace". |
expires_at | string (date-time) | null | optional | — |
request_timeout_s | integer | null | optional | min 1 max 3600 |
Responses
Section titled “Responses”| Status | Description | Body |
|---|---|---|
201 | Successful Response | ServiceKeyWithSecret |
422 | Validation Error | HTTPValidationError |
Example
Section titled “Example”The body shows the fields the schema always carries. Which combination is legal is a service rule the schema cannot express, so read the description above before copying this.
curl -X POST https://your-deployment.example.com/service-keys \ -H "Authorization: Bearer $COBRE_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }'Response — ServiceKeyWithSecret
Section titled “Response — ServiceKeyWithSecret”| Field | Type | Notes | |
|---|---|---|---|
key | string | required | — |
service_key | ServiceKeyView | required | — |