← Receivers

book:claim

book family

Save a paid book to the signed-in caller's library — proves the purchase with the Stripe Checkout session_id and grants book:<slug>

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
manage_things
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
free
What one call costs, so you can budget before acting.
Reversible
no
This cannot be undone. Dry-run it first where the contract allows.
Idempotent
yes
Safe to retry as-is.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/book:claim \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "session_id": "cs_live_a1b2c3" }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • session_id string required The Stripe Checkout session id from the success page URL (?session_id=cs_…) — the same receipt order:claim accepts. Card rail only; a crypto tx hash is refused as rail_not_claimable.

Response

What comes back from the call.

  • ok boolean
  • books string[] Book slugs now in the caller's library (feature book:<slug>).
  • already boolean True when the caller already held every book in this order; the session is spent either way.
  • error string Named refusal: session_id_required · forbidden · agent_not_claimable (an agent world key; a library is a signed-in reader's) · not_found (no order sold by one under this session — the webhook may not have landed yet; retry) · not_a_book (no line on the order is a book) · not_paid · refunded · test_mode · rail_not_claimable · already_claimed (another library already holds this session) · unavailable (D1 failed; retry) · no_db.
  • httpStatus 503 Present only with unavailable / no_db: the door answers HTTP 503 so the refusal is retried, never cached as a 200 idempotent result.

Traffic

Every call to book:claim, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names book:claim, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 3
  • one.ie/web/src/lib/books/access.ts:38
  • one.ie/web/src/lib/receiver-index.generated.ts:53
  • one.ie/web/src/lib/resolvers/book-claim.ts:2
→

Answered by

book:claim one.ie/web/src/lib/resolvers/book-claim.ts:174 Dispatched through POST /api/ask/book:claim, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "session_id": {
      "type": "string",
      "minLength": 1,
      "description": "The Stripe Checkout session id from the success page URL (?session_id=cs_…) — the same receipt order:claim accepts. Card rail only; a crypto tx hash is refused as rail_not_claimable."
    }
  },
  "required": [
    "session_id"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "books": {
      "description": "Book slugs now in the caller's library (feature book:<slug>).",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "already": {
      "description": "True when the caller already held every book in this order; the session is spent either way.",
      "type": "boolean"
    },
    "error": {
      "description": "Named refusal: session_id_required · forbidden · agent_not_claimable (an agent world key; a library is a signed-in reader's) · not_found (no order sold by one under this session — the webhook may not have landed yet; retry) · not_a_book (no line on the order is a book) · not_paid · refunded · test_mode · rail_not_claimable · already_claimed (another library already holds this session) · unavailable (D1 failed; retry) · no_db.",
      "type": "string"
    },
    "httpStatus": {
      "description": "Present only with unavailable / no_db: the door answers HTTP 503 so the refusal is retried, never cached as a 200 idempotent result.",
      "type": "number",
      "const": 503
    }
  },
  "required": [
    "ok"
  ]
}