Skip to content

CP API Reference

Base URL: https://api.computeportal.io

The ComputePortal REST API gives you programmatic control over every aspect of your GPU compute environment — services, domains, environment variables, logs, scaling, and more. All requests are authenticated with a Bearer token.


Authentication

Every API request must include your CP API token in the Authorization header.

http
Authorization: Bearer cp_live_<hex-string>

Token format: cp_live_ followed by a lowercase hex string (e.g. cp_live_4a7f3b9c2e1d8a06...).

You can find your token in the CP Dashboard under Settings → API Tokens.

Example

bash
curl https://api.computeportal.io/v1/services \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Error Responses

StatusMeaning
401 UnauthorizedMissing or malformed token
403 ForbiddenToken is valid but lacks permission for the requested resource

Rate Limits

The API is rate-limited per token. If you exceed the limit, you will receive a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait.


Errors

All error responses follow a consistent JSON shape:

json
{
  "error": "human-readable description",
  "code": "MACHINE_READABLE_CODE"
}

Common Error Codes

HTTP StatusCodeDescription
400CNAME_NOT_CONFIGUREDThe hostname's DNS CNAME record does not point to cpctl.app
400DEFAULT_DOMAINAttempt to remove a service's default <service>.cpctl.app domain
401UNAUTHORIZEDMissing, expired, or invalid API token
403FORBIDDENToken lacks permission for this resource
404NOT_FOUNDService or hostname does not exist
409CONFLICTHostname is already attached to this or another service
422VALIDATION_ERRORRequest body failed schema validation
500INTERNAL_ERRORUnexpected server error — contact support

Domains

Custom domains let you serve your CP service under your own hostname (e.g. dashboard.example.com) with automatic HTTPS. The default domain <service>.cpctl.app is always available and cannot be removed.

How Custom Domains Work

your domain (e.g. dashboard.example.com)
    │  CNAME → cpctl.app (DNS only)

cpctl.app


public IP (nginx + Let's Encrypt cert, per hostname, auto-provisioned)
  - Proxy pass via internal network


compute cluster
  Traefik (routes by Host header via Docker Swarm service labels)


Docker Swarm service

Before attaching a domain, you must create a DNS record at your registrar:

FieldValue
NameYour subdomain (e.g. dashboard)
TypeCNAME
Targetcpctl.app
ProxyDNS only — do NOT enable Cloudflare proxying

POST /v1/services/:service/domains

Attach a custom hostname to a service. CP verifies the CNAME record, provisions an nginx virtual host and a Let's Encrypt TLS certificate on the VPS, and updates the Traefik routing label on the Docker Swarm service.

Path Parameters

ParameterTypeDescription
servicestringThe service name (e.g. cp-dashboard)

Request Body

FieldTypeRequiredDefaultDescription
hostnamestringYesThe fully-qualified hostname to attach (e.g. dashboard.example.com)
skip_dnsbooleanNofalseSkip the DNS CNAME validation check. Use only for testing

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/cp-dashboard/domains \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{
    "hostname": "dashboard.example.com"
  }'

Example Response200 OK

json
{
  "hostname": "dashboard.example.com",
  "status": "active",
  "service": "cp-dashboard",
  "created_at": "2026-07-04T10:52:36.153Z"
}

What happens on the server:

  1. Resolves the DNS CNAME for hostname and verifies it points to cpctl.app (skipped if skip_dns: true)
  2. Writes a new nginx site configuration for the hostname on the edge proxy
  3. Runs certbot --nginx to issue a Let's Encrypt certificate (HTTP-01 challenge)
  4. Reloads nginx to activate the new virtual host
  5. Updates the Traefik Host router label on the Swarm service to include the new hostname

Error Responses

StatusCondition
400 Bad RequestCNAME record not found or not pointing to cpctl.app
404 Not FoundThe specified service does not exist
409 ConflictThe hostname is already registered
422 Unprocessable EntityRequest body is malformed or hostname is missing
500 Internal Server Errornginx or certbot provisioning failed

Testing Without DNS

If your DNS record is not yet propagated, pass skip_dns: true to bypass the CNAME check. The domain will be registered but traffic will not route correctly until the DNS record is active.

bash
curl -X POST https://api.computeportal.io/v1/services/cp-dashboard/domains \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{
    "hostname": "dashboard.example.com",
    "skip_dns": true
  }'

