# Overview and quickstart

> What the Clouduxe API does and the rules every request follows, then your first call and a VPS restart in three steps.

Source: https://docs.clouduxe.com/api/

The Clouduxe API lets your own code run your Clouduxe services: order, manage
and automate VPS, Dedicated servers and the DDoS-protected proxy without the
panel. It speaks JSON over HTTPS, and every request goes
to one base URL, which holds the major version:

`https://api.clouduxe.com/v1`

## The rules every request follows

| What | How it works |
| --- | --- |
| **Tokens** | A bearer token in the `Authorization` header. Live tokens start with `cxk_live_`. Each token belongs to one account and carries only the scopes you gave it. |
| **Names and ids** | Fields and parameters are camelCase. Ids are opaque UUIDs, and every object says what it is in `object`. |
| **Lists** | Cursor pagination: a page says whether another follows in `hasMore`, and hands you `nextCursor` to fetch it. |
| **Errors** | One error shape, with a stable `code`, a `type` to group it and a `requestId` to quote to support. |
| **Writes** | Writes need an `Idempotency-Key`, so a retry never runs the same write twice. The reference shows the header on every operation that takes it. |
| **Rate limits** | Every response carries `RateLimit-*` headers for the limit nearest to running out. |
| **Long-running work** | A restart, a reinstall or a new server does not hold your request open: you get an action back at once and read it until it finishes. |
| **Versions** | The path holds the major version, `/v1`, and nothing in `/v1` is ever removed or renamed: new fields, endpoints and event types only. You do not need a version header. To pin a dated version anyway, send `Clouduxe-Version: 2026-12-01`; without it, the token's own version is used. |

## Quickstart: restart a VPS in three steps

The three steps below are a complete program: find a VPS, restart it, and see
the restart finish. Every request on this page switches between curl, the Node
and PHP SDKs, Python and plain `fetch`, and remembers the one you pick.

### Step 1: Create a token and keep it out of your code

