Skip to main content
This guide walks you through everything you need to get up and running with Clody: creating an account, logging in with email verification, checking your session, creating a Branch, and sending your first message. By the end you’ll have a working session cookie and a message in a chat.
All examples use curl. Replace https://your-clody-server with the base URL of the Clody instance you’re working with. Persist your cookies across requests with --cookie-jar cookies.txt --cookie cookies.txt.
1

Register an account

Create your Clody account by posting your chosen username, a password, and a Google reCAPTCHA v2 token to /api/register. The reCAPTCHA token must come from a reCAPTCHA v2 widget rendered in a browser — you cannot generate it server-side.
Success response (200):
Possible errors:After a successful registration, Clody sets a session cookie and logs you in immediately. Your account starts in an unverified state — you must link and verify an email address before most other endpoints become available.
2

Request a login code

On subsequent logins, Clody uses a two-step email-code flow. First, submit your username and password. Clody validates your credentials and sends a 4-digit code to your verified email address.
Success response (200) when email is linked:
The email_hint is a partially masked version of your email so you know where to look. The code expires in 600 seconds (10 minutes). If you haven’t linked an email yet, the response is {"logged_in": true, "needs_email": true} and you’re signed in directly — go to Step 4 and then link your email via the verification flow.
3

Confirm the code and get your session cookie

Check your inbox for the 4-digit code Clody sent you, then submit it along with your username to /api/login. On success, Clody sets your session cookie.
Success response (200):
The session cookie is HttpOnly and Secure, with a 30-day lifetime. Pass -b cookies.txt -c cookies.txt to every subsequent curl request to reuse 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. There is a 60-second cooldown between code requests.
4

Check your session

Verify that your cookie is valid and your account is fully verified before making other API calls.
Response:
If verified is false, complete the email-verification flow described in the Authentication guide before proceeding.
5

Create a Branch

Branches are private chats. You can create a direct message (DM) or a group chat with any of your friends. Set ispm to true for a DM, or false for a named group.
Success response (200):
Note the id field — you’ll use it as the branch value when sending messages. All listed members must already be on your friends list; otherwise the request returns 403 "Anybody isn't friend".
6

Send a message

Post a message to the Branch you just created. The branch field is the Branch id from the previous step. The content field supports up to 5,000 characters.
Success response (200):
All Branch members receive a new_bmessage Socket.IO event carrying this same payload in real time.

Email verification note

After registering, your account’s verified status is false until you link an email address. Almost every API route checks for a verified session and returns 400 "Not Authorized" if you haven’t completed verification. To link your email:
  1. Call POST /api/verification/set_email with {"email": "you@example.com"}.
  2. Check your inbox for the 4-digit code.
  3. Confirm with POST /api/verification with {"code": "XXXX"}.
See the full Authentication guide for details.

Tips and common gotchas

Always save your cookies between requests. In curl, use both -b cookies.txt (read) and -c cookies.txt (write) so your session persists across commands.
The reCAPTCHA token for /api/register can only be generated from a browser-rendered reCAPTCHA v2 widget. It is single-use and expires quickly — generate it immediately before calling the endpoint.
You cannot create a Branch with users who are not on your friends list. Make sure you’ve sent and received a friend request before calling /api/branch/create.
All POST endpoints expect Content-Type: application/json. Sending form-encoded data will result in a 400 Bad Request. The only exception is file upload endpoints, which use multipart/form-data.