GET /v1/services/:service/domains

List all hostnames attached to a service — including the default <service>.cpctl.app domain.

Path Parameters

ParameterTypeDescription
servicestringThe service name (e.g. cp-dashboard)

Example Request

bash
curl https://api.computeportal.io/v1/services/cp-dashboard/domains \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "domains": [
    {
      "hostname": "cp-dashboard.computeportal.io",
      "status": "active",
      "created_at": null
    },
    {
      "hostname": "dashboard.example.com",
      "status": "active",
      "created_at": "2026-07-04T10:52:36.153Z"
    }
  ]
}

Response Schema

FieldTypeDescription
domainsarrayList of domain objects
domains[].hostnamestringFully-qualified hostname
domains[].statusstringAlways "active" for attached domains
domains[].created_atstring | nullISO 8601 timestamp. null for the default service domain

Error Responses

StatusCondition
404 Not FoundThe specified service does not exist

DELETE /v1/services/:service/domains/:hostname

Remove a custom hostname from a service. This removes the nginx virtual host configuration and TLS certificate from the VPS, and removes the hostname from the Traefik routing label.

The default <service>.cpctl.app domain cannot be removed.

Path Parameters

ParameterTypeDescription
servicestringThe service name (e.g. cp-dashboard)
hostnamestringThe hostname to remove (e.g. dashboard.example.com)

Example Request

bash
curl -X DELETE \
  https://api.computeportal.io/v1/services/cp-dashboard/domains/dashboard.example.com \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Response204 No Content

No response body is returned on success.

What happens on the server:

  1. Removes the nginx site configuration file for the hostname from the VPS
  2. Deletes the Let's Encrypt certificate via certbot delete
  3. Reloads nginx
  4. Removes the hostname from the Traefik Host router label on the Swarm service

Error Responses

StatusCondition
400 Bad RequestAttempt to remove the default <service>.cpctl.app domain
404 Not FoundThe service or hostname does not exist

Services

Services are Docker Swarm services running on CP compute infrastructure. Each service maps to a deployed AI/ML workload.

GET /v1/services

List all services in your CP account.

Example Request

bash
curl https://api.computeportal.io/v1/services \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "services": [
    {
      "name": "ml-inference",
      "image": "registry.example.com/model:v2",
      "status": "running",
      "replicas": { "running": 2, "desired": 2 },
      "created_at": "2026-07-01T08:00:00.000Z"
    }
  ]
}

POST /v1/services

Deploy a new service from a Docker image.

Request Body

FieldTypeRequiredDescription
namestringYesService name (e.g. ml-inference)
imagestringYesContainer image reference
replicasintegerNoInitial replica count. Default: 1
portintegerNoPort the container listens on. Default: 8080
envobjectNoKey-value environment variables to set at creation

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ml-inference",
    "image": "registry.example.com/model:v2",
    "replicas": 2,
    "port": 8080
  }'

Example Response200 OK

json
{
  "name": "ml-inference",
  "image": "registry.example.com/model:v2",
  "status": "deploying",
  "replicas": { "running": 0, "desired": 2 },
  "url": "https://ml-inference.cpctl.app",
  "created_at": "2026-07-08T09:00:00.000Z"
}

GET /v1/services/:name

Get details for a specific service.

Path Parameters

ParameterTypeDescription
namestringThe service name (e.g. ml-inference)

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "name": "ml-inference",
  "image": "registry.example.com/model:v2",
  "status": "running",
  "replicas": { "running": 2, "desired": 2 },
  "url": "https://ml-inference.cpctl.app",
  "port": 8080,
  "created_at": "2026-07-01T08:00:00.000Z"
}

DELETE /v1/services/:name

Delete a service and all associated resources.

Path Parameters

ParameterTypeDescription
namestringThe service name to delete

Example Request

bash
curl -X DELETE https://api.computeportal.io/v1/services/ml-inference \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Response204 No Content


POST /v1/services/:name/start

