Minerval

REST API

The graph over plain HTTP, at https://api.claimgraph.io. This page covers what every route has in common: reading without a key, caching, limits, trimming responses, writes, spending and errors.

Every route an account can call is also an MCP tool, apart from a few left out for a stated reason (buying owls, for one, happens on the account page). The tool runs the route itself, with the same validation, charges and errors. The tool catalog is therefore a map of the API, and each entry names its route. A self-hosted deployment serves the same API at its own address.

Schemas for every route.The OpenAPI explorer lists each route with its parameters and response shapes, generated from the routes themselves. The OpenAPI document is at https://api.claimgraph.io/docs/json.

Try it

These reads need no key. The id is a real claim on the public graph.

curl https://api.claimgraph.io/claims/dc02e01f-ce69-4dbe-ba36-ed0e2e90d071/card

The claim's judgment in one small shape. GET /claims/cards?ids=<id>,<id> reads up to 100 at once.

Keys

Reads are open. Everything that writes, spends or reads your own account needs an API key in the x-api-key header. Mint one on your account page; see Authentication. An OAuth access token from an MCP client is scoped to /mcp and is refused on REST routes with 403 INSUFFICIENT_SCOPE.

Open reads and caching

A read on a route that needs no key, sent without credentials, is a public read. Any web page may call it from the browser: the answer carries access-control-allow-origin: *. A successful public read is cacheable for a minute:

Headers on a public read
access-control-allow-origin: *
cache-control: public, max-age=60, stale-while-revalidate=300
etag: W/"ZWSRV1AfUoRyZjuGZplQoJhbOXA"
vary: Authorization, X-API-Key
ratelimit-policy: 300;w=60
  • Send the ETag back in If-None-Match and an unchanged response comes back as 304 with no body.
  • Because of the cache, an anonymous read can be up to a minute behind the graph, and a stale copy may be served for up to five more minutes while a fresh one is fetched.
  • A request that carries a key is never served from cache. Its answer is cache-control: private, no-store.

These are the public graph's settings. A deployment can set its own cache times, or restrict CORS to a list of origins, in which case public reads are no longer stored in shared caches.

The anonymous rate limit

Requests without a recognised credential are limited to 300 a minute per IP address. Every counted response carries RateLimit-Policy: 300;w=60. Past the limit the answer is 429 with Retry-After in seconds:

429
{
  "error": {
    "code": "ANONYMOUS_RATE_LIMITED",
    "message": "Requests without credentials are limited to 300 requests per minute per IP address. …",
    "request_id": "…"
  }
}

The limit exists because an anonymous caller has no budget to bound its use, so a count per address stands in for one. Requests with a valid key are not counted; their bound is the account's balance. A made-up key is counted like no key. Each API instance counts separately, and reads answered from the edge cache are not counted at all, so treat 300 as the least you can rely on.

Partial responses

Every GET that answers with a JSON object takes fields: a comma-separated list of dotted paths, at most 2,000 characters.

  • A path keeps the value at it whole. claim keeps all of claim.
  • A path through a list applies to each item: results.id,results.text.
  • A path that matches nothing is left out. A null on the way stays null, so assessment.status on an unassessed claim answers {"assessment": null}.
  • Malformed input, such as a stray comma, is a 400 VALIDATION_ERROR.
  • It does not apply to errors or to responses that are not JSON (BibTeX, Lean source, Atom feeds, exports). There it is checked and then ignored.

When you trim a judgment, keep the claim's contestation, and its credence where one is stated. A status without the contestation beside it misreports the graph.

Merged ids

When two nodes are merged, the absorbed id keeps working for reads. A GET on any /claims/:claim_id/… route answers for the surviving node and adds resolved_from to the JSON (kept even when fields trims everything else). Every such response, JSON or not, also carries the absorbed id in the x-minerval-resolved-from header.

Check resolved_from.stance_relation. If it is opposed, the node was merged with its negation, and the survivor's verdict is about the opposite of what your id stated.

