OC Attest HTTP API
The hosted API on https://attest.ochk.io, every route under /api/, is a
reference deployment of OC Attest. /api/check, /api/verify and
/api/discover on https://ochk.io forward there and answer the same.
/api/challenge is served by ochk.io, the auth host. The same checks run in
your own code through @orangecheck/sdk. Every route is
documented here.
Rate limits are per IP, per minute: /api/check and /api/discover 60,
/api/stats 30, /api/challenge 30, /api/verify 10,
/api/publish-attestation 5. Response shape is stable; new optional fields may
be added, existing fields will not change meaning.
/api/check and /api/discover answer each question at one URL. A key the
route doesn't read, a key given twice, a second subject (id is read over
addr, and addr over identity), or another spelling of a value (an id or a
bech32 address in capitals, a protocol name in capitals, a number with a leading
zero, or /api/discover's default limit=50 spelled out) answers 308 to that
URL, with no lookup. The order of the keys doesn't matter. The redirect is kept
an hour, so follow it (curl -L).
GET /api/checkLink to this section
The load-bearing sybil-gate primitive. One call, one answer.
RequestLink to this section
GET /api/check?addr=bc1q...&min_sats=100000&min_days=30
GET /api/check?id=<attestation_id>&min_sats=100000
GET /api/check?identity=github:alice&min_sats=50000
| Param | Required | Notes |
|---|---|---|
addr | at least one of… | Bitcoin address |
id | …these three | Attestation ID (64-char hex) |
identity | protocol:, e.g. github: | |
min_ | optional | Integer; default 0 |
min_ | optional | Integer; default 0 |
Response — 200Link to this section
{
"ok": true,
"sats": 125000,
"days": 47,
"score": 30.12,
"attestation_id": "a3f5b8c2...",
"address": "bc1q...",
"identities": [{ "protocol": "github", "identifier": "alice" }],
"network": "mainnet"
}
Response — below threshold (200, ok: false)Link to this section
{
"ok": false,
"sats": 50000,
"days": 12,
"score": 15.15,
"attestation_id": "a3f5b8c2...",
"address": "bc1q...",
"identities": [...],
"network": "mainnet",
"reasons": ["below_min_sats", "below_min_days"]
}
Response — not found (404)Link to this section
{ "ok": false, "reasons": ["not_found"] }
Response — not a Bitcoin address (400)Link to this section
addr is parsed before any lookup. A typo, or an address whose checksum fails,
answers 400 and is never looked up, so a 404 is never a typo. A bech32 address
in capitals, as a QR code carries it, answers 308 to its lowercase spelling.
{
"error": "bad_request",
"issues": [
{
"code": "custom",
"message": "not a Bitcoin address",
"path": ["addr"]
}
]
}
A 200 is kept 60 s. A 404 is not kept: a lookup that no relay answered also finds nothing and answers 404, so ask again before you treat one as final.
POST /api/verifyLink to this section
Raw attestation verification — no relay lookup, no thresholds. Give it
(addr, msg, sig), get back full codes + metrics.
RequestLink to this section
{
"addr": "bc1q...",
"msg": "orangecheck\nidentities: ...\n...",
"sig": "AUBH..."
}
scheme may still be sent, as bip322 or legacy, and is ignored: the
signature's bytes decide which it is.
Response — 200Link to this section
{
"ok": true,
"codes": ["sig_ok_bip322", "bond_confirmed"],
"network": "mainnet",
"attestation_id": "a3f5b8c2...",
"identities": [{ "protocol": "github", "identifier": "alice" }],
"metrics": { "sats_bonded": 125000, "days_unspent": 47, "score": 30.12 }
}
metrics is present only when ok is true. An addr that is not a Bitcoin
address answers 400 { "error": "bad_request" }. No cache.
/api/challengeLink to this section
Signed-challenge auth — prove control of an address in real-time.
GET /api/challenge?addr=bc1q…&audience=https://example.com&purpose=loginLink to this section
Issue a short-lived message for the user to sign.
Response:
{
"message": "orangecheck-auth\n...",
"nonce": "a3f5b8c2...",
"expiresAt": 1777014000000,
"expiresAtIso": "2026-04-24T07:00:00Z"
}
expiresAt is epoch milliseconds. An optional ttl sets the lifetime in
seconds, 30 to 3600.
addr must decode as a Bitcoin address. One whose checksum fails answers 400
{ "error": "invalid_address" } rather than a message no wallet can sign. A
testnet address still gets a challenge, and a bech32 address in capitals is
issued in lowercase.
POST /api/challengeLink to this section
Verify a signed response.
{
"message": "orangecheck-auth\n...",
"signature": "AUBH...",
"expectedNonce": "a3f5b8c2...",
"expectedAudience": "https://example.com",
"expectedPurpose": "login"
}
Response: { ok: true, address: "bc1q..." } on success,
{ ok: false, reason: "invalid_challenge" } otherwise.
The public primitive is deliberately generic — no session cookies, no account side effects. The caller is responsible for nonce replay prevention. If you want the session-aware variant, see Sign in with Bitcoin.
GET /api/discoverLink to this section
List attestations for a subject — a summary of each one the relays hold, most recent first.
GET /api/discover?addr=bc1q...
GET /api/discover?id=<attestation_id>
GET /api/discover?identity=github:alice
limit caps the list, 1 to 100, default 50. total counts every match before
the cap. An addr that is not a Bitcoin address answers 400, as on
/api/check, rather than an empty list.
Response:
{
"count": 1,
"total": 1,
"attestations": [
{
"attestation_id": "a3f5b8c2...",
"address": "bc1q...",
"scheme": "bip322",
"identities": [{ "protocol": "github", "identifier": "alice" }],
"issued_at": "2026-04-20T12:00:00Z",
"expires_at": "2027-04-20T12:00:00Z",
"verification_url": "https://attest.ochk.io/attest/a3f5b8c2...",
"relay_hints": []
}
]
}
Each summary leaves out the message and the signature, and nothing is verified:
use /api/check or /api/verify for that. Only attestations whose signed
message names the subject are listed or counted. Relays match on unsigned tags,
so one can send an attestation for another address, or one that binds no such
handle; the endpoint drops those, as /api/check does. Use this when you need
to see historical attestations for an address, not just "does the latest meet
thresholds."
A read the relays finished answers 200, cached 60 s.
Response — 503, when the relays did not finish the read:
{
"count": 0,
"total": 0,
"attestations": [],
"reasons": ["attestation_unread"]
}
The body carries what was read, so count and total count what came back, not
every match, and an empty list does not mean there are none. It is sent with
Cache-Control: no-store and Retry-After: 30: ask again after 30 seconds. By
id, a copy whose signature verifies is a finished answer, since the id is the
hash of the one message. In your own code,
readAttestations() from
@orangecheck/sdk reads the same way and sets unread to
"attestation_unread" when the read did not finish.
POST /api/publish-attestationLink to this section
Broadcast an envelope you built and signed with createAttestation(). The
server recomputes the id, re-verifies the signature, builds the Nostr event from
the signed message alone, signs that outer event with attest.ochk.io's service
key, and sends it to its relays. It then asks each relay attest.ochk.io's
readers query (nos.lol, relay.primal.net, nostr.oxtr.dev and relay.ochk.io) on
its own for the event. The attestation is published only once 2 of them serve
back a copy whose Nostr id and signature verify and that carries the same
attestation id, message and signature.
{
"envelope": {
/* AttestationEnvelope */
}
}
Response — 200, published:
{
"ok": true,
"published": true,
"served_by": ["wss://...", "wss://..."],
"asked": 4,
"quorum": 2,
"success_count": 6,
"total_count": 6,
"success": ["wss://..."],
"failed": [{ "relay": "wss://...", "reason": "..." }],
"event_id": "...",
"pubkey": "..."
}
Response — 502, when fewer than 2 of the relays readers ask serve it back:
{
"ok": false,
"published": false,
"error": "not_published",
"served_by": ["wss://..."],
"asked": 4,
"quorum": 2,
"success_count": 6,
"total_count": 6,
"success": ["wss://..."],
"failed": [],
"event_id": "...",
"pubkey": "..."
}
served_by is what counts: a relay's OK, in success, is not a stored copy.
On a 502, send the same envelope again; nothing new needs signing. The service
key vouches for delivery only; the BIP-322 signature inside is still the proof.
An envelope that binds a nostr: identity is refused with 422
nostr_binding_requires_nip07: that npub must sign the event itself. Other
refusals are 400 (invalid_json, missing_envelope, missing_field) and 422
(for example attestation_id_mismatch, signature_invalid,
message_too_large). The full list is in /api/openapi.
GET /api/statsLink to this section
Aggregate counts over the newest attestations on attest.ochk.io's relays, up to
500 per relay, deduplicated by attestation id: totals by scheme, identity
bindings by protocol, unique addresses, and the bond: amounts declared in
signed messages (declared, not checked against the chain). Cached 10 minutes;
cached_at says when it was computed and window_minutes is that cache life.
Status codesLink to this section
| Code | Severity | Meaning |
|---|---|---|
sig_ | success | BIP-322 signature verified |
sig_ | success | Legacy signmessage verified, any address |
sig_ | error | Signature does not match |
sig_ | error | BIP-322 full or proof-of-funds signature |
invalid_ | error | Not sent: the signature decides the scheme |
decode_ | error | Canonical message malformed |
invalid_ | error | Claimed ID doesn't match sha256(msg) |
bond_ | success | Chain lookup returned usable metrics |
bond_ | error | Address holds no confirmed UTXOs |
bond_ | info | Only unconfirmed UTXOs found |
bond_ | error | bond: extension exceeds confirmed balance |
bond_ | error | bond: value is not a valid integer |
below_ | error | Policy threshold — / only |
below_ | error | Policy threshold — / only |
stake_ | error | Address also backs another handle on the same protocol — / only |
aud_ | warn | Signed audience ≠ expected (challenge flow) |
expired | error | Signed expires passed or unreadable |
not_ | error | Signed issued_ ahead of the clock |
network_ | warn | Signature is on testnet/signet |
bad_ | error | Structural problem with request body |
HTTP status vs. status codeLink to this section
The HTTP status tells you the request was processable; the codes / reasons
fields tell you what the verification found. Don't conflate them.
| HTTP | Meaning |
|---|---|
| 200 | Request was valid and the verifier ran |
| 308 | / or / asked in another spelling: Location is its one URL |
| 400 | Request shape was wrong (missing addr, an address whose checksum fails, malformed JSON) |
| 401 | / session rejected |
| 403 | Cross-site POST to a browser-only endpoint |
| 404 | / subject not found |
| 429 | Rate limit exceeded |
| 500 | Verifier crashed — file a bug |
See alsoLink to this section
- Verification — what the server actually does with your request
- Sign in with Bitcoin —
session-aware auth flow built on
/api/challenge @orangecheck/sdk— the typed client for every endpoint here