API
Every endpoint of the API: its parameters, request, response and errors.
The API reads Once's accounts for clients, builds the transactions a wallet signs, and relays claims and withdrawals so the person's wallet never appears. It never sees a person's credential, secret or leaf choice: proofs are made on the device and arrive finished.
Examples use $ONCE_API for the API's address; on the localnet it is http://127.0.0.1:27310. Each heading below is also the method name on the TypeScript client:
import { createClient } from '@once/sdk'
const api = createClient(process.env.ONCE_API!)
const { items } = await api.listScopes({ status: 'open' })Conventions
- Bodies are JSON. A request with a field its schema doesn't name is refused; a response may carry fields this page doesn't list yet.
- Amounts are decimal strings in base units (lamports, or USDC's 6-decimal units), so no value loses precision.
- Times are ISO 8601 in UTC.
- 32-byte values (nullifiers, roots, leaves) are lowercase hex. BabyJubJub points are packed into 32 bytes of hex: the y coordinate little-endian, with the sign of x in the top bit. Signatures are the packed
R8point followed byS, 64 bytes of hex. - Lists come in pages: pass
limitand the previous page'spage.nextCursorascursoruntilnextCursoris null. - A failed call answers with the error envelope.
Service
health
GET /health · api.health
Whether the service is up. fixture on the fixture server, waiting while the chain API waits for the program, ready once it serves.
Response
| Name | Type | Description |
|---|---|---|
statusrequired | "fixture" | "waiting" | "ready" | fixture, waiting or ready. |
config
GET /v1/config · api.config
Everything a client needs before its first call: the cluster, the program and its PDAs, assets and relay fees, issuers, OPRF nodes and their key, circuit artifacts and the Rings endpoints.
Response
| Name | Type | Description |
|---|---|---|
clusterrequired | "localnet" | "mainnet" | The cluster the API serves. |
programIdrequired | address | The Once program’s address. |
feeBpsrequired | integer | The protocol fee on drops, in basis points. |
authorityPdasrequired | object | The program’s PDAs. |
authorityPdas.configrequired | address | The config account. |
authorityPdas.treerequired | address | The person tree account. |
authorityPdas.ringsrequired | address | The holders authority, which owns payout notes. |
authorityPdas.pool | address | The pool authority, which owns drop pools. |
authorityPdas.holders | address | The holders authority, which owns payout notes. |
feeRecipient | address | The wallet that receives the protocol fee. |
relayer | address | The relayer’s wallet, which receives the relay fees. |
assetsrequired | object[] | The assets drops can pay in. |
assets[].symbolrequired | "SOL" | "USDC" | The asset’s symbol. |
assets[].mintrequired | address | The asset’s mint. |
assets[].decimalsrequired | integer | The asset’s decimals. |
assets[].claimRelayFeerequired | integer string | The relay fee per claim in this asset, in base units. |
pollRelayFeeLamportsrequired | integer string | The relay fee per vote, in lamports, drawn from a poll’s relay budget. |
issuersrequired | object[] | The issuers in the registry. |
issuers[].idrequired | string | The issuer’s ID. |
issuers[].namerequired | string | The issuer’s name. |
issuers[].publicKeyrequired | hex32 | The issuer’s key, packed BabyJubJub hex. |
issuers[].statusrequired | "active" | "revoked" | active, or revoked once retired. |
oprfNodesrequired | object[] | The OPRF nodes. |
oprfNodes[].indexrequired | integer | The node’s index. |
oprfNodes[].urlrequired | URL | Where the node answers evaluations. |
oprfNodes[].publicKeySharerequired | hex32 | The node’s public key share, packed BabyJubJub hex. |
oprfNodes[].statusrequired | "online" | "offline" | Whether the node answers. |
oprfThresholdrequired | integer | How many node answers an enrollment needs. |
oprfPublicKeyrequired | hex32 | The combined OPRF public key, packed BabyJubJub hex. |
artifactsrequired | object[] | The circuit files, per circuit. |
artifacts[].namerequired | "authorize" | "enroll" | "claim" | The circuit. |
artifacts[].statusrequired | "unavailable" | "partial" | "available" | Whether its files are served. |
artifacts[].wasmUrlrequired | URL | The witness generator. |
artifacts[].zkeyUrlrequired | URL | The proving key. |
artifacts[].verificationKeyUrlrequired | URL | The verification key. |
artifacts[].sizesrequired | object | File sizes in bytes. |
artifacts[].sizes.wasmrequired | integer | Size of the witness generator, bytes. |
artifacts[].sizes.zkeyrequired | integer | Size of the proving key, bytes. |
artifacts[].sizes.verificationKeyrequired | integer | Size of the verification key, bytes. |
treeDepthrequired | integer | The person tree’s depth. |
rootHistoryrequired | integer | How many recent roots a claim may prove against. |
ringsrequired | object | Where the Rings client reads, proves and sends. |
rings.rpcUrlrequired | URL | Solana RPC for Rings transactions. |
rings.indexerUrlrequired | URL | The Rings indexer. |
rings.proverUrlrequired | URL | The Rings prover. |
artifact
GET /v1/artifacts/{name}/{file} · api.artifact
One public circuit file, streamed as bytes: the WASM witness generator, the proving key or the verification key.
Parameters
| Name | Type | Description |
|---|---|---|
namerequired | "authorize" | "enroll" | "claim" (path) | The circuit: authorize, enroll or claim. |
filerequired | "wasm" | "zkey" | "verification-key" (path) | Which file: wasm, zkey or verification-key. |
Returns the file as application/octet-stream.
eventsUrl
GET /v1/events · api.eventsUrl
A server-sent event stream of changes: enrollments, revocations, scopes, claims and new tree roots.
Parameters
| Name | Type | Description |
|---|---|---|
session | string (query) | EventSource session id. |
Returns a text/event-stream of events.
Credentials and the OPRF
issueCredential
POST /v1/issuer/credentials · api.issueCredential
The demo issuer: checks the form with its stand-in check and signs a credential to the holder key. Localnet only.
Request
| Name | Type | Description |
|---|---|---|
subjectIdrequired | string | The subject’s identifier with the issuer: a document number. |
namerequired | string | The subject’s full name. |
dateOfBirthrequired | ISO date | The subject’s date of birth. |
placeOfBirthrequired | string | The subject’s place of birth. |
sexrequired | string | The subject’s sex as the issuer records it. |
nationalityrequired | string | The subject’s nationality. |
holderPublicKeyrequired | hex32 | The holder key the credential is issued to, packed BabyJubJub hex. |
Response
| Name | Type | Description |
|---|---|---|
@contextrequired | string[] | The W3C credentials context. |
typerequired | string[] | The credential types: VerifiableCredential and one concrete type. |
issuerrequired | object | The issuer’s ID and public key. |
issuer.idrequired | string | The issuer’s ID. |
issuer.publicKeyrequired | hex32 | The issuer’s key, packed BabyJubJub hex. |
validFromrequired | ISO time | When the credential became valid. Part of HashID. |
validUntilrequired | ISO time | When the credential expires. |
credentialSubjectrequired | object | The fields the issuer signed. |
credentialSubject.subjectIdrequired | string | The subject’s identifier with the issuer: a document number. |
credentialSubject.namerequired | string | The subject’s full name. |
credentialSubject.dateOfBirthrequired | ISO date | The subject’s date of birth. |
credentialSubject.placeOfBirthrequired | string | The subject’s place of birth. |
credentialSubject.sexrequired | string | The subject’s sex as the issuer records it. |
credentialSubject.nationalityrequired | string | The subject’s nationality. |
credentialSubject.holderPublicKeyrequired | hex32 | The holder key the credential is issued to, packed BabyJubJub hex. |
proofrequired | object | The issuer’s signature over the credential. |
proof.typerequired | string | BabyJubJubEdDSAPoseidon. |
proof.rootrequired | hex32 | The root of the 16 credential values, hex. |
proof.signaturerequired | hex64 | The issuer’s signature over the root, packed hex. |
evaluateOprf
POST /v1/oprf/{nodeId}/evaluate · api.evaluateOprf
Sends one blinded query to one OPRF node through the API and returns the node’s answer.
Parameters
| Name | Type | Description |
|---|---|---|
nodeIdrequired | "1" | "2" | "3" (path) | The node’s index, 1 to 3. |
Request
| Name | Type | Description |
|---|---|---|
nodeIdrequired | integer | The node’s index, 1 to 3. |
blindedQueryrequired | hex32 | The blinded point B, packed BabyJubJub hex. |
authorizationProofrequired | Proof | The authorize proof. |
publicSignalsrequired | (field string)[] | The proof’s public signals as decimal strings. |
holderPublicKeyrequired | hex32 | The holder key the credential is issued to, packed BabyJubJub hex. |
holderSignaturerequired | hex64 | The holder key’s signature over the request, packed hex. |
timestamprequired | ISO time | When the request was signed; nodes accept one within a minute of their clock. |
Response
| Name | Type | Description |
|---|---|---|
nodeIndexrequired | integer | The answering node’s index. |
partialEvaluationrequired | hex32 | The node’s answer Zᵢ = skᵢ·B, packed BabyJubJub hex. |
dleqrequired | object | The node’s Chaum–Pedersen proof. |
dleq.challengerequired | field string | The proof’s challenge, decimal. |
dleq.responserequired | field string | The proof’s response, decimal. |
publicKeySharerequired | hex32 | The node’s public key share, packed BabyJubJub hex. |
oprfNodeInfo
GET /v1/oprf/{nodeId}/info · api.oprfNodeInfo
One OPRF node’s index, public key share and threshold, read through the API.
Parameters
| Name | Type | Description |
|---|---|---|
nodeIdrequired | "1" | "2" | "3" (path) | The node’s index, 1 to 3. |
Response
| Name | Type | Description |
|---|---|---|
nodeIndexrequired | integer | The answering node’s index. |
publicKeySharerequired | hex32 | The node’s public key share, packed BabyJubJub hex. |
thresholdrequired | integer | How many node answers an enrollment needs. |
statusrequired | "online" | "waiting" | Whether the node answers. |
oprfInfo
GET /v1/info · createOprfClient(url).info
Served by each OPRF node itself: its index, its public key share and the threshold.
Response
| Name | Type | Description |
|---|---|---|
nodeIndexrequired | integer | The answering node’s index. |
publicKeySharerequired | hex32 | The node’s public key share, packed BabyJubJub hex. |
thresholdrequired | integer | How many node answers an enrollment needs. |
statusrequired | "online" | "waiting" | Whether the node answers. |
oprfEvaluate
POST /v1/evaluate · createOprfClient(url).evaluate
Served by each OPRF node itself: evaluates one blinded query with the node’s share. The same request and answer as evaluateOprf.
Request
| Name | Type | Description |
|---|---|---|
nodeIdrequired | integer | The node’s index, 1 to 3. |
blindedQueryrequired | hex32 | The blinded point B, packed BabyJubJub hex. |
authorizationProofrequired | Proof | The authorize proof. |
publicSignalsrequired | (field string)[] | The proof’s public signals as decimal strings. |
holderPublicKeyrequired | hex32 | The holder key the credential is issued to, packed BabyJubJub hex. |
holderSignaturerequired | hex64 | The holder key’s signature over the request, packed hex. |
timestamprequired | ISO time | When the request was signed; nodes accept one within a minute of their clock. |
Response
| Name | Type | Description |
|---|---|---|
nodeIndexrequired | integer | The answering node’s index. |
partialEvaluationrequired | hex32 | The node’s answer Zᵢ = skᵢ·B, packed BabyJubJub hex. |
dleqrequired | object | The node’s Chaum–Pedersen proof. |
dleq.challengerequired | field string | The proof’s challenge, decimal. |
dleq.responserequired | field string | The proof’s response, decimal. |
publicKeySharerequired | hex32 | The node’s public key share, packed BabyJubJub hex. |
People and the tree
personByWallet
GET /v1/people/wallet/{wallet} · api.personByWallet
The enrollment a wallet made, if any.
Parameters
| Name | Type | Description |
|---|---|---|
walletrequired | address (path) | The wallet, base58. |
Response
| Name | Type | Description |
|---|---|---|
statusrequired | "not_enrolled" | "enrolled" | "revoked" | not_enrolled, enrolled or revoked. |
walletrequired | address | null | The wallet that enrolled. |
personNullifierrequired | hex32 | null | The person nullifier N, 32 bytes hex. |
leafIndexrequired | integer | null | The leaf’s index in the person tree. |
sincerequired | ISO time | null | When it enrolled. |
expiresAtrequired | ISO time | null | When its credential expires. |
revokedAtrequired | ISO time | null | When it was last revoked. |
treeSizerequired | integer | How many leaves the person tree has. |
personByNullifier
GET /v1/people/nullifier/{nullifier} · api.personByNullifier
The enrollment under a person nullifier, if any.
Parameters
| Name | Type | Description |
|---|---|---|
nullifierrequired | hex32 (path) | The person nullifier N, 32 bytes hex. |
Response
| Name | Type | Description |
|---|---|---|
statusrequired | "not_enrolled" | "enrolled" | "revoked" | not_enrolled, enrolled or revoked. |
walletrequired | address | null | The wallet that enrolled. |
personNullifierrequired | hex32 | null | The person nullifier N, 32 bytes hex. |
leafIndexrequired | integer | null | The leaf’s index in the person tree. |
sincerequired | ISO time | null | When it enrolled. |
expiresAtrequired | ISO time | null | When its credential expires. |
revokedAtrequired | ISO time | null | When it was last revoked. |
treeSizerequired | integer | How many leaves the person tree has. |
buildEnroll
POST /v1/enroll/build · api.buildEnroll
Builds the enroll transaction for the wallet to sign, and simulates it.
Request
| Name | Type | Description |
|---|---|---|
walletrequired | address | The wallet, base58. |
proofrequired | Proof | The Groth16 proof as snarkjs writes it. |
publicSignalsrequired | (field string)[] | The proof’s public signals as decimal strings. |
statementrequired | object | The enrollment’s public terms, committed in the proof’s digest. |
statement.personNullifierrequired | hex32 | The person nullifier N, 32 bytes hex. |
statement.leafrequired | hex32 | The leaf, 32 bytes hex. |
statement.issuerIdrequired | string | The issuer’s ID from the credential. |
statement.expiresAtrequired | ISO time | The credential’s valid-until time. |
registration | object | When the wallet isn’t in the Rings user registry yet, its Rings keys; the transaction then registers it beside enroll. |
registration.nullifierPublicKey | hex32 | The wallet’s Rings nullifier public key, 32 bytes hex. |
registration.viewingPublicKey | string | The wallet’s Rings viewing public key, 33 bytes hex. |
Returns a Build.
buildRevoke
POST /v1/revoke/build · api.buildRevoke
Builds the revoke transaction, with the current path to the person’s leaf, and simulates it.
Request
| Name | Type | Description |
|---|---|---|
walletrequired | address | The wallet, base58. |
personNullifierrequired | hex32 | The person nullifier N, 32 bytes hex. |
Returns a Build.
tree
GET /v1/tree · api.tree
The person tree’s depth, size and current root, and its recent roots in pages.
Parameters
| Name | Type | Description |
|---|---|---|
cursor | string (query) | Where to start, from the previous page’s nextCursor. |
limit | integer (query) | Entries per page. |
Response
| Name | Type | Description |
|---|---|---|
depthrequired | integer | The tree’s depth. |
sizerequired | integer | How many leaves the tree has. |
currentRootrequired | hex32 | The tree’s current root. |
rootsrequired | object | Recent roots, newest first, in pages. |
roots.itemsrequired | object[] | This page’s entries. |
roots.items[].rootrequired | hex32 | A person-tree root, 32 bytes hex. |
roots.items[].slotrequired | integer | The slot it landed in. |
roots.pagerequired | Page | Where the next page starts. |
roots.asOfrequired | ISO time | When the page was read. |
leaves
GET /v1/tree/leaves · api.leaves
The person tree’s leaves in index order, in pages, each page with the root it was read at. Revoked leaves are zero.
Parameters
| Name | Type | Description |
|---|---|---|
from | integer (query) | The first leaf index to return. |
limit | integer (query) | Entries per page. |
Response
| Name | Type | Description |
|---|---|---|
itemsrequired | object[] | This page’s entries. |
items[].indexrequired | integer | The leaf’s index. |
items[].valuerequired | hex32 | The leaf, or zero where revoked. |
items[].insertedSlotrequired | integer | The slot the leaf was written in. |
pagerequired | Page | Where the next page starts. |
asOfrequired | ISO time | When the page was read. |
sizerequired | integer | How many leaves the tree has. |
rootrequired | hex32 | A person-tree root, 32 bytes hex. |
Scopes and claims
listScopes
GET /v1/scopes · api.listScopes
Scopes in pages, filtered by status and kind.
Parameters
| Name | Type | Description |
|---|---|---|
cursor | string (query) | Where to start, from the previous page’s nextCursor. |
limit | integer (query) | Entries per page. |
status | "open" | "upcoming" | "closed" (query) | Only scopes in this window: upcoming, open or closed. |
kind | "drop" | "poll" (query) | Only scopes of this kind. |
Response
| Name | Type | Description |
|---|---|---|
itemsrequired | object[] | This page’s entries. |
items[].idrequired | u64 string | The scope ID. |
items[].kindrequired | "drop" | "poll" | Drop or poll. |
items[].titlerequired | string | The scope’s title. |
items[].creatorrequired | address | The wallet that opened the scope. |
items[].assetrequired | "SOL" | "USDC" | null | The asset a drop pays in; null for a poll. |
items[].amountPerPersonrequired | u64 string | null | What each claim takes from a drop, relay fee included, in base units. |
items[].caprequired | integer | The most claims the scope accepts. |
items[].claimedrequired | integer | How many have claimed. |
items[].opensAtrequired | ISO time | When claims open. |
items[].closesAtrequired | ISO time | When claims close. |
items[].statusrequired | "open" | "upcoming" | "closed" | upcoming, open or closed. |
pagerequired | Page | Where the next page starts. |
asOfrequired | ISO time | When the page was read. |
getScope
GET /v1/scopes/{id} · api.getScope
One scope: its terms, how many claimed, what is left in its pool or relay budget, and a poll’s tally.
Parameters
| Name | Type | Description |
|---|---|---|
idrequired | u64 string (path) | The scope ID. |
Response
| Name | Type | Description |
|---|---|---|
idrequired | u64 string | The scope ID. |
kindrequired | "drop" | "poll" | Drop or poll. |
titlerequired | string | The scope’s title. |
creatorrequired | address | The wallet that opened the scope. |
assetrequired | "SOL" | "USDC" | null | The asset a drop pays in; null for a poll. |
amountPerPersonrequired | u64 string | null | What each claim takes from a drop, relay fee included, in base units. |
caprequired | integer | The most claims the scope accepts. |
claimedrequired | integer | How many have claimed. |
opensAtrequired | ISO time | When claims open. |
closesAtrequired | ISO time | When claims close. |
statusrequired | "open" | "upcoming" | "closed" | upcoming, open or closed. |
optionsrequired | object[] | A poll’s options. |
options[].indexrequired | integer | The option’s index, from zero. |
options[].labelrequired | string | The option’s label. |
options[].tallyrequired | integer | Votes for the option. |
poolRemainingrequired | u64 string | null | What is left in a drop’s pool, base units. |
relayFeerequired | u64 string | The relay fee per claim, base units. |
relayBudgetLeftrequired | u64 string | null | What is left of a poll’s relay budget, lamports. |
createdSignaturerequired | signature | The transaction that opened the scope. |
settledrequired | boolean | Whether the scope has been closed and settled. |
listClaims
GET /v1/scopes/{id}/claims · api.listClaims
One scope’s public ledger in pages: each scope nullifier with its time and transaction.
Parameters
| Name | Type | Description |
|---|---|---|
idrequired | u64 string (path) | The scope ID. |
cursor | string (query) | Where to start, from the previous page’s nextCursor. |
limit | integer (query) | Entries per page. |
Response
| Name | Type | Description |
|---|---|---|
itemsrequired | object[] | This page’s entries. |
items[].nullifierrequired | hex32 | The scope nullifier n, 32 bytes hex. |
items[].timerequired | ISO time | When the claim landed. |
items[].signaturerequired | signature | The transaction signature. |
items[].optionIndexrequired | integer | null | The option voted for; null for a drop. |
pagerequired | Page | Where the next page starts. |
asOfrequired | ISO time | When the page was read. |
reviewScope
POST /v1/scopes/review · api.reviewScope
Quotes a scope before anything is signed: what the creator funds, the protocol fee, the relay fee and what each person receives.
Request
| Name | Type | Description |
|---|---|---|
walletrequired | address | The creator, who signs and funds. |
titlerequired | string | The scope’s title. |
caprequired | integer | The most claims the scope accepts. |
opensAtrequired | ISO time | When claims open. |
closesAtrequired | ISO time | When claims close. |
kindrequired | "drop" | "poll" | Drop or poll; decides which fields follow. |
asset | "SOL" | "USDC" | For a drop, SOL or USDC. |
amountPerPerson | string | For a drop, what each claim takes, relay fee included, in base units. |
options | string[] | For a poll, 2 to 8 labels of up to 32 bytes. |
Response
| Name | Type | Description |
|---|---|---|
kindrequired | "drop" | "poll" | Drop or poll. |
assetrequired | "SOL" | "USDC" | The asset; SOL for a poll. |
totalToFundrequired | u64 string | Everything the creator pays: the pool and the protocol fee, or the relay budget. |
poolFundingrequired | u64 string | What goes into the pool: amount per person times cap. |
protocolFeerequired | u64 string | The protocol fee. |
relayFeerequired | u64 string | The relay fee per claim or vote, base units. |
netPerPersonrequired | u64 string | null | What each claimant receives after the relay fee; null for a poll. |
relayBudgetrequired | u64 string | A poll’s relay budget: relay fee times cap. |
buildScope
POST /v1/scopes/build · api.buildScope
Builds the transactions that open a scope, for the creator to sign, and simulates them.
Request
| Name | Type | Description |
|---|---|---|
walletrequired | address | The creator, who signs and funds. |
titlerequired | string | The scope’s title. |
caprequired | integer | The most claims the scope accepts. |
opensAtrequired | ISO time | When claims open. |
closesAtrequired | ISO time | When claims close. |
kindrequired | "drop" | "poll" | Drop or poll; decides which fields follow. |
asset | "SOL" | "USDC" | For a drop, SOL or USDC. |
amountPerPerson | string | For a drop, what each claim takes, relay fee included, in base units. |
options | string[] | For a poll, 2 to 8 labels of up to 32 bytes. |
Response
| Name | Type | Description |
|---|---|---|
scopeIdrequired | u64 string | The scope ID. |
transactionsrequired | Build[] | The transactions to sign, in order. |
buildCloseScope
POST /v1/scopes/{id}/close/build · api.buildCloseScope
Builds the close for any wallet after the window, with what goes back to the creator: a transaction to sign for a poll or an empty drop, or a relay job for a drop with funds left, since spending the pool back is a Rings transaction.
Parameters
| Name | Type | Description |
|---|---|---|
idrequired | u64 string (path) | The scope ID. |
Request
| Name | Type | Description |
|---|---|---|
walletrequired | address | The wallet that signs and pays for the close; any wallet. |
Response
| Name | Type | Description |
|---|---|---|
scopeIdrequired | u64 string | The scope ID. |
creatorrequired | address | Who receives what is left. |
assetrequired | "SOL" | "USDC" | The asset returned. |
returnAmountrequired | u64 string | What goes back to the creator. |
transaction | Build | For a poll or an empty drop, the transaction to sign. |
jobId | string | For a drop with funds left, the relay job that spends the pool back to the creator; follow it with getJob. |
relayClaim
POST /v1/claims/relay · api.relayClaim
Queues a proven claim. The relayer builds the transaction, pays for it and sends it; follow it with getJob.
Request
| Name | Type | Description |
|---|---|---|
scopeIdrequired | u64 string | The scope ID. |
rootrequired | hex32 | The root the proof was made against. |
nullifierrequired | hex32 | The scope nullifier n. |
proofrequired | Proof | The Groth16 proof as snarkjs writes it. |
publicSignalsrequired | (field string)[] | The proof’s public signals as decimal strings. |
kindrequired | "drop" | "poll" | Drop or poll; decides which fields follow. |
binding | field string | For a drop, the owner hash of the payout note, as a decimal field element. |
recipientOutput | object | For a drop, the payout note the claim creates. |
recipientOutput.ownerShieldedAddress | base64 | The claimant’s fresh holder address, the 99-byte shielded address in base64. |
recipientOutput.blinding | hex32 | The output’s blinding. |
recipientOutput.ownerHash | hex32 | The payout note’s owner hash, the same value as binding, hex. |
recipientOutput.amount | string | The payout amount, base units. |
optionIndex | integer | For a poll, the option voted for. |
Response
| Name | Type | Description |
|---|---|---|
jobIdrequired | string | The relay job to follow. |
Relays and transactions
getJob
GET /v1/jobs/{id} · api.getJob
The state of a relayed claim or withdrawal.
Parameters
| Name | Type | Description |
|---|---|---|
idrequired | string (path) | The job ID from the relay receipt. |
Response
| Name | Type | Description |
|---|---|---|
jobIdrequired | string | The relay job to follow. |
kindrequired | "claim" | "withdraw" | "close_scope" | A claim, a withdrawal or a drop’s close. |
statusrequired | "queued" | "proving_payout" | "building" | "proving" | "submitted" | "confirmed" | "failed" | Where the relay is: queued, proving_payout, building, proving, submitted, then confirmed or failed. |
signature | signature | The relayed transaction, once submitted. |
slot | integer | The slot it landed in. |
payoutAmount | u64 string | What the claimant received, base units, once confirmed. |
code | string | The error code, when the job failed. |
retryable | boolean | Whether trying again can help. |
relayWithdrawal
POST /v1/withdrawals/relay · api.relayWithdrawal
Queues a proven withdrawal from a private balance; follow it with getJob.
Request
| Name | Type | Description |
|---|---|---|
destinationrequired | address | The public address the withdrawal pays. |
inputNullifiersrequired | hex32[] | The nullifiers of the notes the withdrawal spends. |
withdrawalBase64required | base64 | The proven Rings withdrawal, serialized. |
Response
| Name | Type | Description |
|---|---|---|
jobIdrequired | string | The relay job to follow. |
followTransaction
GET /v1/transactions/{signature} · api.followTransaction
The status of a transaction a wallet sent, by signature.
Parameters
| Name | Type | Description |
|---|---|---|
signaturerequired | signature (path) | The transaction signature. |
Response
| Name | Type | Description |
|---|---|---|
signaturerequired | signature | The transaction signature. |
statusrequired | "submitted" | "confirmed" | "failed" | "expired" | submitted, confirmed, failed or expired. |
slot | integer | The slot it landed in. |
stage | string | The stage the transaction reached or failed at. |
programError | object | The program error that refused the transaction. |
programError.programId | address | The program that refused the transaction. |
programError.name | string | The error’s name. |
programError.number | integer | The error’s code. |
Rings
These routes pass the Rings client's own calls through the API, so a browser reaches the indexer and the prover from one origin. Their request and response shapes are the ones @heliuslabs/spr sends and reads.
ringsRpc
POST /v1/rings/rpc · api.ringsRpc
Solana JSON-RPC for the Rings client, passed through to the cluster.
ringsIndexer
POST /v1/rings/indexer/{method} · api.ringsIndexer
The Rings indexer’s read methods, passed through, for the device to scan payout traffic.
Parameters
| Name | Type | Description |
|---|---|---|
methodrequired | "getEncryptedUtxosByTags" | "getShieldedTransactionsByTags" | "getShieldedTransactionsByNullifiers" | "getShieldedTransactionsBySignature" | "getUserRecords" (path) |
ringsProverHealth
GET /v1/rings/prover/health · api.ringsProverHealth
Whether the Rings prover is up, and its circuits.
ringsProof
POST /v1/rings/prover/prove/{key} · api.ringsProof
Proves a prepared Rings transaction, such as a withdrawal, through the Rings prover.
Parameters
| Name | Type | Description |
|---|---|---|
keyrequired | string (path) |
ringsIndexedProof
POST /v1/rings/prover/prove/{key}/indexed · api.ringsIndexedProof
Proves a prepared Rings transaction with the indexer resolving its roots.
Parameters
| Name | Type | Description |
|---|---|---|
keyrequired | string (path) |
Shapes
Proof
A Groth16 proof as snarkjs writes it, coordinates as decimal strings. Circuits has the byte form the program takes.
| Name | Type | Description |
|---|---|---|
protocolrequired | "groth16" | groth16. |
curverequired | "bn128" | bn128. |
pi_arequired | [field string, field string, "1"] | The A point. |
pi_brequired | [[field string, field string], [field string, field string], ["1", "0"]] | The B point. |
pi_crequired | [field string, field string, "1"] | The C point. |
Build
An unsigned transaction the API built and simulated. The wallet signs it as it is and sends it, then follows it with followTransaction.
| Name | Type | Description |
|---|---|---|
transactionBase64required | base64 | The unsigned transaction, base64. |
blockhashrequired | address | The blockhash it was built on. |
lastValidBlockHeightrequired | integer | The last block height it can land at. |
fixtureSignature | signature | On the fixture server, the signature to follow in place of a real one. |
versionrequired | "v0" | "v1" | The transaction format: v0, or v1 for Rings transactions. |
instructionsrequired | string[] | The instructions it carries, by name. |
simulationrequired | object | The simulation the API ran before returning it. |
simulation.okrequired | boolean | Whether it simulated cleanly. |
simulation.unitsConsumedrequired | integer | Compute units it used. |
simulation.programError | object | The program error, when it failed. |
simulation.programError.programId | address | The program that refused it. |
simulation.programError.name | string | The error’s name. |
simulation.programError.number | integer | The error’s code. |
Page
| Name | Type | Description |
|---|---|---|
nextCursorrequired | string | null | The cursor for the next page; null on the last. |
hasMorerequired | boolean | Whether another page follows. |
Errors
Every failure answers with one envelope:
{
"error": {
"code": "ALREADY_CLAIMED",
"message": "This person already claimed this scope.",
"retryable": false,
"stage": "confirmation"
}
}code is stable and is what a client branches on; message is a sentence to show. retryable says whether the same request can succeed later, and stage names where it failed: validation, auth, read, upload, build, wallet, co_sign, simulation, send or confirmation. Depending on the code, the envelope also carries fieldErrors, programError, need and have in base units, retryAfterSeconds, and a requestId.
| Code | HTTP | When |
|---|---|---|
VALIDATION_ERROR | 400 | The request doesn’t match its schema; fieldErrors names each field. |
UNAUTHORIZED | 401 | The request lacks a credential the route requires. |
ORIGIN_NOT_ALLOWED | 403 | The browser origin isn’t in the API’s allowed origins. |
NOT_FOUND | 404 | No such scope, job, transaction or route. |
PROGRAM_UNAVAILABLE | 409 | The program or its registry can’t be read yet, or a node’s share doesn’t match the registry. |
CONFIGURATION_REQUIRED | 409 | The service is missing a setting it needs for this route. |
IDEMPOTENCY_CONFLICT | 409 | The same request key was used for a different request. |
TRANSACTION_EXPIRED | 409 | The transaction’s blockhash expired before it landed; build it again. |
PAYLOAD_TOO_LARGE | 413 | The body is over the size limit. |
UNSUPPORTED_MEDIA_TYPE | 415 | The body isn’t JSON. |
SIMULATION_FAILED | 422 | The built transaction failed simulation; programError names the program error. |
CHAIN_REFUSED | 422 | The transaction landed and failed; programError names the program error. |
RATE_LIMITED | 429 | Too many requests; retryAfterSeconds says when to try again. |
INTERNAL_ERROR | 500 | The service failed; requestId identifies the request. |
UPSTREAM_UNAVAILABLE | 502 | The RPC, the indexer, the prover or a node didn’t answer. |
ISSUER_REFUSED | 422 | The demo issuer refused the form; fieldErrors names the fields. |
SIGNATURE_INVALID | 401 | The holder signature doesn’t verify, or the request names another node. |
STALE_TIMESTAMP | 401 | The request was signed more than a minute from the node’s clock. |
ISSUER_UNKNOWN | 422 | The issuer isn’t active in the registry. |
PROOF_INVALID | 422 | A proof doesn’t verify, or its statement differs from the request. |
ALREADY_ENROLLED | 409 | The person nullifier has an active enrollment. |
REVOKE_COOLDOWN | 409 | This person revoked less than 24 hours ago; enrolling again opens after that. |
NOT_ENROLLED | 409 | The person account isn’t active, so there is nothing to revoke. |
TREE_FULL | 409 | The person tree has no room for another leaf. |
STALE_OPRF_KEY | 409 | The enrollment was made against an old OPRF registry version; ask the nodes again. |
CREDENTIAL_EXPIRED | 422 | The credential’s valid-until time has passed. |
ALREADY_CLAIMED | 409 | The scope nullifier has claimed in this scope. |
SCOPE_FULL | 409 | The scope reached its cap. |
SCOPE_NOT_OPEN | 409 | The scope hasn’t opened. |
SCOPE_CLOSED | 409 | The scope has closed. |
SCOPE_STILL_OPEN | 409 | The scope’s window hasn’t ended, so it can’t be closed yet. |
ROOT_UNKNOWN | 409 | The root is no longer in the history; prove again against a fresh leaf download. |
CREDENTIAL_EXPIRES_BEFORE_CLOSE | 422 | The credential expires before the scope closes. |
WRONG_BINDING | 422 | The payout or the option doesn’t match what the proof is bound to. |
BAD_POOL_NOTE | 409 | The Rings transaction doesn’t match the scope’s pool note; build the claim again. |
INSUFFICIENT_RELAY_BUDGET | 409 | The poll’s relay budget can’t pay for another vote. |
RELAY_BUSY | 503 | The relayer can’t take the job now; nothing was sent. |
INSUFFICIENT_BALANCE | 422 | The wallet can’t fund the scope; need and have give base units. |
INVALID_TERMS | 422 | The scope’s terms break a rule; fieldErrors names the fields. |
The fixture server answers every route with sample data and no chain. Send X-Fixture with a scenario name, or with an error code to receive that error, and X-Fixture-Session with one id per flow.