Start a stopped service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/start \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "name": "ml-inference", "status": "starting" }

POST /v1/services/:name/stop

Stop a running service. The service is kept but all replicas are brought down.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/stop \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "name": "ml-inference", "status": "stopped" }

POST /v1/services/:name/restart

Trigger a rolling restart of all service replicas.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/restart \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "name": "ml-inference", "status": "restarting" }

POST /v1/services/:name/redeploy

Re-trigger the current deployment without changing the image or configuration.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/redeploy \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "name": "ml-inference", "status": "deploying" }

POST /v1/services/:name/scale

Scale a service to a target replica count.

Path Parameters

ParameterTypeDescription
namestringThe service name

Request Body

FieldTypeRequiredDescription
replicasintegerYesTarget replica count

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/scale \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "replicas": 3 }'

Example Response200 OK

json
{ "name": "ml-inference", "replicas": { "running": 2, "desired": 3 } }

POST /v1/services/:name/rollback

Roll back a service to its previous deployment.

Path Parameters

ParameterTypeDescription
namestringThe service name

Request Body

FieldTypeRequiredDescription
deployment_idstringNoSpecific deployment ID to roll back to. Omit for the last stable deployment

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/rollback \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "name": "ml-inference", "status": "deploying", "rolled_back_to": "deploy_8f3a1b" }

GET /v1/services/:name/logs

Fetch recent log output from a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Query Parameters

ParameterTypeDescription
tailintegerNumber of most recent log lines to return. Default: 100

Example Request

bash
curl "https://api.computeportal.io/v1/services/ml-inference/logs?tail=50" \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "lines": [
    { "ts": "2026-07-08T09:11:58Z", "msg": "Model loaded in 2.3s" },
    { "ts": "2026-07-08T09:12:00Z", "msg": "Listening on :8080" }
  ]
}

GET /v1/services/:name/metrics

Get CPU, memory, and network metrics for a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/metrics \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "service": "ml-inference",
  "cpu_percent": 34.2,
  "memory_mb": 2048,
  "network_in_kbps": 120,
  "network_out_kbps": 95
}

GET /v1/services/:name/gpu

Get GPU utilization metrics for a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/gpu \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "service": "ml-inference",
  "gpu_utilization_percent": 72,
  "gpu_memory_used_mb": 14336,
  "gpu_memory_total_mb": 20480
}

GET /v1/services/:name/deployments

List the deployment history for a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/deployments \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "deployments": [
    { "id": "deploy_8f3a1b", "image": "registry.example.com/model:v2", "status": "succeeded", "created_at": "2026-07-08T08:00:00Z" },
    { "id": "deploy_7c2e09", "image": "registry.example.com/model:v1", "status": "succeeded", "created_at": "2026-07-01T08:00:00Z" }
  ]
}

GET /v1/services/:name/deployments/:id

Get details for a specific deployment.

Path Parameters

ParameterTypeDescription
namestringThe service name
idstringThe deployment ID (e.g. deploy_8f3a1b)

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/deployments/deploy_8f3a1b \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "id": "deploy_8f3a1b",
  "service": "ml-inference",
  "image": "registry.example.com/model:v2",
  "status": "succeeded",
  "replicas": 2,
  "created_at": "2026-07-08T08:00:00Z",
  "finished_at": "2026-07-08T08:01:15Z"
}

GET /v1/services/:name/env

List all environment variables set on a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/env \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "env": {
    "MODEL_PATH": "/models/v2",
    "BATCH_SIZE": "32"
  }
}

POST /v1/services/:name/env

Set one or more environment variables on a service. Triggers a rolling restart.

Path Parameters

ParameterTypeDescription
namestringThe service name

Request Body

FieldTypeRequiredDescription
envobjectYesKey-value map of variables to set

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/env \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "env": { "MODEL_PATH": "/models/v2", "BATCH_SIZE": "32" } }'

Example Response200 OK

json
{ "updated": ["MODEL_PATH", "BATCH_SIZE"] }

POST /v1/services/:name/env/unset

Remove one or more environment variables from a service. Triggers a rolling restart.

Path Parameters

ParameterTypeDescription
namestringThe service name

