ClodHost beta
Sign In
❯ Free server for life during beta! ❯ Free server for life during beta!

ClodHost API

Build your own ClodHost app — chats, servers, billing, settings. Everything the website does, a user's token can do.

Building on a ClodHost server? Every server has its own key for domains, billing, email, text messages and the LLM API: see server keys.

Authentication (OAuth2 Device Flow)

Tokens are obtained with the OAuth2 Device Authorization Grant (RFC 8628). Register an app at /account/apps to get a client_id (public — no client secret).

POST https://clodhost.com/api/oauth/device
Content-Type: application/x-www-form-urlencoded

client_id=YOUR_CLIENT_ID
{
  "device_code": "a1b2c3...",
  "user_code": "ABCD-1234",
  "verification_uri": "https://clodhost.com/activate",
  "verification_uri_complete": "https://clodhost.com/activate?user_code=ABCD-1234",
  "expires_in": 900,
  "interval": 5
}

Direct the user to verification_uri (or open verification_uri_complete). They sign in with an emailed 6-digit code if needed, then approve or deny. Poll the token endpoint at interval seconds:

POST https://clodhost.com/api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=device_code&client_id=YOUR_CLIENT_ID&device_code=a1b2c3...

Responses: authorization_pending (keep polling), slow_down (add 5s to your interval), expired_token, access_denied, or on success:

{
  "access_token": "clodat_...",
  "token_type": "Bearer",
  "expires_in": 86400,
  "refresh_token": "clodrt_...",
  "scope": "all"
}

Call any API with Authorization: Bearer clodat_.... Access tokens last 24 hours. Refresh with grant_type=refresh_token&client_id=...&refresh_token=clodrt_... — refresh tokens rotate on every use and the old one becomes invalid; replaying a rotated refresh token revokes the entire token chain. Third-party refresh tokens expire after 90 days.

Official app: our first-party apps use client_id clod_official_app_v1 and skip the consent screen with non-expiring refresh tokens. If you're building the official mobile app, use that client_id and register your CORS origins with us.

Authentication with a server key

Code running on a ClodHost server (including the Claude on it) authenticates with that server's own key instead of the OAuth flow above. A server key is a bearer token like any other, but it only works for the server endpoints below and only for its own server.

Each server has these files:

FileContents
/etc/clodhost/api-keys.envRoot-only. CLODHOST_API_KEY, CLODHOST_API_BASE, CLODHOST_LLM_BASE_URL and, if the account has prepaid AI credit, its LLM keys (CLODHOST_LLM_KEY_CHEAP, CLODHOST_LLM_KEY_BEST). Kept up to date automatically when keys change.
/etc/clodhost/server.jsonThis server's id, subdomain, URL and web root.
/etc/claude-code/CLAUDE.mdTells Claude Code it's running on ClodHost and where to find all of the above.
source /etc/clodhost/api-keys.env
curl -H "Authorization: Bearer $CLODHOST_API_KEY" $CLODHOST_API_BASE/server-info
The key acts as the server's owner. Keep it on the server, in server-side code only. Never put it in a web page, browser JavaScript, a public repo or a chat message. If it leaks, contact support and we'll rotate it.
A server key only works for the endpoints in Server endpoints, and only for its own server. It stops working automatically if the server is deleted or changes owner. Requests and responses are JSON; POST bodies may be JSON or form-encoded. Every response has success and, on errors, message.

Request & response format

Standard JSON envelope:

{ "success": true, "message": "...", "data": { ... } }

Errors return {"success": false, "message": "..."} with an appropriate HTTP status code (401 unauthenticated, 403 no access, 404 missing, 429 rate limited). OAuth endpoints use RFC 6749 error shapes instead: {"error": "authorization_pending"}.

Chat endpoints

GET /api/chat-status?instance_id=N

Pollable status for a chat. Cheap (single DB read) — poll every 3-5s. Status is one of:

StatusMeaning
waitingClaude is done — a response is ready for the user
workingA message is pending and output is actively streaming
stalledClaude is waiting on the human — usually a multiple-choice question or a plan approval. Fetch it as structured data with /api/chat-question and answer it with /api/chat-answer (or subscribe to webhooks to hear about it the moment it opens). Unanswered questions are auto-answered with the default option after about 5–10 minutes.
stoppedThe chat instance is not active

The "done" notification your app wants is the transition from working/stalled to waiting.

GET /api/chat-responses?instance_id=N&after_id=K&limit=100

The clean conversation feed: human turns and Claude's readable responses only — no tool calls, file edits, or terminal noise. Tail with after_id (pass the previous data.after_id back). Each item: {type, role, text, ts, message_id, pending}. An assistant item with pending: true has empty text — keep polling until it fills or the status flips to waiting.

GET /api/chat-jsonl.php?instance_id=N&offset=K

Full detail transcript including tool calls and file edits, typed as {role, text, tools:[{name,summary}], ts} with incremental offset tailing. Use this for a collapsible "activity" view. Note this endpoint SSHes to the chat's server per request — don't poll it aggressively; poll chat-status and only fetch JSONL when new output exists.

GET /api/update-run-as-user?instance_id=N&user=NAME

Run this chat's Claude Code process as an ordinary Linux user instead of root. ClodHost still starts and controls the chat as root (SSH, tmux, restarts, the keys file), but the claude process inside it runs as NAME with that user's own home folder, Claude Code install and sign-in, so it can only touch what that user can. The user must already exist on the server (useradd -m NAME); the call checks that over SSH and returns 400 if it is missing or is root. Pass an empty user to go back to root. The change applies on the chat's next restart (/api/restart-chat?instance_id=N). Claude Code only; the current value is returned by /api/get-instance-details as run_as_user.

{ "success": true, "data": { "instance_id": 123, "run_as_user": "lane1", "home": "/home/lane1", "previous": null, "restart_required": true } }

Sending a message

One call sends a message: POST /api/claude-command. It records the message in the chat's history and hands it to Claude. The response includes message_id, which you can pass to /api/chat-responses and /api/cancel-message. (POST /api/save-message.php is no longer needed; it still answers with success so older clients keep working.)

POST /api/claude-command — JSON body:

{
  "server_id":    123,           // server the chat lives on
  "instance_id":  456,           // chat/instance id (from /api/get-chat-sessions)
  "command":      "your message"
}

Always send server_id and instance_id. To stop a turn that is running, call POST /api/cancel-message (below).

Raw streaming output is available via short-poll at GET /api/claude-output?instance_id=N&last_hash=H (returns unchanged: true when nothing new).

POST /api/cancel-message

Clears a chat's pending message, so a message that was saved but never ran stops showing the chat as working. JSON body: { "instance_id": 456 }, plus an optional "message_id" to cancel only if that message is still the pending one. It does not interrupt Claude if a turn is really running; to do that, send Escape with POST /api/claude-command and "special_key": { "modifier": "Escape" }.

{ "success": true, "data": { "instance_id": 456, "cancelled_message_id": 148885, "pending_message_id": null, "status": "waiting" } }

cancelled_message_id is null when there was nothing to cancel.

Chat status values

The status field on each row of /api/get-chat-sessions and the status from /api/chat-status use the same rules and the same values: waiting (idle, ready for a message), working (a message is pending), stalled (Claude needs input) and stopped (chat-status only).

App chat endpoints (what clodhost.com/chat itself uses)

These are the endpoints behind the chat page, and the best choice for a full chat client. They work with a Bearer token. A server can have any number of chats. Each chat has a val, the number in clodhost.com/chat/<val>, and an internal chat id that the conversation endpoints take. Get the id from agent-chat-meta.

GET /api/agent-servers.php

The account's servers in sidebar order. Each has server_id, server (name), color (hex), domain, domains (custom domains first), count (chats), last_chat (the most recent chat's val, 0 if none), asleep, owned, shared_from, shared_with and status (asking, working, working unread, unread or read).

GET /api/agent-chat-list.php?server=ID&offset=0&limit=30

One server's chats, newest first: items (each with val, name, server_id, color, share), offset for the next page and has_more.

GET /api/agent-chat-meta.php?chat=VAL

