REST API description
One OpenAPI 3.1 file for the whole /api/v1 surface: openapi.json. It covers every route the server registers, and a check fails when the two disagree.
openapi.json — 80 paths, 122 operations, 320 KB of JSON.
Why a file and not a page
There are three backends, a Python SDK and a Roblox client against one contract. A description a tool can read is the contract: import it into Postman, Insomnia, Bruno, Stoplight or openapi-generator, or diff it between two servers to see what a build changed. Turning it into a browsable page here would mean shipping a renderer and loosening the CSP for it, and the file is more useful raw.
What is in it
- Every method and path under
/api/v1, with path and query parameters, their types and the limits protocol.md states. - Request bodies for the routes that parse one, and response bodies only where the server's own serialisation is unambiguous.
- The shared error shape
{error, message}with the status codes each route can answer. - Two security schemes:
bearerAuth(session access token,yap_API key oryapbot_token) andoperatorToken.
What is not
/gateway: a WebSocket carrying protobufFrames. That contract is protocol.md plusgateway.proto, and an OpenAPI file is the wrong shape for it./api/v10: the Discord-compatible mount. Partial by design; seedocs/discord-api.mdin the repository.- Exact
errorstrings. The schema guarantees the field; which string a given failure returns is in the handler, and the useful ones are called out in each operation's description. - Media upload limits enforced by the body reader are described in prose per route; the schemas mark those bodies as binary rather than enumerating byte counts as validation.
A session call needs two credentials
An access token on its own is inert. Every session-authenticated request also carries a proof header derived from the session's proof_key:
X-Yap-Proof: base64url(HMAC-SHA256(proof_key, "yap/v1/proof\0" + access_token))
API keys (yap_…) and bot tokens (yapbot_…) are credentials of their own and carry no proof. The description on each operation says which kinds it accepts. protocol.md has the whole model.
Three calls to try
Health
curl -sS https://api.getyap.dev/api/v1/health
# ok
Sign in
password is the login key, never the password: base64url(argon2id(password, salt)) with the salt from yap_proto::login_key. A wrong shape here is a 400, not a 401.
curl -sS https://api.getyap.dev/api/v1/auth/login \
-H 'content-type: application/json' \
-d '{"username":"you","password":"<login-key>","proof_key":"<43 base64url chars>"}'
# 200 {"access_token":"…","refresh_token":"…","expires_in":600,"user_id":"…","username":"you"}
An authenticated call
curl -sS https://api.getyap.dev/api/v1/me \
-H "authorization: Bearer $ACCESS" \
-H "x-yap-proof: $PROOF"
# 200 {"id":"…","username":"you","display_name":"","status":"","color":0}
An API key skips the proof entirely and is the easier way to script against your own account: create one in the developer portal, then -H "authorization: Bearer yap_…".
How it is kept honest
scripts/check-openapi.py reads the route table out of the server source (the router is spread over api.rs, audit.rs, moderation.rs, threads.rs, webhooks.rs, previews.rs and images.rs, which lib.rs merges) and fails if openapi.json is missing a route or still describes one that is gone:
python scripts/check-openapi.py
# covered 122/122 routes
It compares routes, not field-level accuracy: a renamed JSON field still has to be fixed by hand. The file and this page are the same commit, so the count above is a claim you can check.
Generated clients
Point a generator at the file and expect it to work for the plain-JSON routes. Two things need hand-holding: binary bodies (upload routes want raw bytes, not a JSON field) and NoContent answers. yapbot already wraps all of this in Python, including the gateway.
Updated . Part of the documentation index.