## Set the tenant's recovery public key (tenant:dms:admin)

`PUT /api/dms/v1/recovery-key`

Module: DMS · operationId: `setRecoveryKey` · Tag: Encryption · Auth: access token (`Authorization: Bearer <accessToken>`)

Stores the public half of the tenant's offline recovery key; encrypted uploads must always include a wrap for it.

### Request body

`application/json` (required)

- `publicKey` (string, required): Base64 SPKI P-256 public key
- `algorithm` (string): Key agreement algorithm (default ECDH-P256) (default `"ECDH-P256"`)

Example:

```json
{
  "algorithm": "ECDH-P256",
  "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEexampleRecoveryPublicKeyP256xyz"
}
```

### Responses

- **200** Recovery key (`application/json`)
- **400** Error (`application/json`)

Fields of the 200 answer:

- `algorithm` (string): Key agreement algorithm
- `createdAt` (string (date-time)): Time the key was set
- `createdBy` (string): Who set the key
- `fingerprint` (string): SHA-256 (hex) of the public key
- `id` (string (uuid)): Recovery key id
- `publicKey` (string): Base64 SPKI public key

Example 200 answer:

```json
{
  "algorithm": "ECDH-P256",
  "createdAt": "2026-03-10T14:00:00Z",
  "createdBy": "thomas.pfeiffer@muster-it.example",
  "fingerprint": "2d8f4b0e6a1c7f3d9b5e2a8c4f0d6b1e7a3c9f5d2b8e4a0c6f1d7b3e9a5c2f8d",
  "id": "7f9b1d3f-5a7c-4e9b-8d1f-9b1d3f5a7c9e",
  "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEexampleRecoveryPublicKeyP256xyz"
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/dms/v1/recovery-key' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"algorithm":"ECDH-P256","publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEexampleRecoveryPublicKeyP256xyz"}'
```