Request Body

FieldTypeRequiredDescription
keysarrayYesList of variable names to remove

Example Request

bash
curl -X POST https://api.computeportal.io/v1/services/ml-inference/env/unset \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "keys": ["DEBUG"] }'

Example Response200 OK

json
{ "removed": ["DEBUG"] }

GET /v1/services/:name/volumes

List persistent volumes attached to a service.

Path Parameters

ParameterTypeDescription
namestringThe service name

Example Request

bash
curl https://api.computeportal.io/v1/services/ml-inference/volumes \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "volumes": [
    { "name": "ml-data", "path": "/data", "size": "10Gi", "created_at": "2026-07-01T08:00:00Z" }
  ]
}

GET /v1/status

Platform health check. Returns the operational status of the CP API.

Example Request

bash
curl https://api.computeportal.io/v1/status

Example Response200 OK

json
{ "status": "ok", "version": "v1" }

GPU & Nodes

GET /v1/gpu/nodes

List GPU nodes and their current availability.

Example Request

bash
curl https://api.computeportal.io/v1/gpu/nodes \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "nodes": [
    { "id": "dgx-node-01", "gpu_model": "H100", "gpu_count": 8, "available": 3, "region": "us-east-1" }
  ]
}

POST /v1/gpu/reserve

Reserve GPU capacity on a node.

Request Body

FieldTypeRequiredDescription
node_idstringYesThe GPU node ID to reserve on
gpu_countintegerYesNumber of GPUs to reserve
duration_hoursintegerNoReservation duration in hours. Default: 1

Example Request

bash
curl -X POST https://api.computeportal.io/v1/gpu/reserve \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "node_id": "dgx-node-01", "gpu_count": 2, "duration_hours": 4 }'

Example Response200 OK

json
{
  "reservation_id": "res_7f2a3c",
  "node_id": "dgx-node-01",
  "gpu_count": 2,
  "expires_at": "2026-07-08T13:00:00Z"
}

POST /v1/gpu/jobs

Run a one-shot GPU job (non-persistent service).

Request Body

FieldTypeRequiredDescription
imagestringYesContainer image to run
commandstringNoCommand to execute inside the container
gpu_countintegerNoNumber of GPUs to allocate. Default: 1

Example Request

bash
curl -X POST https://api.computeportal.io/v1/gpu/jobs \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "image": "registry.example.com/train:latest", "gpu_count": 4 }'

Example Response200 OK

json
{ "job_id": "job_4b9d12", "status": "queued", "created_at": "2026-07-08T09:00:00Z" }

GET /v1/gpu/jobs/:id/logs

Get log output for a GPU job.

Path Parameters

ParameterTypeDescription
idstringThe GPU job ID (e.g. job_4b9d12)

Example Request

bash
curl https://api.computeportal.io/v1/gpu/jobs/job_4b9d12/logs \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "lines": [
    { "ts": "2026-07-08T09:01:00Z", "msg": "Epoch 1/10 — loss: 0.8421" },
    { "ts": "2026-07-08T09:02:30Z", "msg": "Epoch 2/10 — loss: 0.6103" }
  ]
}

GET /v1/nodes

List all compute nodes in the CP cluster.

Example Request

bash
curl https://api.computeportal.io/v1/nodes \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "nodes": [
    { "id": "node-01", "region": "us-east-1", "status": "active", "role": "worker" }
  ]
}

GET /v1/nodes/:id

Get details and health information for a specific compute node.

Path Parameters

ParameterTypeDescription
idstringThe node ID (e.g. node-01)

Example Request

bash
curl https://api.computeportal.io/v1/nodes/node-01 \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "id": "node-01",
  "region": "us-east-1",
  "status": "active",
  "cpu_cores": 64,
  "memory_gb": 256,
  "gpu_count": 8,
  "uptime_hours": 720
}

GET /v1/nodes/self-hosted

List self-hosted nodes registered to your CP account.

Example Request

bash
curl https://api.computeportal.io/v1/nodes/self-hosted \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "nodes": [
    { "id": "sh-node-01", "hostname": "my-server.example.com", "status": "connected", "registered_at": "2026-06-01T10:00:00Z" }
  ]
}

