Create a CMS API key
- Sandbox: available
- Staging: available
- Production: unknown
Creates an API key for public CMS delivery (/v1/public/cms/...) of your current project's tenant. The answer carries the key itself, once: it is stored only as a hash and cannot be shown again.
Auth: bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. Scope: the caller's project (from the token).
Behaviour
nameis 1 to 64 characters, trimmed.- The key starts with
ovok_cms_. Send it asx-api-key,Authorization: Beareror?apiKey=, with the tenant it belongs to (x-ovok-tenant-code,?tenant=,x-ovok-medplum-project-idor?projectId=). Naming another project's tenant answers 401. - A project holds at most 20 keys, the default key included: one more returns 409
CMS_API_KEY_LIMIT. - A 409 without a code means the project changed while the server wrote. Retry.
- The answer is 201.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/cms/api-keys' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": "Marketing site" }'bearerAuthorizationBearer <JWT>application/json- body
name*string1 <= length <= 64The new key, with the key itself. It is shown this once.
application/json- response
id*stringThe key id; default for the deployment key every project starts with.
name*stringprefix*stringThe first 12 characters of the key (4 for the default key), to tell keys apart. Never the key.
createdAt*stringISO time the key was created; null for the default key.
isDefault*booleanWhether this is the deployment key every project starts with.
key*stringThe key itself. Shown in this answer only, never again.
curl -X POST 'https://api.sandbox.ovok.com/v1/cms/api-keys' \ -H 'Content-Type: application/json' \ -d '{ "name": "string"}'{ "id": "string", "name": "string", "prefix": "string", "createdAt": "string", "isDefault": true, "key": "string"}List the project's CMS API keys GET
Lists the API keys of your current project's CMS content. A key unlocks public CMS delivery (`/v1/public/cms/...`) of this project's tenant only. The keys themselves are never returned. **Auth:** bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `keys` is newest first. Each has `id`, `name`, `prefix` (the key's first 12 characters, to tell keys apart), `createdAt` and `isDefault`. - Every project starts with one key, `isDefault: true` with `id` `default` and `createdAt: null`: the key public delivery took before keys were per project. It works until you revoke it. Its `prefix` is only its first 4 characters: the same key serves every project that has not revoked it. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/cms/api-keys' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Revoke a CMS API key DELETE
Revokes one of your current project's CMS API keys. Public delivery stops taking it at once. **Auth:** bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `id` is a key's `id` from `GET /v1/cms/api-keys`; `default` revokes the default key. - A key the project does not hold returns 404 `CMS_API_KEY_NOT_FOUND`. - A 409 means the project changed while the server wrote. Retry. - Public responses a CDN already cached may still be served for up to a minute. - The answer is 204. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/cms/api-keys/default' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```