# Trust a signing key

POST

/v1/signing-keys

```sh
curl --request POST \
  --url https://example.com/v1/signing-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "keyId": "example", "algorithm": "ed25519", "publicKey": "example", "label": "example" }'
```

Adds a public key to the tenant’s trust list: deployments it signs verify. Needs the `signing-keys:write` capability. Trusting the same key again answers `200`; a known `keyId` with a different public key is `409 signing-key-conflict` (rotate under a new id). Mounted when the deployment supplies a signing-key registry.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/v0.1.9/reference/api.md#bearerauth)**

## Parameters

### Header Parameters

**Idempotency-Key**

string

\>= 1 characters

Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the tenant is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per `docs/API-ROUTE-CONVENTIONS.md` §3.1). A retry sent while the first request still runs is answered `409 idempotency-key-in-flight` with `Retry-After`, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets `409 idempotency-key-replay-withheld`, with the first request’s status and when it succeeded (from 0.1.5).

## Request Bodyrequired

application/json

object

**keyId**

required

The id deployment envelopes name as `signerKeyId`. Bound to `publicKey` for good: rotate by trusting a new id.

string

/^\[A-Za-z0-9]\[A-Za-z0-9.\_:-]{0,127}$/

**algorithm**

string

default: ed25519

Allowed values: ed25519

**publicKey**

required

Base64 of the 32 raw bytes of the Ed25519 public key.

string

**label**

string

<= 200 characters

## Responses

### 200

Already trusted.

application/json

A public key the tenant trusts to sign deployments (`POST /v1/deployments`). A revoked key stays readable, with `revokedAt`, so the deployments it signed can be audited; it verifies no new ones.

object

**keyId**

required

The signer key id a deployment envelope names.

string

**tenantId**

required

string format: uuid

**algorithm**

required

string

Allowed values: ed25519

**publicKey**

required

Base64 of the raw public-key bytes (32 for Ed25519).

string

**label**

string

**createdAt**

required

string format: date-time

**revokedAt**

string format: date-time

**revokedReason**

string

##### Example

```json
{
  "algorithm": "ed25519"
}
```

### 201

Trusted.

application/json

A public key the tenant trusts to sign deployments (`POST /v1/deployments`). A revoked key stays readable, with `revokedAt`, so the deployments it signed can be audited; it verifies no new ones.

object

**keyId**

required

The signer key id a deployment envelope names.

string

**tenantId**

required

string format: uuid

**algorithm**

required

string

Allowed values: ed25519

**publicKey**

required

Base64 of the raw public-key bytes (32 for Ed25519).

string

**label**

string

**createdAt**

required

string format: date-time

**revokedAt**

string format: date-time

**revokedReason**

string

##### Example

```json
{
  "algorithm": "ed25519"
}
```

### 400

Malformed request body.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 409

`keyId` is already trusted with a different public key (`signing-key-conflict`), or was revoked (`signing-key-revoked`: revocation is final).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 413

The request body is over the API’s limit (`request-too-large`; `details.maxBytes` says how much).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 500

Server error (unmapped domain code or framework crash).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

## See also

- [`GET /v1/signing-keys`: List trusted signing keys](https://docs.kindgi.com/v0.1.9/reference/api/operations/signingkeyslist.md)
- [Error code `request-too-large`](https://docs.kindgi.com/v0.1.9/reference/errors.md#request-too-large)
- [Error code `signing-key-conflict`](https://docs.kindgi.com/v0.1.9/reference/errors.md#signing-key-conflict)
- [Error code `signing-key-revoked`](https://docs.kindgi.com/v0.1.9/reference/errors.md#signing-key-revoked)
- [Every error code](https://docs.kindgi.com/v0.1.9/reference/errors.md)