A write to an absorbed id is refused with 409 CLAIM_MERGED. The body names the survivor in merged_into. Read the survivor's wording before you resend, because after an opposed merge it says the opposite.

The formal statement routes (/formalization, /formalization.lean, /formalizations) are the exception: they keep answering for the absorbed node's own statement.

Writes are reviewed

Nothing you send changes the graph directly. A proposed claim, a submitted source, a stated view and a contribution each enter the review queue, and the Contribution Reviewer decides. The first three answer 202 Accepted; a contribution answers 201 with review_status: "pending".

RouteStatusCost
POST /claims/propose202Charged: capped at the claim_proposal cap, refunded in full if review rejects it
POST /sources202Charged: capped at the source_ingest cap, refunded in full if review rejects it
POST /claims/:claim_id/stated-views202Free; counts toward the hourly contribution limit
POST /contributions201Free; counts toward the hourly contribution limit
POST /claims/propose → 202
curl -X POST https://api.claimgraph.io/claims/propose \
  -H "x-api-key: $MINERVAL_API_KEY" \
  -H "content-type: application/json" \
  -d '{"claim": "…", "kind": "claim"}'

{
  "contribution": {
    "id": "…",
    "contribution_type": "propose_claim",
    "review_status": "pending",
    "submitted_at": "…"
  },
  "message": "Proposal queued for review. …"
}

Follow any of them with GET /contributions/:id (get_contribution_status). Once a proposal is accepted it returns became_claim_id and page_url.

A few other routes answer 202 because they start work and return before it finishes: a message to the Assistant or the Grantmaker, and a page analysis still running for the browser extension. Read the result from the resource the response names.

Routes that spend

Reads are free. A route that runs a model holds its operation's cap from your balance when the work starts, then returns whatever the run did not use once its metered cost is known. You never pay more than the cap. Routes that fund open-ended work escrow the budget you choose and return what is not spent. Owls and pricing has the figures.

A charged route checks first that your balance covers the cap. If it does not, the answer is 402 INSUFFICIENT_OWLS, with what you need to act on:

402
{
  "error": "This operation (assessment) costs up to 2 owls (you pay the metered cost, never more than the cap) and your balance is 0.4. Buy owls from your account page …",
  "code": "INSUFFICIENT_OWLS",
  "cap_owls": 2,
  "entitlement": {
    "owl_balance": 0.4,
    "caps_owls": { "assessment": 2, "text_analysis": 0.1, … },
    "signup_grant_owls": 10,
    "monthly_grant_owls": 1,
    …
  },
  "packs": [{ "id": "owls_5", "owls": 5, "name": "Clutch", "price_cents": 2000, "discount_percent": 0 }, …]
}

packs is present only where owls can be bought. The funding routes (escrow) answer a short balance with 402 INSUFFICIENT_OWLS too, carrying the message and code only.

Errors

Every refusal is JSON with a status code that means what HTTP says it means, a stable code to branch on, and a message written for the reader. Routes send that in one of two shapes, so read both:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "fields has an empty path (a stray comma)",
    "details": [{ "path": "fields", "message": "fields has an empty path (a stray comma)" }],
    "request_id": "7916118c-…"
  }
}

Input that fails a route's schema, unknown routes, server faults, the anonymous rate limit, SQL refusals, and most refusals on claim, source and contribution routes. request_id is present on most of these; quote it when you report a problem.

Input errors come in two codes. A value the route's schema rejects (a malformed id, depth=99) is 400 REQUEST_ERROR, with a message such as querystring/depth must be <= 8. A check a route makes itself, or a malformed fields, is 400 VALIDATION_ERROR with details naming each path.

A missing or unrecognised key is 401 with {"error": "Invalid or missing API key"} and no code.

Over MCP, the same refusal is a tool error, always in one shape: {"error": {"code", "message", "status", …}}, where status is the HTTP status and the flat shape's extra fields are carried along. A refusal with no code arrives as HTTP_401 and so on. All common codes →