Opens a chat by its val and returns chat: id, name, mode, instance_id, server_id, can_edit, can_delete, share; plus server_name and domain.

GET /api/agent-chat.php?chat=ID&since=EVENT_ID

The conversation feed. Poll it about once a second while a chat is open, passing the highest event id you have seen. Returns events, each {id, kind, at, data}, and the live chat state. Calling it also marks the chat as read.

kinddata
usertext: a message someone sent
texttext: something Claude said (markdown)
steptool, summary: progress, already reflected in the chat state
resultEnd of a turn: subtype, is_error, ms
suggestiontext: a suggested next message
notice / errortext / message to show inline

chat has state (idle, running or requires_action), turn_seconds, tool and step (what Claude is doing now), bg_tasks, question (see below) and agent_online. When agent_online is false, GET /api/agent-setup-status.php?chat=ID says why: state is asleep (wake it with /api/restore-suspended-server.php?server_id=N) or working with pct and phase.

POST /api/agent-chat.php

{ "action": "send", "chat": ID, "text": "..." }           -> { "success": true, "event_id": 123, "chat_id": ID }
{ "action": "send", "server": SERVER_ID, "text": "..." }  starts a new chat on that server
{ "action": "stop", "chat": ID }
{ "action": "delete", "chat": ID }
{ "action": "answer", "chat": ID, "request_id": "...", "answers": { "Question text": "Chosen label" } }
{ "action": "answer", "chat": ID, "request_id": "...", "decision": "approve" | "revise" | "reject", "feedback": "..." }

A pending question has request_id and tool. For ExitPlanMode it carries plan (markdown) and takes a decision. Otherwise it carries questions, each with question, multiSelect and options (label, description); answer with one label per question, or several labels joined with a comma and a space for multi-select. Sending to an asleep server returns HTTP 409.

Other chat calls

GET /api/agent-history.php?chat=ID returns earlier messages (role, text, at) from before the chat moved to this system; the first call for a chat can take a while. GET /api/agent-summary.php?chat=VAL returns a two-word summary for lists. GET /api/agent-server-status.php?chats=VAL,VAL&open=VAL returns servers (status per server id) and chats (state, unread, bg per val); poll it every few seconds for the list. POST /api/agent-upload.php (multipart: chat, file, file_name) puts a file on the chat's server and returns its path. For files over 4 MB send 4 MB pieces in order, adding chunk_index, total_chunks, upload_id, total_size and chunk_offset to each.

Push notifications (iOS)

Register a device and ClodHost sends an Apple push when one of the account's chats finishes a turn that a person started, or when Claude stops to ask a question, wait for plan approval or otherwise needs input.

POST /api/devices

{ "device_token": "a1b2c3...", "platform": "ios", "environment": "sandbox", "bundle_id": "com.clodhost.ClodHost" }

device_token is the hex APNs token. environment is sandbox for Xcode builds and production for TestFlight and App Store builds. Registering the same token again updates it. The response includes push_enabled, which is false until ClodHost's Apple push key is configured.

DELETE /api/devices

Body { "device_token": "a1b2c3..." }. Call it on sign-out.

GET /api/devices

Lists the account's registered devices with the last delivery error, if any.

The notification's title is the chat name and its body is the start of Claude's reply (or what Claude is asking). The payload also carries "clodhost": { "event": "finished" | "needs_input", "chat": 456, "instance_id": 456, "server_id": 123 } so a tap can open the right chat.

Questions & plan approvals

