---
title: "Set Provider Key"
method: PUT
path: "/api/me/provider-keys/{provider}"
tags: ["me"]
---

# Set Provider Key

`PUT /api/me/provider-keys/{provider}`

## Request

- Base URL: `https://app.thinqos.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.thinqos.com/api/me/provider-keys/{provider}`
- Auth: none declared

Set or update a provider API key for this identity.

Upserts: if a row exists, updates the key and re-activates.
Key is encrypted with Fernet before storage when FERNET_KEY is configured.

TOS-6394: an admin/owner has no way to tell, from this endpoint alone,
whether a key they mean for the whole install actually needs the admin
platform-key surface instead. A real incident on the Heartwood Guild
install (2026-09-17) left a platform-intended ElevenLabs key sitting here,
under one person's identity, for a month with nothing surfacing the
mismatch. The response now carries a one-line hint when the saving
identity is an admin/owner and the platform has no active key for this
provider yet - advisory only, never blocks or redirects the save, because
a personal key for a provider the platform also happens to lack is a
completely ordinary case.

## Path parameters

- `provider` string, required

## Headers

- `x-impersonate-identity-id` string, nullable

## Request body

- SetProviderKeyRequest
  - `api_key` string, required
  - `provider_scope` string, nullable

## Response `200`

Successful Response

- SetProviderKeyResponse
  - `ok` boolean
  - `provider` string, required
  - `valid` boolean, nullable
  - `validation_error` string, nullable
  - `provider_scope` string, nullable
  - `scope_outcome` string, nullable
  - `scope_candidates` string[]
  - `scope_detail` string, nullable
  - `batch_eligible` boolean
  - `platform_key_hint` string, nullable

## Other responses

- `422`: Validation Error

---

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