---
title: "Save a BYOK LLM API key"
method: POST
path: "/account/llm-keys"
tags: ["byok"]
---

# Save a BYOK LLM API key

`POST /account/llm-keys`

## Request

- Base URL: `https://api.whoisgeni.us` (the document declares no server; this is the origin it was published from)
- URL: `https://api.whoisgeni.us/account/llm-keys`
- Auth: HTTP bearer

Save (create or update) an encrypted BYOK LLM API key.

Validates the key via a test inference call before persisting.
One key per provider per user -- saving for an existing provider
replaces the previous key.

## Request body

- SaveBYOKKeyRequest: Request body for saving (creating or updating) a BYOK LLM API key.
  - `provider` string, required: LLM provider name: "openai", "anthropic", "google", "mistral", "groq"
  - `api_key` string, required: Raw API key (will be encrypted server-side, never stored in plaintext)

## Response `200`

Saved key details (never includes raw key)

- ApiResponseBYOKKeyResponse
  - `data` BYOKKeyResponse: Response body for a single BYOK key. Never includes the raw or encrypted key.
    - `id` string, uuid, required
    - `provider` string, required
    - `key_prefix` string, required
    - `is_active` boolean, required
    - `last_used_at` string, date-time, nullable
    - `last_validated_at` string, date-time, nullable
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - `error` ErrorDetail: Structured error information for API error responses. Attributes: code: Machine-readable error code (e.g. "JOB_NOT_FOUND"). message: Human-readable error description. details: Optional additional context for debugging.
    - `code` string, required
    - `message` string, required
    - `details` object, nullable
  - `meta` object, nullable

## Other responses

- `400`: Unsupported provider
- `401`: Unauthorized — missing or invalid API key/JWT.
- `403`: Tier insufficient — Team or higher required
- `422`: Key validation failed (invalid/expired key)

---

[API](https://skmtc.dev/whoisgeni/apis/whoisgenius.md) · [All operations](https://skmtc.dev/whoisgeni/apis/whoisgenius/llms.txt) · [OpenAPI document](https://skmtc.dev/whoisgeni/apis/whoisgenius/revisions/707f1c34f6b3?raw)
