---
title: "Set the dojo provider API key for a provider (admin-only)."
method: PUT
path: "/dojo/provider-keys"
tags: ["Dojo"]
---

# Set the dojo provider API key for a provider (admin-only).

`PUT /dojo/provider-keys`

## Request

- Base URL: `https://api.mnemom.ai/v1`
- URL: `https://api.mnemom.ai/v1/dojo/provider-keys`
- Auth: HTTP bearer

Upserts ONE dojo provider key for a provider (anthropic/openai/google) on the `dojo-system` account. Under the BYOK identity model the agent's gateway identity is `SHA256(providerKey | name)`, so the demo hands the born agent a real provider key and the runner spars AS that same agent with the SAME key. The cleartext is AES-256-GCM-encrypted at rest and resolved server-side ONLY (`resolveDojoProviderKey`); it is NEVER returned. Admin-only — backs `/admin/dojo`. MNE-517 (BYOK pivot).

## Request body

- object
  - `provider` 'anthropic' | 'openai' | 'google', required
  - `key` string, required: The provider API key (cleartext) — encrypted at rest, never echoed.
  - `key_ref` string: Optional human label.

## Response `200`

Provider key stored. Returns non-secret metadata only.

- object
  - `provider` 'anthropic' | 'openai' | 'google', required
  - `key_prefix` string, required: Non-secret leading characters, for display.
  - `key_ref` string, nullable
  - `updated_at` string, date-time, required

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `429`: Rate-limit exceeded. The global per-IP limiter (100 requests/minute, applied to every `/v1/*` route) rejected this request. Back off until the window resets — `Retry-After` carries the cooldown in seconds and `X-RateLimit-Reset` the absolute reset time.
- `500`: Server error — request was well-formed but the server failed to fulfill it. Typically a downstream dependency (DB / RPC / external API) returned an unexpected error.

---

[API](https://skmtc.dev/mnemom/apis/mnemom-api.md) · [All operations](https://skmtc.dev/mnemom/apis/mnemom-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mnemom/apis/mnemom-api/revisions/274b7a6ea182?raw)
