Skip to content

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 pathStatus
https://panel.example.com:8443/v1Official. Use this for new integrations.
https://panel.example.com:8443/api/v1Alias 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:

bash
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.

bash
curl -sS https://panel.example.com:8443/v1/health
json
{"status": "ok", "time": "2026-11-09T03:00:00Z", "version": "vX.Y.Z"}
FieldContent
statusok when the control plane answers
timePanel clock (UTC)
versionInstalled 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:

bash
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"}'
json
{
  "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 ​

StatusMeaning
queuedWaiting for a worker
runningIn progress
succeededDone. The output is in the result field.
failedFinal failure. See errorCode and errorMessage.
cancelledCancelled

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:

  1. Polling GET /v1/jobs/{id} until a final status. A 2-second interval is enough; the official Postman collection uses the same interval.
  2. Webhooks: register a webhook for the <job kind>.succeeded and <job kind>.failed events, so the panel tells you. See Outgoing webhooks.
bash
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:

bash
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 statusforce: false (default)force: true (kill)
queuedBecomes cancelled right awayBecomes cancelled right away
runningThe 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 setBecomes 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_cancellable when 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.cancel or job.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 job failed right away.
  • A failed or cancelled job can be retried with POST /v1/jobs/{id}/retry (the Idempotency-Key header 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.

CaseResult
New keyThe request is processed normally and the 2xx response is stored
Same key, same requestThe stored response is returned with the Idempotent-Replayed: true header; the operation does not run twice
Same key, different body or path409 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/accounts
  • POST /v1/accounts/{id}/suspend and /unsuspend
  • PUT /v1/accounts/{id}/package
  • POST /v1/accounts/{id}/terminate
  • POST /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:

EndpointParametersDefault
GET /v1/jobslimit, accountId100
GET /v1/auditlimit, accountId100
GET /v1/alertsstate (open, resolved, all), limit (max 1000)200

Lists that can get very large use a cursor. Currently the example is GET /v1/usage/accounts:

  1. Call it with limit (default 50, max 200).
  2. If the response contains nextCursor, call again with cursor=<nextCursor>.
  3. No nextCursor means the last page.
bash
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:

json
{"code": "cp.account_not_found", "message": "akun tidak ditemukan"}
FieldContent
codeStable code. It does not change between versions and does not depend on language.
messageHuman-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 ​

HTTPCodeMeaning
400cp.bad_requestInvalid body or parameter
400cp.account_requiredBilling keys must include accountId
400cp.billing_client_requiredThe X-Billing-Client-ID header is required for client operations
400cp.section_invalidUnknown SSO deep link section
400cp.idempotency_key_requiredThis endpoint requires the Idempotency-Key header
401cp.unauthorizedWrong or missing API key
401cp.session_expiredStaff session ended
401cp.client_cert_requiredThis key must use an mTLS client certificate
402cp.license_limitPanel license inactive, or account/server limit reached
402cp.license_lockedThe 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.
403cp.forbiddenThe role may not use this route
403cp.scope_deniedThe key's scopes do not cover this feature
403cp.ip_not_allowedSource IP is not in the key's allowlist
403cp.csrf_invalidGUI session without a valid CSRF token
403cp.account_inactiveAccount suspended or being deleted
403cp.billing_management_disabledThe admin turned off "manage from billing" for this account
404cp.account_not_foundThe account does not exist or does not belong to this billing key
404cp.job_not_foundThe job does not exist or does not belong to this key's account
409cp.job_not_cancellableThe job is already final, or cannot be stopped while it runs
409cp.idempotency_mismatchIdempotency-Key reused with a different request
409cp.account_conflictUsername or domain already in use
409cp.account_bad_stateThe account status does not allow this operation
409cp.server_not_readyServer not active yet, or in maintenance
409cp.capacity_exceededNo server passes the capacity rules
409cp.domain_conflictDomain already used by another account or another website
409cp.package_in_usePackage still used by accounts that are not terminated
429cp.rate_limitedRate limit exceeded
429cp.auth_lockedLogin or API key guessing temporarily locked
500cp.internalPanel error; check the control plane log
501cp.agent_outdatedThe server's agent is too old for this feature
502cp.agent_unreachableThe 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:

HeaderLanguage
en, en-US, …English
id, id-ID, …Indonesian
Missing, or without en/idIndonesian (default)

q values are honored. For example, en;q=0.2, id;q=0.8 gives Indonesian.

bash
curl -sS https://panel.example.com:8443/v1/accounts/ACCOUNT_ID \
  -H "Accept-Language: en" \
  -H "X-API-Key: API_KEY"
json
{"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:

LimitDefaultVariable
Per API key3000 requests/minuteMOORCP_API_RATE_PER_KEY
Per account touched by a billing key300 requests/minuteMOORCP_API_RATE_PER_ACCOUNT
  • 0 means no limit. The panel admin sets these variables in /etc/moorcp-shared/env.
  • When a limit is exceeded, the panel answers 429 cp.rate_limited with a Retry-After header (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.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.