Back to home

Chesly Docs

Build with the Chesly API — read messages, send messages, and manage your conversations programmatically.

Examples

Common recipes for the Chesly API. Replace csk_... with your real token and pick the language you prefer.

List your rooms

curl

curl https://api.chesly.app/api/rooms \
  -H "Authorization: Bearer csk_..."

JavaScript (Node 18+)

const res = await fetch('https://api.chesly.app/api/rooms', {
  headers: { Authorization: `Bearer ${process.env.CHESLY_TOKEN}` },
});
const { rooms } = await res.json();
console.log(rooms.map((r) => r.name));

Python

import os
import httpx

token = os.environ["CHESLY_TOKEN"]
res = httpx.get(
    "https://api.chesly.app/api/rooms",
    headers={"Authorization": f"Bearer {token}"},
)
res.raise_for_status()
print([r["name"] for r in res.json()["rooms"]])

Send a message

curl

curl https://api.chesly.app/api/rooms/$ROOM_ID/messages \
  -X POST \
  -H "Authorization: Bearer csk_..." \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello from the Chesly API"}'

JavaScript

await fetch(`https://api.chesly.app/api/rooms/${roomId}/messages`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHESLY_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ content: 'Hello from the Chesly API' }),
});

Handling errors

The Chesly API returns standard HTTP status codes. Common cases worth handling:

  • 401 Unauthorized — token is missing, malformed, or has been revoked.
  • 403 Forbidden with error: "subscription_expired" — your Chesly Plus subscription lapsed. Re-subscribe to reactivate all of your tokens.
  • 429 Too Many Requests — back off and retry; honor Retry-After.
  • 5xx — transient. Retry with exponential backoff and jitter.

Want more?

The complete list of endpoints lives in the API Reference.