# Upsert a BYOK provider key (/docs/reference/management/upsertByokKey)

> For AI agents, the [documentation index](https://bitrouter-docs-staging.up.railway.app/llms.txt) lists all pages. Append .md to a documentation URL to read its Markdown.

`POST /v1/byok/keys`

Stores a sealed-box ciphertext for one provider. Refuses any payload sealed against a `kek_id` other than the cloud's current encryption pubkey (`/v1/byok/encryption-pubkey`).

*Requires the `byok:write` scope.*

## Authentication

header parameter `x-api-key` or `Authorization: Bearer <token>`.

Base URL: `https://api.bitrouter.ai`

## Request body

Request body. See the endpoint description for shape.

Media types: `application/json`.

## Responses

* `200` Successful response. (application/json)
* `401` Credential missing or did not verify. (application/json)
* `403` Credential is valid but lacks the required scope. (application/json)
* `404` Resource not found (or owned by a different account). (application/json)

[Full OpenAPI schema](https://bitrouter-docs-staging.up.railway.app/openapi.json)