When Claude asks a multiple-choice question (Claude Code's AskUserQuestion) or finishes a plan and asks for approval (ExitPlanMode), the chat pauses until someone answers. ClodHost captures these deterministically from Claude Code itself (not by reading the terminal), so your app can show a native UI instead of the terminal's arrow-key menu. If nobody answers within roughly 5–10 minutes, ClodHost picks the default (first option / approve) automatically.

GET /api/chat-question?instance_id=N

Returns what the chat is waiting on, or "waiting": false.

{
  "success": true,
  "data": {
    "instance_id": 456,
    "waiting": true,
    "pending": {
      "kind": "question",                       // or "plan"
      "tool_use_id": "call_00_ET_…",            // identifies this exact question
      "since": "2026-10-16 22:22:16",
      "questions": [
        { "index": 0, "header": "Color", "question": "Which color?", "multi_select": false, "allows_text": true,
          "options": [ {"index": 0, "label": "Red",  "description": "…"},
                       {"index": 1, "label": "Blue", "description": "…"} ] },
        { "index": 1, "header": "Toppings", "question": "Which toppings?", "multi_select": true, "allows_text": true,
          "options": [ … ] }
      ]
    }
  }
}

For a plan approval, pending looks like:

{
  "kind": "plan",
  "tool_use_id": "call_00_ET_…",
  "since": "2026-10-16 22:25:39",
  "plan": { "text": "…markdown plan…", "file_path": "/root/.claude/plans/….md" },
  "decisions": [
    {"key": "approve",        "label": "Yes, start (no further prompts)"},
    {"key": "approve_manual", "label": "Yes, but manually approve edits"},
    {"key": "reject",         "label": "Tell Claude what to change", "requires": "feedback"}
  ]
}

Chats on servers that haven't received the latest hooks yet may return a reduced question with "partial": true (single question, labels only).

POST /api/chat-answer

Submits the answer. ClodHost drives the menu inside the chat for you and checks the result. Answering a question — one entry per question, using the option index values from chat-question:

{
  "instance_id": 456,
  "tool_use_id": "call_00_ET_…",          // optional: rejects the call (409) if a different question is now open
  "answers": [
    { "question_index": 0, "selected": [1] },                       // single-select: exactly one index…
    { "question_index": 1, "selected": [0, 2], "text": "Pineapple" } // multi-select: any indexes, plus optional free text
  ]
}

For a single-select question send either one index in selected or a free-text text answer (the "Type something" option). Approving or rejecting a plan:

{ "instance_id": 456, "decision": "approve" }
{ "instance_id": 456, "decision": "approve_manual" }
{ "instance_id": 456, "decision": "reject", "feedback": "Use the touch command instead" }

Returns {"success": true} once the answer is in (typically 5–20 seconds). Errors: 409 nothing is waiting (or tool_use_id no longer matches), 400 malformed answer, 422 the chat didn't accept it (the response includes what was on screen). Requires permission to send messages to the chat.

GET /api/chat-events?after_id=K&instance_id=N&limit=50

A polling alternative to webhooks: every question.opened, question.answered, plan.opened and plan.answered event for your chats (or one chat with instance_id), oldest first. Pass the returned data.after_id back to tail. Each event has the same shape as a webhook body (below).

Webhooks

Register an HTTPS endpoint and ClodHost will POST to it the moment a question or plan approval opens or is answered in any chat on your servers — use it to push a notification to the user.

Managing webhooks

POST   /api/webhooks   {"url": "https://example.com/clodhost-hook", "events": ["question.opened", "plan.opened"], "description": "my app"}
GET    /api/webhooks                       // list (with the 5 most recent deliveries each)
DELETE /api/webhooks?id=7
POST   /api/webhooks   {"action": "test", "id": 7}   // sends a "ping" event

events is optional (default: all four). The create response includes a secret (whsec_…) used to sign deliveries. URLs must be public https:// addresses. Up to 10 webhooks per account.

Delivery format

POST https://example.com/clodhost-hook
Content-Type: application/json
X-ClodHost-Event: question.opened
X-ClodHost-Delivery: 1234
X-ClodHost-Signature: sha256=<hex HMAC-SHA256 of the raw body, keyed with your secret>

{
  "id": 42,
  "event": "question.opened",
  "created_at": "2026-10-16T22:22:16+00:00",
  "chat": { "instance_id": 456, "server_id": 123, "name": "My chat", "url": "https://clodhost.com/chat/456" },
  "data": { …same object as chat-question's "pending"… }
}

Answered events carry what was chosen, whoever answered (your app, the website, or the auto-answer):

question.answered → "data": { "tool_use_id": "…", "answers": {"Which color?": "Green", "Which toppings?": "Cheese, Basil, Pineapple"}, "cancelled": false }
plan.answered     → "data": { "tool_use_id": "…", "decision": "approved" | "rejected", "feedback": "…" | null }

Respond with any 2xx within 8 seconds. Failed deliveries are retried with backoff (up to 6 attempts over about an hour). Verify the signature before trusting a delivery, e.g. in PHP: hash_equals('sha256=' . hash_hmac('sha256', $rawBody, $secret), $_SERVER['HTTP_X_CLODHOST_SIGNATURE']). Use tool_use_id to de-duplicate.

Server endpoints

Callable with a server key, or with an app token plus a server_id parameter for the server endpoints. They accept bearer tokens only, not browser sessions. POST bodies may be JSON or form-encoded (the support endpoint takes JSON).

Server

GET /api/server-info

This server's details.

{
  "success": true,
  "server": {
    "id": 2229, "subdomain": "myapp", "url": "https://myapp.clodhost.com",
    "size": "S", "status": "active", "billing": "free", "team": null,
    "custom_domains": [{"domain": "myapp.com", "status": "active"}],
    "created_at": "2026-09-19 17:25:45"
  },
  "links": {"chat": "...", "manage_servers": "...", "account": "...", "support": "..."}
}

GET /api/server-ipv4

Whether this server has its own public IPv4 address, and the state of the paid IPv4 add-on. Every server has a public IPv6 address. Servers without their own IPv4 reach IPv4 through a shared address and accept SSH over IPv6, or from IPv4-only networks on the port shown in /etc/clodhost/server.json.

{"success": true, "has_own_ipv4": false, "ipv4": null, "addon": null, "price": "$2/month", "card_on_file": true}

POST /api/server-ipv4

Adds a dedicated IPv4 address to this server for $5/month, charged to the card on file. Without confirm=1 it only describes the charge, so ask the customer first. If no card is saved the response has needs_card and a link to give the customer. The address is usually assigned within a few minutes.

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" -d confirm=1 $CLODHOST_API_BASE/server-ipv4

DELETE /api/server-ipv4

Removes the add-on and stops its billing. The server keeps its IPv6 address.

Custom domains

GET /api/domains

Lists custom domains on this server with their status and the nameservers the customer must set at their registrar.

POST /api/domains

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" \
     -d domain=mysite.com $CLODHOST_API_BASE/domains

Adds the domain to ClodHost's Cloudflare account and configures DNS, SSL and Apache for this server. The domain must be registered and not on another ClodHost account. The response includes the nameservers; the customer changes their domain's nameservers to those at their registrar (that step can't be done for them). Check progress with GET /api/domains.

DELETE /api/domains?domain=mysite.com

Removes a custom domain from this server. (Or POST with action=remove.)

GET|POST /api/manage-dns

curl -H "Authorization: Bearer $CLODHOST_API_KEY" \
     "$CLODHOST_API_BASE/manage-dns?action=list&domain=mysite.com"

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" \
     -d action=create -d domain=mysite.com -d type=A -d name=app \
     -d content=203.0.113.10 -d proxied=0 $CLODHOST_API_BASE/manage-dns

Lists and edits the DNS records of a custom domain on this account, the same records as the DNS manager on the Domains page. Identify the domain with domain (or domain_id, the id from GET /api/domains). action=create takes type (A, AAAA, CNAME, MX, TXT, SRV…), name, content, and optionally ttl, priority (MX/SRV) and proxied (A/AAAA/CNAME: 1 through Cloudflare, 0 DNS-only, the default). action=update takes the same fields plus record_id from the list; action=delete takes record_id. Use DNS-only when the target handles its own TLS (e.g. Let's Encrypt HTTP-01 on another machine). Don't change the records ClodHost created for the site and email unless you mean to move them.

Billing

GET /api/billing

Read-only: whether a card is on file, the prepaid AI credit balance, and each of the owner's servers with its size and billing status (free, paid subscription or past due), plus links where the customer can make changes. This API never charges a card; anything that costs money is done by the customer through those links.

LLM API

GET /api/llm-keys

The LLM endpoint base URL (https://proxy.clodhost.com/v1, OpenAI /chat/completions and Anthropic /v1/messages compatible), the available model tiers and the account's keys. Keys exist only while the account has prepaid AI credit; usage is billed from that balance. Customers buy credit and create or rotate keys on their account page.

source /etc/clodhost/api-keys.env
curl $CLODHOST_LLM_BASE_URL/chat/completions \
  -H "Authorization: Bearer $CLODHOST_LLM_KEY_CHEAP" -H "Content-Type: application/json" \
  -d '{"model": "any", "messages": [{"role": "user", "content": "Hello"}]}'

Sending email

POST /api/send-email

Field
toRequired. One email address.
subjectRequired. One line, up to 200 characters.
text / htmlAt least one. Send both for the best deliverability. 200 KB max.
fromOptional sender address on one of your servers' subdomains, e.g. [email protected] (any name before the @). Defaults to [email protected]. Your own domain works once it's on your account and verified for sending (below). Any other domain is refused with HTTP 403 and a message saying why.
from_nameOptional sender name, e.g. your app's name.
reply_toOptional: where replies should go. If you leave it out, replies come back to your from address and arrive through Receiving email.
curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" -H "Content-Type: application/json" \
  -d '{"to": "[email protected]", "subject": "Your order is confirmed",
       "text": "Thanks for your order!", "from_name": "My Shop", "reply_to": "[email protected]"}' \
  $CLODHOST_API_BASE/send-email

Mail is sent through ClodHost's email service (Amazon SES), signed for clodhost.com.

API keys

GET /api/api-keys lists the account's keys: the LLM keys (one per tier, with the model, AI credit balance and whether keys are active) and every server's key (prefix, created, last used, and when it reached the server). Works with a server key, an app token, or a signed-in session.

POST action=
create_llm_key + tierCreates an LLM key for the tier (cheap or best), or returns the existing one. Needs prepaid AI credit (HTTP 402 otherwise).
rotate_llm_key + tierReplaces the tier's key; the old one stops working within a few minutes.
revoke_llm_key + tierTurns the tier's key off.
rotate_server_key + server_idIssues a new server key and returns it once; the old key stops working immediately. A server key can only rotate its own key (server_id optional).

LLM key changes are copied into every server's /etc/clodhost/api-keys.env automatically, and a rotated server key replaces the one on that server within a minute (once it's awake).

Receiving email

Mail sent to any address at your server's subdomain ([email protected]), or at a custom domain with receiving turned on (below), arrives at ClodHost and is kept for 7 days. So replies to email your app sends from [email protected] come back to you. Get them either way:

Webhook (recommended). Set a URL on your server and we POST each email to it as it arrives (retried for 24 hours if your server doesn't answer 2xx):

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" \
  -d action=set_webhook -d webhook_url=https://SUBDOMAIN.clodhost.com/inbound-email \
  $CLODHOST_API_BASE/inbound-email

The URL must be https and on this server (its subdomain or one of its custom domains). Each POST is JSON {"event": "email.received", "email": {...}} with id, to, from, from_header, cc, subject, date, message_id, in_reply_to, references, text, html, attachments[] (each attachment has filename, content_type, size, content_base64). Verify it came from ClodHost: the X-ClodHost-Signature header is sha256= + HMAC-SHA256 of the raw request body, keyed with your CLODHOST_API_KEY.

$expected = 'sha256=' . hash_hmac('sha256', file_get_contents('php://input'), getenv('CLODHOST_API_KEY'));
if (!hash_equals($expected, $_SERVER['HTTP_X_CLODHOST_SIGNATURE'] ?? '')) { http_response_code(401); exit; }

Polling. GET /api/inbound-email lists recent emails (newest first, or oldest-first after since_id); GET /api/inbound-email?id=N returns one in full (add raw=1 for the original message); DELETE /api/inbound-email?id=N deletes it; POST action=redeliver id=N re-sends it to your webhook; GET ?action=settings shows your webhook and receiving addresses. Up to 300 incoming emails per account per day; messages over 15 MB are rejected.

Email on your own domain

For a custom domain already on your server (see Custom domains):

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" -d domain=mysite.com -d receive=1 $CLODHOST_API_BASE/email-domains

receive=1 routes mail for *@mysite.com to this server, the same way as above. If the domain already receives mail somewhere else (Google Workspace, Outlook…), the API refuses and lists the current mail servers, because switching would stop delivery to those inboxes; repeat with confirm=1 only if that's intended. receive=0 turns it off. send=1 verifies the domain for sending so you can use [email protected] with /api/send-email; the DNS records are added automatically and verification usually takes a few minutes. GET /api/email-domains shows each domain's receiving and sending status.

Forwarding email

Forward mail for an address at your subdomain or custom domain to any outside inbox (Gmail, Outlook…), with no app code needed:

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" \
  -d [email protected] -d [email protected] \
  $CLODHOST_API_BASE/email-forwards

address is one address ([email protected]) or *@mysite.com for every address on the domain without its own forward. It can be on this server's .clodhost.com subdomain or on a custom domain on this server; receiving is turned on for the custom domain automatically, and if the domain already gets mail elsewhere the request is refused until you repeat it with confirm=1 (same rule as above). The first time you forward to an address, Cloudflare emails it a verification link; forwarding starts as soon as it's clicked (status goes from awaiting_verification to active). Forwarded mail is still kept and sent to your webhook as usual, and counts toward the 300-per-day receiving limit. GET /api/email-forwards lists forwards; DELETE /api/email-forwards?id=N (or POST action=delete id=N) removes one. Up to 5 destinations per address and 5 different destination inboxes per account; destinations can't be on clodhost.com or on a domain whose mail ClodHost receives.

Sending text messages

POST /api/send-sms

to (a US or Canada mobile number, any common format) and body (up to 1,000 characters). Sent from ClodHost's number; recipients can reply STOP to opt out.

curl -X POST -H "Authorization: Bearer $CLODHOST_API_KEY" \
  -d to=3105550123 -d body="Your appointment is tomorrow at 3pm." $CLODHOST_API_BASE/send-sms

Limits

WhatLimit
Email100 per account per rolling 24 hours (all servers combined)
Text messages100 per account per rolling 24 hours; US and Canada only

Over the limit, the API returns HTTP 429. Email and texts are for transactional messages your app sends to its own users (confirmations, receipts, alerts, password resets), never marketing, bulk or unsolicited messages. Abuse gets the account's sending turned off. Need more? Ask us.

Support

POST /api/submit-support-request

JSON {"message": "..."} (at least 10 characters) is sent to ClodHost support from the owner's account. Replies appear at clodhost.com/support.

Everything else

Nearly every /api/* endpoint the website's own JavaScript uses accepts Bearer tokens — list chats (/api/get-chat-sessions), servers, billing (/api/stripe/credit-status), settings, shares, and so on. Browse /openapi.json for the curated subset, or treat the site as documentation: open DevTools on any page and see what it calls.

Rate limits

EndpointLimit
/api/oauth/device10/hour per IP, 120/hour per client
/api/oauth/signup10/hour per IP
/activate approvals20/hour per IP, 30/hour per session
Token pollingGoverned by RFC 8628 interval / slow_down

General API endpoints: poll like the website does (chat output short-poll every ~2s, status every 3-5s) and you'll be fine.

CORS (browser apps)

Register your origins on your app at /account/apps (https:// only). Registered origins get CORS headers on the OAuth endpoints and on Bearer-authenticated calls made from your app's origin. There are no wildcards. Native/mobile apps don't need CORS at all.

Not available via API

Admin endpoints, webhooks, incoming-email/ingest receivers, and channel-pairing bridges never accept Bearer tokens. There is no admin scope — a token is exactly the user, no more.

Account signup from your app

First-party apps can create accounts: POST /api/oauth/signup with {client_id, email, user_code}. The user receives a 6-digit sign-in code by email and enters it at /activate?user_code=... to finish authorization. The response is always success to avoid account-existence probing. Third-party apps cannot sign users up — direct them to clodhost.com first.