API v1 overview
This page is for developers who connect billing, automation scripts, or other tools to MoorCP Shared. It covers the rules that apply to every endpoint: address, format, jobs, errors, language, and rate limits.
Base URL
The API is served by the control plane on the admin panel port (default 8443).
| Base path | Status |
|---|---|
https://panel.example.com:8443/v1 | Official. Use this for new integrations. |
https://panel.example.com:8443/api/v1 | Alias for older clients. Behaves exactly like /v1. |
All examples in this documentation use /v1.
INFO
Port 2083 (client panel) uses the same API handler, but only accepts client sessions and client API tokens (mcct_...). Staff and billing API keys do not work on that port. Integrations always call the admin port (8443). Client API tokens are covered in Authentication and API keys.
Request and response format
- Request and response bodies are JSON (
Content-Type: application/json). - Times use RFC 3339 UTC, for example
2026-11-01T10:00:00Z. - Object IDs (accounts, servers, jobs, websites) are strings. Store them as is; do not convert them to numbers.
- JSON bodies are limited to 1 MB. File uploads use separate streaming endpoints.
The simplest request:
curl -sS https://panel.example.com:8443/v1/accounts \
-H "X-API-Key: API_KEY"How to get and restrict an API key is covered in Authentication and API keys.
Health check
GET /v1/health needs no authentication. Use it for uptime monitoring and to confirm the panel address is correct.
curl -sS https://panel.example.com:8443/v1/health{"status": "ok", "time": "2026-11-09T03:00:00Z", "version": "vX.Y.Z"}| Field | Content |
|---|---|
status | ok when the control plane answers |
time | Panel clock (UTC) |
version | Installed panel version |
To test the connection from billing and check the key at the same time, use GET /v1/billing/capabilities. See Billing integration.
Asynchronous operations (jobs)
Operations that touch a hosting server run in the background as jobs: creating an account, suspend, package change, terminate, issuing SSL, backup, restore, database import, and similar.
These endpoints answer 202 Accepted with a job object. Suspend example:
curl -sS -X POST https://panel.example.com:8443/v1/accounts/ACCOUNT_ID/suspend \
-H "X-API-Key: API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"reason": "Invoice unpaid"}'{
"id": "JOB_ID",
"kind": "account.suspend",
"status": "queued",
"accountId": "ACCOUNT_ID",
"serverId": "SERVER_ID",
"attempt": 0,
"maxAttempts": 3,
"createdAt": "2026-11-09T03:00:00Z"
}Job status
| Status | Meaning |
|---|---|
queued | Waiting for a worker |
running | In progress |
succeeded | Done. The output is in the result field. |
failed | Final failure. See errorCode and errorMessage. |
cancelled | Cancelled |
queued and running are still in progress. The other three are final.
Some objects also carry a summary of their latest job. For example, a website's sslJob field holds the status of the latest Let's Encrypt certificate request, the ACME error, and the aliases that were skipped (skipped), so a failure stays visible after the job ends.
Waiting for a job
There are two ways:
- Polling
GET /v1/jobs/{id}until a final status. A 2-second interval is enough; the official Postman collection uses the same interval. - Webhooks: register a webhook for the
<job kind>.succeededand<job kind>.failedevents, so the panel tells you. See Outgoing webhooks.
curl -sS https://panel.example.com:8443/v1/jobs/JOB_ID \
-H "X-API-Key: API_KEY"TIP
For billing, combine both: rely on webhooks, then poll now and then for jobs you have not heard about. Webhooks can be delayed while your endpoint is down.
Stopping a job
POST /v1/jobs/{id}/cancel stops a job (staff with the admin or technician role, or an API key with such a role). The body is optional:
curl -sS -X POST https://panel.example.com:8443/v1/jobs/JOB_ID/cancel \
-H "X-API-Key: API_KEY" \
-H "Content-Type: application/json" \
-d '{"force": false}'| Job status | force: false (default) | force: true (kill) |
|---|---|---|
queued | Becomes cancelled right away | Becomes cancelled right away |
running | The worker is asked to stop and the job ends as cancelled (cp.job_cancelled), usually within about 15 seconds. Until then the job stays running with cancelRequestedAt set | Becomes cancelled right away, without waiting for the worker. A late worker result is ignored |
- The response is the job after the change.
- 409
cp.job_not_cancellablewhen the job is already final, or when it is a running job with its own rollback (account.move,server.switch_webserver,migration.wave_cutover,server.db_profile). - An operation already sent to the agent may still finish on the server after a kill.
- Recorded in the audit log as
job.cancelorjob.kill. - Billing keys and scoped API keys cannot stop jobs.
A job that was running when the control plane restarted is closed by itself: after 3 minutes without a heartbeat it becomes failed with cp.job_abandoned, and can be retried.
Retrying jobs
- The worker retries jobs that fail with a temporary error by itself, up to 3 attempts (
maxAttempts). A final error makes the jobfailedright away. - A
failedorcancelledjob can be retried withPOST /v1/jobs/{id}/retry(theIdempotency-Keyheader is required). The panel creates a new job with the same kind, target, and payload. The old job stays as history. - Retry is refused with 409 when the job is not final yet (
cp.job_not_retryable), when a job of the same kind for the same target is still running (cp.job_retry_conflict), or when the job kind has its own recovery flow (server move, migration, web server switch). - Scoped API keys cannot retry jobs.
Idempotency
Every POST, PUT, PATCH, and DELETE request (with a JSON body or none) accepts an Idempotency-Key header of up to 128 characters.
| Case | Result |
|---|---|
| New key | The request is processed normally and the 2xx response is stored |
| Same key, same request | The stored response is returned with the Idempotent-Replayed: true header; the operation does not run twice |
| Same key, different body or path | 409 cp.idempotency_mismatch |
Keys are matched per credential (and per account for billing keys).
The header is required on the main provisioning endpoints:
POST /v1/accountsPOST /v1/accounts/{id}/suspendand/unsuspendPUT /v1/accounts/{id}/packagePOST /v1/accounts/{id}/terminatePOST /v1/packages,PUT /v1/packages/{id}POST /v1/jobs/{id}/retry- some other job-creating endpoints, for example
POST /v1/websites/{id}/ssl/issue
Without the header on a required endpoint, the panel answers 400 cp.idempotency_key_required.
TIP
Create one key per business action, for example suspend-INV-2026-0042, and reuse that key when the request is repeated after a timeout. That way billing retries never create duplicate accounts.
Pagination
Most lists return a plain JSON array, with a limit parameter to cap the number of most recent entries:
| Endpoint | Parameters | Default |
|---|---|---|
GET /v1/jobs | limit, accountId | 100 |
GET /v1/audit | limit, accountId | 100 |
GET /v1/alerts | state (open, resolved, all), limit (max 1000) | 200 |
Lists that can get very large use a cursor. Currently the example is GET /v1/usage/accounts:
- Call it with
limit(default 50, max 200). - If the response contains
nextCursor, call again withcursor=<nextCursor>. - No
nextCursormeans the last page.
curl -sS "https://panel.example.com:8443/v1/usage/accounts?limit=200&cursor=CURSOR" \
-H "X-API-Key: API_KEY"Error format
All errors have the same shape:
{"code": "cp.account_not_found", "message": "akun tidak ditemukan"}| Field | Content |
|---|---|
code | Stable code. It does not change between versions and does not depend on language. |
message | Human-readable message. Its language follows Accept-Language (Indonesian by default, as in the example above). |
WARNING
Integrations must check code, not message. Message text can be fixed or translated at any time.
Common error codes
| HTTP | Code | Meaning |
|---|---|---|
| 400 | cp.bad_request | Invalid body or parameter |
| 400 | cp.account_required | Billing keys must include accountId |
| 400 | cp.billing_client_required | The X-Billing-Client-ID header is required for client operations |
| 400 | cp.section_invalid | Unknown SSO deep link section |
| 400 | cp.idempotency_key_required | This endpoint requires the Idempotency-Key header |
| 401 | cp.unauthorized | Wrong or missing API key |
| 401 | cp.session_expired | Staff session ended |
| 401 | cp.client_cert_required | This key must use an mTLS client certificate |
| 402 | cp.license_limit | Panel license inactive, or account/server limit reached |
| 402 | cp.license_locked | The license has expired and its grace period is over, so the admin API, billing API, and client panel are locked until the license is renewed. Hosting keeps running. |
| 403 | cp.forbidden | The role may not use this route |
| 403 | cp.scope_denied | The key's scopes do not cover this feature |
| 403 | cp.ip_not_allowed | Source IP is not in the key's allowlist |
| 403 | cp.csrf_invalid | GUI session without a valid CSRF token |
| 403 | cp.account_inactive | Account suspended or being deleted |
| 403 | cp.billing_management_disabled | The admin turned off "manage from billing" for this account |
| 404 | cp.account_not_found | The account does not exist or does not belong to this billing key |
| 404 | cp.job_not_found | The job does not exist or does not belong to this key's account |
| 409 | cp.job_not_cancellable | The job is already final, or cannot be stopped while it runs |
| 409 | cp.idempotency_mismatch | Idempotency-Key reused with a different request |
| 409 | cp.account_conflict | Username or domain already in use |
| 409 | cp.account_bad_state | The account status does not allow this operation |
| 409 | cp.server_not_ready | Server not active yet, or in maintenance |
| 409 | cp.capacity_exceeded | No server passes the capacity rules |
| 409 | cp.domain_conflict | Domain already used by another account or another website |
| 409 | cp.package_in_use | Package still used by accounts that are not terminated |
| 429 | cp.rate_limited | Rate limit exceeded |
| 429 | cp.auth_locked | Login or API key guessing temporarily locked |
| 500 | cp.internal | Panel error; check the control plane log |
| 501 | cp.agent_outdated | The server's agent is too old for this feature |
| 502 | cp.agent_unreachable | The server's agent cannot be reached |
Endpoint-specific codes are listed in the OpenAPI reference. Some codes use an area prefix instead of cp., for example firewall.protected when closing a protected port.
Text language
Server text (the error message field, alerts, job steps, reports) is available in English and Indonesian. The panel picks the language from the Accept-Language header:
| Header | Language |
|---|---|
en, en-US, … | English |
id, id-ID, … | Indonesian |
Missing, or without en/id | Indonesian (default) |
q values are honored. For example, en;q=0.2, id;q=0.8 gives Indonesian.
curl -sS https://panel.example.com:8443/v1/accounts/ACCOUNT_ID \
-H "Accept-Language: en" \
-H "X-API-Key: API_KEY"{"code": "cp.account_not_found", "message": "account not found"}INFO
Webhook payloads are always in Indonesian. Older text stored before two-language support existed is shown as is, in Indonesian.
Rate limits
Each API key is limited by a token bucket in the control plane:
| Limit | Default | Variable |
|---|---|---|
| Per API key | 3000 requests/minute | MOORCP_API_RATE_PER_KEY |
| Per account touched by a billing key | 300 requests/minute | MOORCP_API_RATE_PER_ACCOUNT |
0means no limit. The panel admin sets these variables in/etc/moorcp-shared/env.- When a limit is exceeded, the panel answers 429
cp.rate_limitedwith aRetry-Afterheader (seconds). Wait that long before trying again. - Staff GUI sessions are not subject to these limits. Login has its own lockout.
TIP
To sync usage for hundreds of accounts, make one GET /v1/usage/accounts call per page, not one call per account. This uses far less of the per-account quota.
Audit
Every request that changes something is written to the audit log with its actor: the staff email, apikey:<prefix>, or billing-api for billing keys. GET /v1/audit?accountId=ACCOUNT_ID shows one account's activity (Recent Activity). Billing keys get a compact version without staff IPs and agent output.
