Set the permissions of an API key
POST/api-keys/:api_key_id/permissions
Adds, changes or removes permission entries of an API key; entries that the request does not name are unchanged. An entry replaces the entry with the same object type and object identifier, and a permission of 0 removes the entry. An entry on an individual object requires that the object exists. Foundation4 applies all entries in one transaction, so a refused entry leaves every entry unchanged. The permissions of the master key cannot be changed.
Permissions. Write on the API key. Each granted permission must be contained in the calling key's permission on the object type or on the object. When the calling key's allow-list on pipelines is not *, the granted classifications must be in the calling key's allow-list for the pipeline.
Scoped keys describes the request with an example.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 422
The permission entries were applied. The response has no body.
An entry names an object type that no operation checks, contexts, context-messages, documents, permissions or fragments (Invalid parameter, with Permissions cannot be granted on object type <type> in details.error), or an object that does not exist (Invalid parameter, with Cannot grant permissions on <type> <id>: the object does not exist in details.error). The same status reports a body that is not valid JSON.
The authentication headers are missing or invalid, or the API key is inactive or expired. Errors lists the messages.
The request grants a permission or classification that the calling key does not hold, removes a permission that the calling key does not hold, or names the master key. The message names the permission and the object type, such as Unauthorized: read and write access to Pipeline required, and details.error gives the reason, such as Your key cannot grant read and write access on pipelines, which it does not hold itself. The same status reports a license that does not permit changes (Invalid license: ...).
No API key with this identifier exists, or the calling key lacks write permission on the API key (API Key not found, with the identifier in details.id).
The body does not match the request schema, for example a permission value outside 0 to 7, an unknown object type or an unknown field.