Docs / API reference
App sign-in keys API
A tool your analysts install can get its own key without anyone pasting one: the user approves a label and a budget in the browser, and the tool exchanges the returned code at https://api.pentestllm.ai/v1 for a key owned by their organization.
Route
| Route | Statuses |
|---|---|
POST /v1/auth/keys | 200, 400, 403, 409 |
The last step of OAuth 2.0 with PKCE. It takes no key itself and answers any origin; the key it mints is an ordinary one, scoped by the label and budget the user accepted.
The flow
| Step | What happens |
|---|---|
1 | Open https://app.pentestllm.ai/auth in the browser with callback_url, code_challenge and code_challenge_method=S256; key_label, limit (USD) and state are optional. |
2 | The user signs in and approves the label and budget shown. |
3 | The browser lands on your callback with ?code= appended. |
4 | Your app posts the code and its verifier to this route and stores the key it gets back. |
Body
| Field | Type | Notes |
|---|---|---|
code | string, required | The code from the callback URL. |
code_verifier | string, required | 43 to 128 characters of A-Z, a-z, 0-9 and -._~ whose S256 hash was the code_challenge. |
code_challenge_method | string | S256. |
callback_url | string | Optional; when sent it must be the approved callback exactly. |
Answer
| Field | Meaning |
|---|---|
key | The new key, shown this once. Store it now. |
key_id | Its id, for the keys API and the console. |
name | The key_label the user approved. |
limit_usd | Its prepaid budget in dollars, or null for none. |
Errors
| Status | Code | When |
|---|---|---|
400 | invalid_grant | The code is invalid, expired or already used, the verifier does not match, or callback_url is not the approved one. invalid_request and invalid_code_challenge_method share the status. |
403 | key_unavailable | New keys are switched off for that account. |
409 | limit_reached | The organization already holds 50 active keys. |
Example
curl https://api.pentestllm.ai/v1/auth/keys \ -H "Content-Type: application/json" \ -d '{"code": "<code from the callback>", "code_verifier": "<your verifier>", "code_challenge_method": "S256"}'Questions
Why a verifier instead of a client secret?
A desktop tool or a CI step cannot keep a secret. With PKCE only the S256 hash travels up front and the verifier stays on the machine, so a code picked off a redirect is worthless without it.
Which callbacks are allowed?
An https URL, or plain http on localhost, 127.0.0.1 or [::1] for a tool that listens on the machine itself. The approved URL is pinned, and a different callback_url at exchange time fails with invalid_grant.
How long do I have, and can I retry?
Ten minutes from approval, and one attempt: the first exchange spends the code whether or not the verifier matched. A retry needs a fresh approval.
Read next
- MCP servers
- Log export
- Invoices
- Billing details
- Statement signing key
- Keys and scopes
- Usage and signed receipts
- Spend limits and balance
- Redaction and guardrails
- Sessions
- Embeddings, rerank and moderation
- Batch files
- Batches
- Status and proof feeds
- Count tokens
- Usage by app
- Webhook deliveries
- Docs: connect in two minutes