Skip to main content
Clody uses session cookie authentication — there are no API keys. When you register or log in, the server sets an HttpOnly, Secure, SameSite=Lax cookie that lasts 30 days. You include that cookie automatically with every subsequent request. Most endpoints require both a valid session and a verified email address; if you haven’t linked an email yet, those routes return 400 Not Authorized until you complete the email verification flow.

POST /api/register

Creates a new account and immediately sets a session cookie, logging you in.
The username value clody (case-insensitive) is reserved for the system user and cannot be registered.
This endpoint is rate-limited to 5 requests per minute (burst cap of 3). Exceeding the limit returns 429.

Request body

string
required
Your desired username. Must be non-empty after trimming whitespace.
string
required
Your account password. Must be non-empty.
string
required
A reCAPTCHA v2 response token obtained from the Google reCAPTCHA widget on the registration page.

Response

200 OK"Success". A session cookie is set on the response; your client is now logged in.

Error codes


POST /api/verification/login

Validates your username and password, then sends a one-time login code to the email address linked to your account. You pass that code to POST /api/login to complete sign-in.
If your account has no linked email, credentials are accepted immediately and the server returns {"logged_in": true, "needs_email": true} with a session cookie already set. You should then call POST /api/verification/set_email to link one.
Once a code has been sent for a given account, you must wait 60 seconds before requesting a new one. Calling again before the cooldown expires returns 429 with the remaining wait time.

Request body

string
required
The username of the account you want to log in to.
string
required
The account password.

Response

200 OK — one of two shapes: Account has a linked email — code sent, awaiting POST /api/login:
string
A masked version of the destination address, e.g. a**@example.com. Use this to remind the user which inbox to check.
number
Seconds until the code expires. Always 600 (10 minutes).
Account has no linked email — session set immediately:

Error codes


POST /api/login

Completes the login flow by exchanging the one-time code that was emailed to you for a session cookie.
This endpoint is rate-limited to 10 requests per minute (burst cap of 5). After 5 failed code attempts for the same username the pending code is invalidated and you must restart from POST /api/verification/login.

Request body

string
required
The same username you passed to POST /api/verification/login.
string
required
The 4-digit code from the login email, e.g. "0391".

Response

200 OK"Success". A session cookie is set and you are now logged in.

Error codes


GET /api/session

Returns the current authentication state for the cookie your client sends. This endpoint always returns 200 — a missing or invalid session is represented as data, not as an HTTP error, so you can safely call it on every page load without treating a 4xx as a failure.

Response

boolean
true if the request carries a valid, unexpired session cookie; false otherwise.
boolean
true if the authenticated account has a confirmed email address. Many API endpoints require verified: true.
string
Present only when authenticated is true. The username of the logged-in account.
Unauthenticated response:

POST /api/verification/set_email

Begins the email verification flow by sending a 4-digit confirmation code to the address you supply. Pass the code to POST /api/verification to confirm.
You must be logged in to call this endpoint. Accounts that already have a verified email address cannot change it — the response will be 403 "Email is linked".
A 60-second resend cooldown applies. If you call this endpoint again before the cooldown expires, you receive 429 with the remaining wait time. Codes expire after 10 minutes and you get at most 5 attempts to enter each code before it is discarded.
This endpoint is rate-limited to 5 requests per minute (burst cap of 3).

Request body

string
required
A valid email address (max 254 characters). Must not already be linked to another Clody account.

Response

200 OK:
string
The normalised (lowercased, trimmed) email address the code was sent to.
number
Seconds until the code expires. Always 600 (10 minutes).

Error codes


POST /api/verification

Confirms your email address by submitting the code that was sent via POST /api/verification/set_email.

Request body

string
required
The 4-digit code from the verification email, e.g. "7142".

Response

200 OK"Success". Your email is now confirmed and GET /api/session will return verified: true.
Confirming your email invalidates all other active sessions for your account (a new login_at timestamp is issued). Your current session remains valid.

Error codes


POST /api/logout

Clears your current session. The session cookie remains on the client but the server-side record is invalidated.

Response

200 OK"Success".
This endpoint only ends the current session. To invalidate every active session across all your devices at once, use POST /api/settings/logout_all_devices instead.

POST /api/settings/logout_all_devices

Invalidates all active sessions for your account simultaneously. Every device that holds a session cookie for your account is logged out and receives a logout Socket.IO event.
You must be logged in with a verified email to call this endpoint.

Response

200 OK"Success". All sessions — including the one used to make this request — are immediately invalidated. Re-authenticate via the normal login flow to continue using the API.

Error codes