Agent access

Start a key claim from inside an agent's session

Changed on

Creates a claim and returns two things: a claim_code the human can read (PR-XXXX-XXXX) and a one time claim_token only the agent holds. Show the human approve_url; they sign in (or create the account there) and click Approve. Then poll GET /api/agent/claims/{code} with the claim_token as a Bearer until status is approved; that response carries the api_key once. The key is attached to the approving human's account and named "Agent: <client_name>".

Limits: 5 claims an hour per address, 20 pending per address, 2,000 pending globally (503 with Retry-After). A claim lives 15 minutes; the approval page can extend it to at most 60 minutes from creation.

post/api/agent/claims

Request

  • Base URL
    https://api.prereason.com
  • Auth
    none required

Request body

client_namestring

The app or agent asking. Printable text, no URLs. Becomes the key name.

purposestring

One line on what the key is for, shown on the approval page.

client_versionstring

Example request

{
  "client_name": "Claude Desktop"
}

Response

Claim created; the token is shown once

claim_codestring
claim_tokenstring

Bearer for the poll. Shown once, never stored in plaintext.

statusstring
approve_urlstring
expires_atstring date-time
expires_ininteger
instructionsstring
docsstring

Example response

{
  "claim_code": "PR-7K3F-9Q2M",
  "claim_token": "prc_...",
  "status": "pending",
  "approve_url": "https://www.prereason.com/claim/PR-7K3F-9Q2M",
  "expires_in": 900,
  "poll": {
    "method": "GET",
    "header": "Authorization: Bearer <claim_token>",
    "interval_seconds": 5
  }
}

Changes