Skip to main content
Clody uses server-side session cookies to authenticate every request. When you log in successfully, the server sets an HttpOnly, Secure, SameSite=Lax cookie in your browser that is valid for 30 days. You don’t manage tokens manually — the cookie is sent automatically with every request. On top of standard authentication, Clody requires all accounts to have a verified email address before accessing most API routes.

Registration

Create a new account by sending your desired username, a password, and a Google reCAPTCHA v2 token. The reCAPTCHA token must be obtained from a reCAPTCHA v2 widget rendered in a real browser — it cannot be generated programmatically. POST /api/register
string
required
Your chosen username. Must be unique across all Clody accounts.
string
required
Your account password.
string
required
A Google reCAPTCHA v2 response token obtained from a browser widget. Clody verifies this against Google’s API to confirm you’re not a bot.
Responses:
string
"Success" on a successful registration. The session cookie is set immediately.
After registration your account is in an unverified state. You must link and verify an email address before most other API routes will accept your requests. See Email Verification below.

Login

Clody uses a two-step login flow to protect your account. Step 1 validates your credentials and dispatches a one-time code to your registered email. Step 2 exchanges that code for a live session.

Step 1 — Request a login code

POST /api/verification/login
string
required
Your Clody username.
string
required
Your account password.
Success response (200) — email code sent:
string
A partially masked version of your registered email address, so you know where to look.
number
Seconds until the code expires (always 600 — 10 minutes).
Success response (200) — no email linked yet:
If your account has no email address linked, Clody signs you in directly and sets the session cookie. You must then add and verify an email via the Email Verification flow before accessing protected routes.

Step 2 — Confirm the code

After receiving the 4-digit code in your email, submit it with your username to complete login. The session cookie is set on success. POST /api/login
string
required
Your Clody username — must match what you used in Step 1.
string
required
The 4-digit code from the login email you received.
Success response (200):
The Set-Cookie header in the response contains your session cookie (HttpOnly, Secure, SameSite=Lax, 30-day lifetime). Browsers apply it automatically.
You have a maximum of 5 attempts to enter the correct code. After 5 failures the code is invalidated and you must request a new one from Step 1. A 60-second cooldown applies between code requests.

Email verification

Every Clody account must have a verified email address. New accounts and accounts created before email verification was introduced start in an unverified state. Complete the following two-step process to link your email.

Step 1 — Submit your email address

POST /api/verification/set_email
string
required
The email address you want to link to your account. Must be a valid email format and not already linked to another Clody account. Maximum 254 characters.
Success response (200):
string
The email address Clody will send the verification code to.
number
Seconds until the code expires (600 — 10 minutes).

Step 2 — Confirm the verification code

POST /api/verification
string
required
The 4-digit code that was emailed to the address you submitted in Step 1.
Success response (200):
On success, your email is stored and your account becomes fully verified. All existing sessions are invalidated — you must log in again on any other devices.
Code limits: Each verification code expires after 10 minutes, allows a maximum of 5 entry attempts, and has a 60-second cooldown before you can request a new one.

Session management

Check session status

Use this endpoint any time you need to know whether the current cookie is still valid — for example, on page load before deciding where to redirect the user. GET /api/session
Response (always 200):
boolean
true if the session cookie maps to a valid, active account.
boolean
true if the account has a linked, verified email address. Most API routes require this to be true.
string
Your account username. Only present when authenticated is true.
This endpoint always returns HTTP 200. An authenticated: false response is a normal state, not an error. Your client should check the authenticated field in the body rather than the HTTP status code.
Cookie properties: Most protected routes require both authenticated: true and verified: true. Accounts with an unverified email will receive 400 "Not Authorized" from those routes even if they hold a valid cookie.

Logout

Log out of the current session

Clear only the session on the current device. POST /api/logout
Response (200):

Log out of all devices

Invalidate every active session across all devices at once. Any device still using an old session cookie will receive authenticated: false from /api/session. POST /api/settings/logout_all_devices
Response (200):
All connected Socket.IO clients also receive a logout event immediately, so active browser sessions are kicked in real time.

Error reference

The following status codes appear across all authentication and session-related endpoints.