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 Success response (Possible errors:
/api/register. The reCAPTCHA token must come from a reCAPTCHA v2 widget rendered in a browser — you cannot generate it server-side.200):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 (The
200) when email is linked: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 Success response (The session cookie is
/api/login. On success, Clody sets your session cookie.200):HttpOnly and Secure, with a 30-day lifetime. Pass -b cookies.txt -c cookies.txt to every subsequent curl request to reuse it automatically.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 Success response (Note the
ispm to true for a DM, or false for a named group.200):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 Success response (All Branch members receive a
branch field is the Branch id from the previous step. The content field supports up to 5,000 characters.200):new_bmessage Socket.IO event carrying this same payload in real time.Email verification note
After registering, your account’sverified 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:
- Call
POST /api/verification/set_emailwith{"email": "you@example.com"}. - Check your inbox for the 4-digit code.
- Confirm with
POST /api/verificationwith{"code": "XXXX"}.
Tips and common gotchas
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.