s2ar

sym read

/v1/sym/read · $0.005 a call · 10 keyless calls a day · paid by x402, credits, mpp

One symbol's source (a function, struct, impl or method) from a file in a public git repository, with the doc comment above it: the function, not the file. `symbol` is a leaf name or the qualified path as sym ls lists it (`Type::method`, `impl Trait for Type`, `Type as Trait` are accepted).

Call it

curl 'https://api.s2ar.dev/v1/sym/read?repo=BurntSushi%2Fripgrep&ref=14.1.1&file=crates%2Fcore%2Fflags%2Fdefs.rs&symbol=Glob+as+Flag'
curl -X POST https://api.s2ar.dev/v1/sym/read \
  -H 'content-type: application/json' \
  -d '{"repo": "BurntSushi/ripgrep", "ref": "14.1.1", "file": "crates/core/flags/defs.rs", "symbol": "Glob as Flag"}'

With a key: add -H 'Authorization: Bearer $S2AR_KEY'. Over x402, while sales are open: the same call at https://api.s2ar.dev/x402/v1/sym/read; unpaid, it answers 402 with the accepts[] to sign, then send the payment as PAYMENT-SIGNATURE (or X-PAYMENT). Sales are paused since 2026-10-16, and the mirror answers 410. From an agent: the MCP tool sym_read_repo at https://api.s2ar.dev/mcp.

Parameters

parametertyperequiredwhat
repostringyesa public GitHub, GitLab or Codeberg repository: owner/repo, github.com/owner/repo or its https URL
refstringbranch, tag or commit; the default branch when omitted
filestringyespath inside the repository
symbolstringyesa name as sym ls lists it

The answer

{
 "ok": true,
 "text": "impl Glob as Flag (crates/core/flags/defs.rs, lines 2459-2512)\n…",
 "tokens_est": 565,
 "charged_usd": 0.005,
 "repo": "https://github.com/BurntSushi/ripgrep",
 "ref": "14.1.1",
 "receipt": {
  "evidence_hash": "sha256:94abfed2…",
  "cost_usd": 0.005,
  "what": "read",
  "determinism": "replayable",
  "witnesses": [
   "sym"
  ],
  "issued_at": "2026-10-10T00:00:00Z",
  "refund_rule": "failed calls are never charged",
  "charter": "https://api.s2ar.dev/charter"
 }
}

Every paid answer carries its receipt; a record's sha256 re-verifies free at /v1/verify/{sha256}. A call that fails is never charged.

A worked example

read the function: the call, its answer and its record, re-derived.

The errors are the same on every route.