Dashboard

API and automation

API overview

Automate HCode with the customer API: authentication, queued work, retries and limits.

The customer API lets scripts and CI pipelines do what you do in the dashboard: create and deploy projects, change configuration, manage domains, and work with databases and backups. Every endpoint, with its permission, parameters and an example request, is in the API reference.

Note

The API is in preview, labelled "Customer API v1 · Preview" in the reference. Endpoints can still change.

Base URL and authentication

All endpoints live under /api/customer/v1 on the dashboard's own address. Send an API key as a bearer token in the Authorization header, never in the URL.

List the projects your key can see:

bash
curl "https://hcode.hostafrica.com/api/customer/v1/projects" \
  --header "Authorization: Bearer $HCODE_API_KEY"

The response includes the project IDs the other endpoints need. Every request is limited by both the key's permissions and your current role in the organisation.

The OpenAPI document is at https://hcode.hostafrica.com/docs/api/openapi.json if you want to import the API into an HTTP client.

Queued work

Deploys, restarts, backups, restores, imports and other long jobs outlive the request. The API answers HTTP 202 with an operationId. Poll Get operation progress with it until the status is succeeded, failed or cancelled. Failure and cancellation are final results too, so check which one you got.

Saving configuration and deploying are separate calls. Change the project or its variables first, then deploy.

Idempotency keys

Endpoints that queue work need an Idempotency-Key header. Use a fresh unique value for each new request, and send the same value again when you retry that exact request after a timeout. Reusing a key with a different body returns HTTP 409.

A refusal and a conflict need different handling:

  • A refusal, such as workload_busy or project_deleting, or a 403 such as org_suspended, started nothing. It isn't recorded against the key, so retry with the same key once the reason has cleared.
  • A conflict, such as conflict, deployment_in_progress or idempotency_in_progress, means the work, or work standing in for it, already exists. A retry with the same key gets the same answer. Follow the existing work instead of sending it again.

Lists and logs

List endpoints that page their results return nextCursor. Pass it back as cursor to get the next page; null means there are no more.

Runtime log reads return the latest 200 lines by default; set tail for up to 500. Deployment logs can be read in chunks. Both can also be streamed.

Errors

Errors carry a stable code, a message and a request ID:

json
{
  "error": {
    "code": "forbidden",
    "message": "Credential does not permit this operation",
    "requestId": "REQUEST_ID",
    "retryable": false
  }
}

Keep the request ID if you contact support.

Status What to check
400 Request fields, types or resource IDs are invalid.
401 The key is missing, expired or revoked.
403 The key or your role doesn't permit the action, or the organisation is suspended. Usage limits also return 403; see Usage and limits.
404 The resource doesn't exist or is outside the key's access.
409 The resource's state, another operation or a reused idempotency key blocks the request.
413 The body is over the size limit.
429 You hit the rate limit. Wait for the time in the Retry-After header.
5xx Something failed on HCode's side. Check queued work before sending a change again.

Limits

Limit Value
Requests per key 120 a minute
Requests per organisation, all keys together 600 a minute
JSON request body 1 MiB
File upload through the API 100 MiB, sent within 30 seconds

Usage and plan limits

getCapabilities returns your plan's limits and current usage: build minutes for this month, and memory, storage, bandwidth and build signals, each with its state. enforcing is true while a signal is pausing new work. If usage can't be read, those fields are null and usageStatusUnavailable is true; don't treat that as zero.

What stays in the dashboard

The API doesn't cover team members and invites, creating or leaving organisations, billing and plans, account settings, managing API keys and integrations, or installing the GitHub App.