Tokens are made only in the panel, at
[API tokens](https://dash.clouduxe.com/account/api-tokens), never through the
API. Making one asks you to confirm it is you (a passkey, or an email code from
the last 10 minutes), and the token is shown once, so copy it then. For this quickstart,
give it `services:read` and `services:write`.

Put the token in an environment variable. Every example in these docs reads it
from `CLOUDUXE_API_KEY`, so you can paste them as they are.

```bash
export CLOUDUXE_API_KEY="cxk_live_..."
```

### Step 2: Make your first call

List your services. The answer is one page of them; note the `id`
of the VPS you want to restart.

`GET /services` (reference: https://docs.clouduxe.com/api/reference/services/list-services/)

```bash
curl https://api.clouduxe.com/v1/services \
  -H "Authorization: Bearer $CLOUDUXE_API_KEY"
```

##### Response (`200`)

```json
{
  "object": "list",
  "data": [
    {
      "object": "service",
      "id": "c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d",
      "type": "vps",
      "status": "active",
      "suspensionReason": null,
      "deletesAt": null,
      "planId": "vps-nvme-4-mumbai",
      "planName": "NVMe VPS 4 GB",
      "region": "mumbai",
      "label": "node1",
      "reference": "client-4471",
      "metadata": {
        "whmcsServiceId": "18342",
        "plan": "starter"
      },
      "firewallAvailable": true,
      "billing": {
        "cycleMonths": 1,
        "price": {
          "amount": 129900,
          "currency": "INR"
        },
        "currentPeriodStart": "2026-12-04",
        "paidThrough": "2027-01-03",
        "cancelAtPeriodEnd": false,
        "endsOn": null
      },
      "server": {
        "powerState": "running",
        "hostname": "node1.acme.example",
        "ipv4": [
          "203.0.113.24"
        ],
        "ipv6": [
          "2001:db8:4f2a::24"
        ],
        "image": {
          "object": "image",
          "id": "ubuntu-24.04",
          "name": "Ubuntu 24.04 LTS",
          "family": "linux"
        },
        "resources": {
          "cpuCores": 2,
          "memoryMb": 4096,
          "diskGb": 80,
          "trafficGb": 4000
        },
        "statusUpdatedAt": "2026-12-04T10:02:41Z",
        "stale": false
      },
      "proxy": null,
      "createdAt": "2026-12-04T09:15:24Z",
      "livemode": true
    },
    {
      "object": "service",
      "id": "4e9b2d7a-1c6f-4b3e-a8d2-7f5c0e9a1b4d",
      "type": "dedicated",
      "status": "provisioning",
      "suspensionReason": null,
      "deletesAt": null,
      "planId": "dedicated-e5-64-limburg",
      "planName": "Dedicated E5 64 GB",
      "region": "limburg",
      "label": "db-primary",
      "reference": "client-4471",
      "metadata": {},
      "firewallAvailable": false,
      "billing": {
        "cycleMonths": 1,
        "price": {
          "amount": 1149900,
          "currency": "INR"
        },
        "currentPeriodStart": "2026-12-04",
        "paidThrough": "2027-01-03",
        "cancelAtPeriodEnd": false,
        "endsOn": null
      },
      "server": {
        "powerState": "unknown",
        "hostname": "db1.acme.example",
        "ipv4": [],
        "ipv6": [],
        "image": null,
        "resources": null,
        "statusUpdatedAt": null,
        "stale": false
      },
      "proxy": null,
      "createdAt": "2026-12-03T14:40:05Z",
      "livemode": true
    },
    {
      "object": "service",
      "id": "a7d4c1e9-3f2b-4d8a-9c6e-0b5a2f7d3e1c",
      "type": "proxy",
      "status": "active",
      "suspensionReason": null,
      "deletesAt": null,
      "planId": "proxy-game-standard",
      "planName": "Protected Proxy Standard",
      "region": null,
      "label": "game-proxy",
      "reference": "client-5102",
      "metadata": {},
      "firewallAvailable": false,
      "billing": {
        "cycleMonths": 1,
        "price": {
          "amount": 249900,
          "currency": "INR"
        },
        "currentPeriodStart": "2026-12-04",
        "paidThrough": "2027-01-03",
        "cancelAtPeriodEnd": false,
        "endsOn": null
      },
      "server": null,
      "proxy": {
        "profile": "fivem",
        "ports": [
          {
            "protocol": "tcp",
            "portStart": 30120,
            "portEnd": 30120
          },
          {
            "protocol": "udp",
            "portStart": 30120,
            "portEnd": 30120
          }
        ]
      },
      "createdAt": "2026-11-28T11:02:19Z",
      "livemode": true
    }
  ],
  "hasMore": true,
  "nextCursor": "eyJsIjoic2VydmljZXMiLCJjIjoiMjAyNi0xMi0wNFQwOToxNToyMloifQ.x7Hq2N"
}
```

### Step 3: Restart the VPS, then read the action

Send the restart. The API answers straight away with an action, and the
restart carries on in the background.

`POST /services/{serviceId}/power` (reference: https://docs.clouduxe.com/api/reference/server-actions/power-service/)

```bash
curl -X POST https://api.clouduxe.com/v1/services/c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d/power \
  -H "Authorization: Bearer $CLOUDUXE_API_KEY" \
  -H "Idempotency-Key: 6f1c2e9a-4b7d-4e3a-9c8f-1a2b3c4d5e6f" \
  -H "Content-Type: application/json" \
  -d '{"action":"restart"}'
```

##### Response (`202`)

```json
{
  "object": "action",
  "id": "f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a",
  "type": "restart",
  "status": "running",
  "serviceId": "c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d",
  "orderId": null,
  "invoiceId": null,
  "failure": null,
  "secretAvailable": false,
  "secretExpiresAt": null,
  "createdAt": "2026-12-04T09:20:11Z",
  "startedAt": "2026-12-04T09:20:11Z",
  "completedAt": null,
  "livemode": true
}
```

Read the action back by its `id` until its `status` is terminal: `succeeded`,
`failed` or `unknown`. Poll at most once every 2 seconds.

`GET /actions/{actionId}` (reference: https://docs.clouduxe.com/api/reference/server-actions/get-action/)

```bash
curl https://api.clouduxe.com/v1/actions/f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a \
  -H "Authorization: Bearer $CLOUDUXE_API_KEY"
```

##### Response (`200`)

```json
{
  "object": "action",
  "id": "f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a",
  "type": "restart",
  "status": "succeeded",
  "serviceId": "c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d",
  "orderId": null,
  "invoiceId": null,
  "failure": null,
  "secretAvailable": false,
  "secretExpiresAt": null,
  "createdAt": "2026-12-04T09:20:11Z",
  "startedAt": "2026-12-04T09:20:11Z",
  "completedAt": "2026-12-04T09:20:39Z",
  "livemode": true
}
```

## What happened on the wire

Two kinds of request did the work: one that started the restart and one that
asked how it was going. The request that starts the work never waits for it, so
a slow restart cannot time out your code.

*Figure: The power request answers at once with an action, and the restart runs on our side while your code is free. Reading the action back shows where it is; the same action id ties the two calls together.*

> **If the network drops mid-request:** Send the same request again with the same `Idempotency-Key`. If the first one
> went through, you get its stored answer back, marked
> `Idempotent-Replayed: true`, and the restart happened once. The SDKs make the key and reuse it on
> their retries for you.

## Where to go next

- [Services reference](https://docs.clouduxe.com/api/reference/services/): Every field of a service and every endpoint that acts on one.
- [Build with AI](https://docs.clouduxe.com/api/build-with-ai/): Ready-made prompts for provisioning, syncing and webhooks, and how to give an AI these docs.