GET /v1/regions

List all available CP regions.

Example Request

bash
curl https://api.computeportal.io/v1/regions \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "regions": [
    { "id": "us-east-1", "name": "US East (Virginia)", "available": true },
    { "id": "eu-west-1", "name": "EU West (Ireland)", "available": true }
  ]
}

Databases

GET /v1/databases

List all managed databases in your CP account.

Example Request

bash
curl https://api.computeportal.io/v1/databases \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "databases": [
    { "name": "app-db", "type": "postgres", "status": "running", "created_at": "2026-06-15T10:00:00Z" }
  ]
}

POST /v1/databases

Create a new managed database.

Request Body

FieldTypeRequiredDescription
namestringYesDatabase name (e.g. app-db)
typestringYesDatabase engine: postgres, mysql, or redis
versionstringNoEngine version. Default: latest stable

Example Request

bash
curl -X POST https://api.computeportal.io/v1/databases \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "name": "app-db", "type": "postgres" }'

Example Response200 OK

json
{
  "name": "app-db",
  "type": "postgres",
  "status": "provisioning",
  "connection_url": "postgres://cp:secret@app-db.internal:5432/app-db",
  "created_at": "2026-07-08T09:00:00Z"
}

GET /v1/databases/:name

Get details and connection information for a specific database.

Path Parameters

ParameterTypeDescription
namestringThe database name

Example Request

bash
curl https://api.computeportal.io/v1/databases/app-db \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "name": "app-db",
  "type": "postgres",
  "status": "running",
  "connection_url": "postgres://cp:secret@app-db.internal:5432/app-db",
  "created_at": "2026-06-15T10:00:00Z"
}

DELETE /v1/databases/:name

Destroy a managed database and all its data. This action is irreversible.

Path Parameters

ParameterTypeDescription
namestringThe database name to destroy

Example Request

bash
curl -X DELETE https://api.computeportal.io/v1/databases/app-db \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Response204 No Content


Environments

GET /v1/environments

List all environments in your CP account (e.g. production, staging).

Example Request

bash
curl https://api.computeportal.io/v1/environments \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "environments": [
    { "name": "production", "created_at": "2026-06-01T00:00:00Z" },
    { "name": "staging", "created_at": "2026-06-15T00:00:00Z" }
  ]
}

POST /v1/environments

Create a new environment.

Request Body

FieldTypeRequiredDescription
namestringYesEnvironment name (e.g. staging)

Example Request

bash
curl -X POST https://api.computeportal.io/v1/environments \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "name": "staging" }'

Example Response200 OK

json
{ "name": "staging", "created_at": "2026-07-08T09:00:00Z" }

DELETE /v1/environments/:name

Delete an environment. Services in the environment must be removed first.

Path Parameters

ParameterTypeDescription
namestringThe environment name to delete

Example Request

bash
curl -X DELETE https://api.computeportal.io/v1/environments/staging \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Response204 No Content


Sandboxes

GET /v1/sandboxes

List all sandboxes in your CP account.

Example Request

bash
curl https://api.computeportal.io/v1/sandboxes \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "sandboxes": [
    { "id": "sbx_3d9f1a", "status": "running", "created_at": "2026-07-08T08:00:00Z", "expires_at": "2026-07-08T16:00:00Z" }
  ]
}

POST /v1/sandboxes

Create a new sandbox — an ephemeral compute environment for short-lived workloads.

Request Body

FieldTypeRequiredDescription
imagestringNoContainer image to use. Default: CP base image
ttl_hoursintegerNoTime-to-live in hours before the sandbox auto-destroys. Default: 8

Example Request

bash
curl -X POST https://api.computeportal.io/v1/sandboxes \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "ttl_hours": 4 }'

Example Response200 OK

json
{
  "id": "sbx_3d9f1a",
  "status": "starting",
  "url": "https://sbx_3d9f1a.cpctl.app",
  "created_at": "2026-07-08T09:00:00Z",
  "expires_at": "2026-07-08T13:00:00Z"
}

DELETE /v1/sandboxes/:id

Destroy a sandbox immediately, before its TTL expires.

Path Parameters

