Cloud9 API

Everything you change in the portal you can change from code. JSON over HTTPS, one key per job, and the same plan limits as the portal.

Start in three steps

  1. Sign in to the portal and open "API keys".
  2. Create a key with only the permissions your tool needs; limit it to some domains, allowed IP addresses and an expiry date if you like. The key is shown once.
  3. Send it as a Bearer token. The first call lists the domains the key may use.
export KEY=oscust_...
curl -H "Authorization: Bearer $KEY" https://my.cloud9.ir/api/customer/v1/domains
The API keys page of the Cloud9 portal with two keys and their permissions

Create an API key

Keys and authentication

Customer keys start with oscust_, are stored hashed and are shown only once. Send the key in the Authorization header as a Bearer token, or in X-Api-Key.

Only HTTPS is accepted. A key can carry its own list of allowed IP addresses and an expiry of 7, 30, 90, 180 or 365 days; a suspended account cannot use its keys.

Authorization: Bearer oscust_...
X-Api-Key: oscust_...

Base address: https://my.cloud9.ir/api/customer/v1

Permissions

A key carries the permissions chosen when it was created; they cannot be widened later. A request outside them gets 403 scope_denied.

PermissionAllows
records.readRead the records of a domain.
records.writeAdd, change and delete records, and put a record behind the proxy with proxied. Includes reading.
acmePublish and remove _acme-challenge TXT records only, for certificate clients.
services.readRead the services, the page check, certificates and firewall events. Traffic, the route report and failed visits need this permission itself, because they hold visitor addresses.
cdn.purgePurge the whole cache or chosen addresses.
cdn.cacheChange the cache level, cache times per file type and development mode.
cdn.pullCreate pull zones.
proxy.nodesChoose which nodes answer the domain.
proxy.sslChange SSL, HTTPS redirect, HSTS, the lowest TLS version, redirects, timeouts and the origin health check.
speedTurn compression and minifying on or off.
securityChange attack protection, the request limit and bot blocking.
firewallChange the web application firewall mode.
email.readRead the email state, the mail log, the inbox and DMARC reports.
email.settingsChange addresses, receiving, sending, DMARC reports and mail record fixes.
email.sendSend mail from an address of the domain.
domain.settingsTurn own nameservers on or off and change own error pages.
domains.manageAdd a domain and remove a domain you added; not for keys limited to some domains.
billing.readRead the wallet, invoices and plans.
billing.managePay or cancel invoices, start a wallet top-up, order a plan and change the renewal; includes reading.
ticketsOpen, read, answer and close tickets.
teamTeam members and connected AI assistants; changes are not for keys limited to some domains.
  • GET /domains works with any permission.
  • A key limited to some domains sees only those; any other domain answers 404 domain_not_found, as a domain that is not yours does.
  • For a deploy pipeline, a key with only cdn.purge and one domain can purge the cache and nothing else.
  • A key limited to some domains sees only their invoices (no wallet balance), cannot top up or pay from the wallet, opens tickets only about those domains, and cannot change the team or AI connections.

Answers

Every answer of the API code is JSON with ok. On success data holds the result; on failure error holds a code and a message. Check the HTTP status first: a 429, an unknown route or a wrong method answers outside this envelope.

{"ok": true, "data": ...}

{"ok": false, "error": {"code": "domain_not_found", "message": "Domain not found."}}

Errors

The code in error.code says what went wrong; the message is for people.

StatusCodeMeaning
401unauthorizedThe key is missing, wrong or revoked.
401key_expiredThe key is past its expiry date.
403https_requiredThe request was not sent over HTTPS.
403ip_not_allowedThe key has an IP list that does not include your address.
403client_inactiveThe account is suspended.
403scope_deniedThe key's permissions do not allow this request.
404domain_not_foundThe domain does not exist, is not yours, or is outside the key's domains.
404record_not_foundThe record id does not exist (list the records again).
412record_changedIf-Match named an older etag: someone changed the record since you read it.
404service_not_foundUnknown service name.
409record_rejectedThe zone contains record types the API cannot safely change.
422record_rejectedThe record failed validation, or it is an apex NS record (managed by Cloud9).
422limit_exceededA plan limit refused the change: type, minimum TTL or record count.
422not_in_planThe domain's plan does not include this service or setting.
422invalid_inputA field is missing or not one of the allowed values.
422invalid_challengeThe ACME name or value is not valid.
422pull_zone_rejectedThe pull zone name or origin was refused.
429too_soonWait a few minutes before asking again (for example another confirmation link).
429throttledToo many requests: at most 60 a minute per address.
502backend_errorThe zone could not be read or written; try again.
503unavailableA store is briefly unavailable; try again.

Limits and good practice

  • At most 60 requests a minute per client address; beyond that the answer is 429.
  • The plan limits of the portal apply to every write: allowed types, minimum TTL and number of records.
  • A record keeps its id when it changes. Each record also has an etag; send If-Match: <etag> with an update or a delete to change it only if nobody changed it since you read it (otherwise 412 record_changed with the current record).
  • Records of the mail service (MX and mail names) are never proxied, and apex NS records are managed by Cloud9.

Endpoints

  1. DomainsThe domains a key may use and the plan limits of each.
  2. DNS recordsList, add, change and delete records, and put names behind the proxy.
  3. SSL and HTTPSCertificates through DNS for acme.sh and certbot, the certificate mode, HTTPS redirect, HSTS, TLS, redirects, timeouts and the origin health check.
  4. Proxy and speedRead every service at once, choose the nodes per domain or per name, and turn compression and minifying on.
  5. Security and alertsAttack protection, the request limit and bot blocking, access rules and limits per path, the firewall and its exceptions, and alerts by email, SMS, Telegram or webhook.
  6. CDN cacheCache level, cache times per file type, development mode, purging and pull zones.
  7. EmailAddresses as an inbox or a forward, receiving and sending on or off, DMARC reports, mail record fixes, the inbox, the mail log and sending mail.
  8. Account, billing and supportThe wallet, invoices, plans and renewal, tickets, team members and connected AI assistants.
  9. Traffic and reportsRequests, cache and visitors; the route report by country; failed visits and the page check.
  10. AI assistants (MCP)Connect Claude, ChatGPT or any MCP client to your Cloud9 account and manage domains in plain words: records, CDN and proxy settings, the cache, traffic, and moving a domain from another provider.

No answer here? Sign in to the portal and open a ticket. Open a ticket