Skip to main content

Administration: shared keys

Shared secrets and shared keys for web services: values, consumers, reminders and reads. Administrators only.

OperationMethod and path
List shared secretsGET /api/v1/admin/secrets
Create or replace a shared secretPUT /api/v1/admin/secrets/{name}
Delete a shared secretDELETE /api/v1/admin/secrets/{name}
Set or clear a shared secret's rotation reminderPUT /api/v1/admin/secrets/{name}/reminder
A shared secret's readsGET /api/v1/admin/secrets/{name}/reads
Set the routes and connectors that may use a shared secretPUT /api/v1/admin/secrets/{name}/consumers
List host keys (administrators)GET /api/v1/admin/host-keys
Add a shared keyPOST /api/v1/admin/host-keys
Change a shared keyPUT /api/v1/admin/host-keys/{id}
Delete a host key (administrators)DELETE /api/v1/admin/host-keys/{id}
When a host key was used (administrators)GET /api/v1/admin/host-keys/{id}/reads

List shared secrets​

GET /api/v1/admin/secrets

Shared secret references with metadata, sorted by reference; never a value. Per-user Git credentials are never listed. Administrators only; a session or a personal token.

Sign-in: A signed-in session or an API token.

Responses

StatusMeaningBody
200The secretsAdminSecrets
401Authentication requiredError
403Not an administratorError
503Database unavailable or gateway restartingError

Create or replace a shared secret​

PUT /api/v1/admin/secrets/{name}

Creates without a version (201) or replaces the version read (200). The next relay request uses the new value. A new key whose name looks like a key itself is refused 400 name_key_shaped (a key pasted into the name; one stored before can still be replaced or deleted). Administrators only; needs a signed-in session. Audited without the value.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
namepathyesstringThe secret name; names starting with git- or connector- are reserved for users' own credentials.
Idempotency-KeyheaderstringA retried write with the same key replays the stored response before the version check.

Request body

application/json: AdminSecretWrite

Responses

StatusMeaningBody
200ReplacedAdminSecret
201CreatedAdminSecret
400Invalid name, value, version or parameter (see details)Error
401Authentication requiredError
403Not an administrator, or a personal token (session_required)Error
409conflict (stale, missing or unexpected version) or secret_limit (the store is full)Error
422The Idempotency-Key was used with another requestError
503Database unavailable or gateway restartingError

Delete a shared secret​

DELETE /api/v1/admin/secrets/{name}

Deletes the version read. A seeded secret returns at a later start only if the seed file's value changes. Administrators only; needs a signed-in session. Audited.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
namepathyesstringThe secret name; names starting with git- or connector- are reserved for users' own credentials.
versionqueryyesinteger 1 or more
Idempotency-KeyheaderstringA retried write with the same key replays the stored response before the version check.

Responses