ParameterTypeDescription
idstringThe sandbox ID (e.g. sbx_3d9f1a)

Example Request

bash
curl -X DELETE https://api.computeportal.io/v1/sandboxes/sbx_3d9f1a \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Response204 No Content


Machine Payments

GET /v1/pay/status

Get the currently linked payment method for your CP account.

Example Request

bash
curl https://api.computeportal.io/v1/pay/status \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "method": "card",
  "last4": "4242",
  "brand": "visa",
  "linked_at": "2026-06-01T10:00:00Z"
}

POST /v1/pay/setup

Start a card or USDC wallet setup flow. Returns a Stripe-hosted URL to complete the process.

Request Body

FieldTypeRequiredDescription
methodstringYesPayment method type: card or usdc
return_urlstringNoURL to redirect to after setup completes

Example Request

bash
curl -X POST https://api.computeportal.io/v1/pay/setup \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "method": "card" }'

Example Response200 OK

json
{
  "setup_url": "https://checkout.stripe.com/pay/cs_live_...",
  "expires_at": "2026-07-08T09:30:00Z"
}

GET /v1/pay/setup/poll

Poll for completion of a payment method setup flow started via POST /v1/pay/setup.

Example Request

bash
curl https://api.computeportal.io/v1/pay/setup/poll \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{ "status": "complete", "method": "card", "last4": "4242" }

POST /v1/pay/authorize

Pre-authorize a per-call charge for a service. Used for metered billing on GPU inference endpoints.

Request Body

FieldTypeRequiredDescription
servicestringYesThe service name to authorize charges for
amount_usdnumberYesMaximum charge amount in USD to authorize

Example Request

bash
curl -X POST https://api.computeportal.io/v1/pay/authorize \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06" \
  -H "Content-Type: application/json" \
  -d '{ "service": "ml-inference", "amount_usd": 5.00 }'

Example Response200 OK

json
{
  "authorization_id": "auth_9c1f2a",
  "service": "ml-inference",
  "amount_usd": 5.00,
  "expires_at": "2026-07-08T17:00:00Z"
}

GET /v1/pay/history

List all per-call payment charges on your account.

Example Request

bash
curl https://api.computeportal.io/v1/pay/history \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "charges": [
    { "id": "chg_1a2b3c", "service": "ml-inference", "amount_usd": 1.25, "created_at": "2026-07-07T14:00:00Z" }
  ]
}

Billing

GET /v1/billing/usage

Get usage totals for the current billing cycle.

Example Request

bash
curl https://api.computeportal.io/v1/billing/usage \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "cycle_start": "2026-07-01T00:00:00Z",
  "cycle_end": "2026-07-31T23:59:59Z",
  "total_usd": 128.40,
  "breakdown": {
    "compute": 100.00,
    "gpu": 24.00,
    "storage": 4.40
  }
}

GET /v1/billing/history

List past invoices.

Example Request

bash
curl https://api.computeportal.io/v1/billing/history \
  -H "Authorization: Bearer cp_live_4a7f3b9c2e1d8a06"

Example Response200 OK

json
{
  "invoices": [
    { "id": "inv_2026_06", "period": "June 2026", "total_usd": 112.80, "status": "paid", "url": "https://dashboard.computeportal.io/inv_2026_06.pdf" }
  ]
}

Versioning

The current API version is v1. The version is part of every URL path: /v1/....

Breaking changes will be introduced under a new version prefix (e.g. /v2/...). Non-breaking additions (new fields, new endpoints) may be added to the current version at any time.


Infrastructure Reference

ComponentValue
API base URLhttps://api.computeportal.io
CNAME targetcpctl.app
Edge proxyPublic IP running nginx + certbot
Edge → clusterInternal private network
Default service domain<service-name>.cpctl.app
TLSLet's Encrypt (HTTP-01 via certbot)
IngressTraefik on Docker Swarm

SDK and Tools

In addition to direct HTTP calls, you can interact with the CP API through:

  • CP CLI — command-line interface for managing services and domains
  • CP MCP Server — AI assistant integration at https://mcp.computeportal.io/mcp (see MCP Server Reference)

Support

GPU Compute Platform