API specification for custom implementations
Certain routes require authentication in the form of a JWT token in the Authorization header, or passed as an auth query parameter (should only be used in cases where using the header isn't possible). This token is provided by /api/auth/authorize.
Errors are sent as plaintext in a human readable format. Any response code in the range of >=400 and `<=500 is an error and should be treated as such.
A ratelimit of max 20 requests/10s per user is enforced on any route which requires authentication. If surpassed, you will get a 429 TOO MANY REQUESTS response code.
The format of the data Cloud Sync saves. Can be viewed here.
A custom base64 brotli compressed format of the data that's used for storage.
/api- 🟢
GET/api/bench/:test🔒- Requires user to be
env.ADMIN_USER_ID - A
testcan bewill-error-client,will-crash-serverorwill-timeout - Returns
400BAD REQUEST,500INTERNAL SERVER ERRORor204NO CONTENTon success - Returns
418I AM A TEAPOTon missing test
- Requires user to be
/api/auth- 🟢
GET/api/auth/authorize- Requires a
codequery parameter from the Discord OAuth2 api - Returns
200OKwith a signed JWT token used for authentication on success - Returns
400BAD REQUESTor500INTERNAL SERVER ERRORon an auth error
- Requires a
- 🟢
/api/data- 🟢
GET/api/data🔒- Returns
200OKwith the saved data (includes aLast-Modifiedheader) on success - Returns
500INTERNAL SERVER ERRORon an unknown server error
- Returns
- 🟠
PUT/api/data🔒- Requires an
application/jsonbody in the format of saved data - Returns
200OKwithtrueon success - Returns
400BAD REQUESTwith helpful zod error messages on invalid body - Returns
500INTERNAL SERVER ERRORon an unknown server error
- Requires an
- 🔴
DELETE/api/data🔒- Returns
200OKwithtrueon success - Returns
500INTERNAL SERVER ERRORon an unknown server error
- Returns
- 🟢
GET/api/data/raw🔒- Returns the raw compressed saved data
- Returns
200OKwithtrue(includesContent-DispositionandLast-Modifiedheaders) on success - Returns
204NO CONTENTon no content - Returns
500INTERNAL SERVER ERRORon unknown error
- 🟣
POST/api/data/decompress🔒- Turns compressed saved data in the
bodyinto normal saved data - Returns
200OKwith saved data on success - Returns
400BAD REQUESTon invalid body
- Turns compressed saved data in the
- 🟢
- 🟢