Administration: shared keys
Shared secrets and shared keys for web services: values, consumers, reminders and reads. Administrators only.
| Operation | Method and path |
|---|---|
| List shared secrets | GET /api/v1/admin/secrets |
| Create or replace a shared secret | PUT /api/v1/admin/secrets/{name} |
| Delete a shared secret | DELETE /api/v1/admin/secrets/{name} |
| Set or clear a shared secret's rotation reminder | PUT /api/v1/admin/secrets/{name}/reminder |
| A shared secret's reads | GET /api/v1/admin/secrets/{name}/reads |
| Set the routes and connectors that may use a shared secret | PUT /api/v1/admin/secrets/{name}/consumers |
| List host keys (administrators) | GET /api/v1/admin/host-keys |
| Add a shared key | POST /api/v1/admin/host-keys |
| Change a shared key | PUT /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
| Status | Meaning | Body |
|---|---|---|
| 200 | The secrets | AdminSecrets |
| 401 | Authentication required | Error |
| 403 | Not an administrator | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
name | path | yes | string | The secret name; names starting with git- or connector- are reserved for users' own credentials. |
Idempotency-Key | header | string | A retried write with the same key replays the stored response before the version check. |
Request body
application/json: AdminSecretWrite
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Replaced | AdminSecret |
| 201 | Created | AdminSecret |
| 400 | Invalid name, value, version or parameter (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, or a personal token (session_required) | Error |
| 409 | conflict (stale, missing or unexpected version) or secret_limit (the store is full) | Error |
| 422 | The Idempotency-Key was used with another request | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
name | path | yes | string | The secret name; names starting with git- or connector- are reserved for users' own credentials. |
version | query | yes | integer 1 or more | |
Idempotency-Key | header | string | A retried write with the same key replays the stored response before the version check. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | Deleted | |
| 400 | Invalid name, value, version or parameter (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, or a personal token (session_required) | Error |
| 404 | No such secret | Error |
| 409 | conflict (stale or missing version) or secret_in_use (a route's key_ref names it) | Error |
| 422 | The Idempotency-Key was used with another request | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
name | path | yes | string | The secret name; names starting with git- or connector- are reserved for users' own credentials. |
Request body
application/json: AdminSecretReminder
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The reminder was set or cleared | AdminSecret |
| 400 | Invalid name, value, version or parameter (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, or a personal token (session_required) | Error |
| 404 | No such secret | Error |
| 409 | conflict (stale, missing or unexpected version) or secret_limit (the store is full) | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
name | path | yes | string | The secret name; names starting with git- or connector- are reserved for users' own credentials. |
limit | query | integer 1–100 | ||
before | query | string (uuid) | The next of the previous page. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Newest first | SecretReadPage |
| 400 | Invalid name, value, version or parameter (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, or a personal token (session_required) | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
name | path | yes | string | The secret name; names starting with git- or connector- are reserved for users' own credentials. |
Request body
application/json: AdminSecretConsumers
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The bindings were set | AdminSecret |
| 400 | Invalid name, value, version or parameter (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, or a personal token (session_required) | Error |
| 404 | No such secret | Error |
| 409 | conflict (stale, missing or unexpected version) or secret_limit (the store is full) | Error |
| 503 | Database unavailable or gateway restarting | Error |
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
| Status | Meaning | Body |
|---|---|---|
| 200 | Shared and members' keys | AdminHostKeys |
| 401 | Authentication required | Error |
| 403 | Not an administrator, origin denied, or session_required with a personal token | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | A retried write with the same key replays the stored response. |
Request body
application/json: AdminHostKeyAdd
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Added | HostKey |
| 400 | Invalid field (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, origin denied, or session_required with a personal token | Error |
| 409 | name_taken, name_taken_by_user or host_key_limit | Error |
| 422 | Idempotency-Key reused with another request | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | |
Idempotency-Key | header | string | A retried write with the same key replays the stored response. |
Request body
application/json: AdminHostKeyPut
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Changed | HostKey |
| 400 | Invalid field (see details) | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, origin denied, or session_required with a personal token | Error |
| 404 | No such key | Error |
| 409 | conflict, personal_key, name_taken or name_taken_by_user | Error |
| 422 | Idempotency-Key reused with another request | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | |
version | query | yes | integer 1 or more | |
Idempotency-Key | header | string | A retried write with the same key replays the stored response. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | Deleted | |
| 400 | Invalid version | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator, origin denied, or session_required with a personal token | Error |
| 404 | No such key | Error |
| 409 | conflict | Error |
| 422 | Idempotency-Key reused with another request | Error |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | |
limit | query | integer 1–100 | ||
before | query | string (uuid) |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Reads, newest first | SecretReadPage |
| 400 | Invalid paging | Error |
| 401 | Authentication required | Error |
| 403 | Not an administrator | Error |
| 404 | No such key | Error |