Sign in, mint a key.

Updated November 22, 2026.

Let a user give your app a key of their own without pasting a secret. POST /v1/auth/keys at https://api.uncensoredllm.ai/v1 closes an OAuth 2.0 sign-in with PKCE (S256): the browser comes back to you with a one-time code, and this route trades the code plus your verifier for a new key owned by the user’s organization. It is public, so send no key on this call. Keys an administrator mints directly are covered on the keys page.

Get a key

Start the sign-in

Generate a verifier of 43 to 128 characters from the set A-Z, a-z, 0-9 and -._~, hash it with SHA-256, base64url-encode the hash as the challenge, and open:

text
1https://app.uncensoredllm.ai/auth?callback_url=https://yourapp.example/callback&code_challenge=CHALLENGE&code_challenge_method=S256&key_label=My%20app&state=STATE

key_label, limit (a budget in USD) and state are optional. The callback must be https, or http on localhost, 127.0.0.1 or [::1]. After the user approves, the browser lands on the callback with ?code=; the code is single use and expires ten minutes after approval.

Exchange the code

FieldTypeWhat it does
codestring, requiredThe code from the callback URL.
code_verifierstring, requiredThe verifier whose S256 hash was the challenge.
code_challenge_methodstringS256, the only method.
callback_urlstringOptional; when sent it must equal the approved callback exactly.
shell
1curl https://api.uncensoredllm.ai/v1/auth/keys \
2 -H "Content-Type: application/json" \
3 -d '{"code": "CODE_FROM_CALLBACK", "code_verifier": "VERIFIER", "code_challenge_method": "S256"}'

Response

FieldWhat it holds
keyThe new key, returned this one time only.
key_idIts id, for the keys API and the console.
nameThe label the user approved.
limit_usdThe prepaid budget the user approved, or null for none.

Status codes

StatusCodeWhen
200noneThe new key.
400invalid_grant, invalid_request, invalid_code_challenge_methodBad, spent or expired code; verifier mismatch; wrong callback; malformed body; a method other than S256.
403key_unavailableNew keys are switched off for this account.
409limit_reachedThe organization already holds 50 active keys; revoke unused ones first.

Auth keys: questions

Why PKCE rather than a client secret?

Your app never holds a secret. The sign-in page sees only the hash of the verifier, and the verifier itself travels once, in the exchange, so a captured code is useless on its own. That is the right shape for public clients such as desktop apps and extensions.

Can I read the key again later?

No. The secret comes back once in this response. Store it at once; if it is lost, run the user through sign-in again and a fresh key is minted.

Why did I get 400 invalid_grant?

The code was wrong, already spent or older than ten minutes, the verifier did not hash to the challenge the sign-in opened with, or callback_url differed from the approved one. Codes are single use and expire after ten minutes, so start a new PKCE sign-in rather than retrying the same code.

Read next

Join on TelegramHelp