Create a new API key and return it. The token field is shown only once and cannot be retrieved again — the caller must store it securely.
Security
api_key
The API key to create.
Target organisation for the key. Only honoured for callers with the :all scope; org-scoped callers always create within their own organisation. Required when an :all caller has no active organisation (e.g. support users).
The role whose permissions the key is granted. The caller may only assign a role they are permitted to grant; assigning admin requires admin-level privileges.
Enum:"admin""manager""member""analyst"
- Mock serverhttps://coreapi.hoxton.ai/_mock/v1/api-keys
- https://nexus.hoxton.ai/api/v1https://nexus.hoxton.ai/api/v1/api-keys
curl -i -X POST \
https://coreapi.hoxton.ai/_mock/v1/api-keys \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"expiresAt": "2019-08-24T14:15:22Z",
"name": "string",
"organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
"role": "admin",
"siteIds": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}'Created.
The full API key, sent as a bearer token in the Authorization header. Returned once at creation and never again.
Response
{ "apiKey": "string", "apiKeyId": "37ba0474-c0bb-4910-bfb5-d6cebb614366", "createdAt": "2019-08-24T14:15:22Z", "expiresAt": "2019-08-24T14:15:22Z", "name": "string", "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98", "prefix": "string", "role": "string", "siteIds": [ "497f6eca-6276-4993-bfeb-53cbbbba6f08" ] }