StatusMeaningBody
204Deleted
400Invalid name, value, version or parameter (see details)Error
401Authentication requiredError
403Not an administrator, or a personal token (session_required)Error
404No such secretError
409conflict (stale or missing version) or secret_in_use (a route's key_ref names it)Error
422The Idempotency-Key was used with another requestError
503Database unavailable or gateway restartingError

Set or clear a shared secret's rotation reminder​

PUT /api/v1/admin/secrets/{name}/reminder

Sets or clears the rotation reminder of the version read; bumps the version and is audited as a replace that changes no value. A due reminder is shown, logged and counted, and never stops the secret from working. Administrators only; needs a signed-in session.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
namepathyesstringThe secret name; names starting with git- or connector- are reserved for users' own credentials.

Request body

application/json: AdminSecretReminder

Responses

StatusMeaningBody
200The reminder was set or clearedAdminSecret
400Invalid name, value, version or parameter (see details)Error
401Authentication requiredError
403Not an administrator, or a personal token (session_required)Error
404No such secretError
409conflict (stale, missing or unexpected version) or secret_limit (the store is full)Error
503Database unavailable or gateway restartingError

A shared secret's reads​

GET /api/v1/admin/secrets/{name}/reads

Which consumers read the secret, for which conversation, user and run, newest first; never its value. Users' own credentials are not shown here. Administrators only.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
namepathyesstringThe secret name; names starting with git- or connector- are reserved for users' own credentials.
limitqueryinteger 1–100
beforequerystring (uuid)The next of the previous page.

Responses

StatusMeaningBody
200Newest firstSecretReadPage
400Invalid name, value, version or parameter (see details)Error
401Authentication requiredError
403Not an administrator, or a personal token (session_required)Error
503Database unavailable or gateway restartingError

Set the routes and connectors that may use a shared secret​

PUT /api/v1/admin/secrets/{name}/consumers

Replaces the secret's consumer bindings at the version read; bumps the version and is audited as a replace that changes no value. A route or connector may read a shared secret only when bound to it. Administrators only; needs a signed-in session.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
namepathyesstringThe secret name; names starting with git- or connector- are reserved for users' own credentials.

Request body

application/json: AdminSecretConsumers

Responses

StatusMeaningBody
200The bindings were setAdminSecret
400Invalid name, value, version or parameter (see details)Error
401Authentication requiredError
403Not an administrator, or a personal token (session_required)Error
404No such secretError
409conflict (stale, missing or unexpected version) or secret_limit (the store is full)Error
503Database unavailable or gateway restartingError

List host keys (administrators)​

GET /api/v1/admin/host-keys

Shared keys with who may use them, and members' own keys as that they exist (owner, address, when last used; never their names). Needs a signed-in session.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Responses

StatusMeaningBody
200Shared and members' keysAdminHostKeys
401Authentication requiredError
403Not an administrator, origin denied, or session_required with a personal tokenError

Add a shared key​

POST /api/v1/admin/host-keys

Refusals as for a member's key, plus 409 name_taken_by_user when one of the people who may use it has an own key of that name (the answer names no one), and 400 unknown_reference for an unknown person. Audited.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
Idempotency-KeyheaderstringA retried write with the same key replays the stored response.

Request body

application/json: AdminHostKeyAdd

Responses

StatusMeaningBody
201AddedHostKey
400Invalid field (see details)Error
401Authentication requiredError
403Not an administrator, origin denied, or session_required with a personal tokenError
409name_taken, name_taken_by_user or host_key_limitError
422Idempotency-Key reused with another requestError

Change a shared key​

PUT /api/v1/admin/host-keys/{id}

The whole shared key at the version read, with who may use it; the value only when replacing it. A member's own key is 409 personal_key: an administrator may delete it, never change it. Audited.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
Idempotency-KeyheaderstringA retried write with the same key replays the stored response.

Request body

application/json: AdminHostKeyPut

Responses

StatusMeaningBody
200ChangedHostKey
400Invalid field (see details)Error
401Authentication requiredError
403Not an administrator, origin denied, or session_required with a personal tokenError
404No such keyError
409conflict, personal_key, name_taken or name_taken_by_userError
422Idempotency-Key reused with another requestError

Delete a host key (administrators)​

DELETE /api/v1/admin/host-keys/{id}

A shared key, or a member's own key, and its value, at the version read. Audited.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
versionqueryyesinteger 1 or more
Idempotency-KeyheaderstringA retried write with the same key replays the stored response.

Responses

StatusMeaningBody
204Deleted
400Invalid versionError
401Authentication requiredError
403Not an administrator, origin denied, or session_required with a personal tokenError
404No such keyError
409conflictError
422Idempotency-Key reused with another requestError

When a host key was used (administrators)​

GET /api/v1/admin/host-keys/{id}/reads

Every use of a key, refusals included, with user_id (ADR-0037 §8). Needs a signed-in session.

Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
limitqueryinteger 1–100
beforequerystring (uuid)

Responses

StatusMeaningBody
200Reads, newest firstSecretReadPage
400Invalid pagingError
401Authentication requiredError
403Not an administratorError
404No such keyError