---
title: API conventions
description: >-
  These conventions apply across the Lightning Cloud API. The API reference is
  the authoritative source for each endpoint.
canonical: 'https://lightning.ai/docs/platform/cluster/reference/api-conventions'
---
# API conventions {#api-conventions}

These conventions apply across the Lightning Cloud API. The [API reference](/docs/platform/cluster/api-reference.md) is the authoritative source for each endpoint.

## Base URL and versioning {#base-url-and-versioning}

```text
https://api.<region>.voltagepark.com/v1/...
```

Choose the region where your fleet runs. See [Regions & endpoints](/docs/platform/cluster/get-started/regions.md). All public endpoints are under `/v1`.

The downloadable OpenAPI specification is linked from the footer of every page.

## Authentication {#authentication}

Send a bearer token on every request:

```http
Authorization: Bearer <token>
```

See [Authentication](/docs/platform/cluster/access/authentication.md).

## Request and response format {#request-and-response-format}

- Request and response bodies are JSON. Send `Content-Type: application/json` with a body.
- Field names are `camelCase`.
- Identifiers: `fleetId` is a UUID, and `nodeId` is the node's `nodeName` (for example `g1234`). In storage view URLs, `{view}` is the mount point without its leading slash (`/data` becomes `data`).
- Sizes are in bytes.

## Timestamps {#timestamps}

Most lifecycle timestamps on fleets, nodes, and history events (`requestedAt`, `createdAt`, `updatedAt`, `provisionedAt`, `eventTimestamp`) are **Unix epoch milliseconds, UTC**:

```json
{ "createdAt": 1755817319000 }
```

Some newer fields are **RFC 3339 strings, UTC**, for example kubeconfig `expiresAt` and the audit export's `windowStart`, `windowEnd`, and `expiresAt`:

```json
{ "expiresAt": "2026-12-31T23:59:59Z" }
```

Check the [API reference](/docs/platform/cluster/api-reference.md) for the type of each field. Don't assume one format everywhere.

## Pagination {#pagination}

List endpoints that can return many items use cursor pagination:

| Parameter | Description |
|-----------|-------------|
| `limit` | Maximum number of items to return. |
| `nextToken` | Opaque cursor from the previous response. |

```bash
next=""
while :; do
  page=$(curl -s "$API_URL/v1/fleets/$FLEET_ID/nodes?limit=100${next:+&nextToken=$next}" \
    -H "Authorization: Bearer $TOKEN")
  echo "$page" | jq -c '.nodes[]'
  next=$(echo "$page" | jq -r '.nextToken // empty')
  [ -z "$next" ] && break
done
```

- Treat `nextToken` as opaque and pass it back unchanged (URL-encode it if needed).
- Stop when `nextToken` is absent or `null`. A page can contain fewer items than `limit`, or none at all, while more pages remain.
- Paginated endpoints: `GET /v1/fleets`, `GET /v1/fleets/{fleetId}/nodes`, `GET /v1/fleets/{fleetId}/history`.

## Idempotency {#idempotency}

Mutations that support it accept an `Idempotency-Key` header. The first response to a key is stored, and any later request with the same key gets that stored response back without running the operation again.

```bash
KEY=$(uuidgen)       # one key per logical operation
curl -X POST ... -H "Idempotency-Key: $KEY"
# No response (timeout or network error)? Retry with the SAME key.
```

| Situation | Response |
|-----------|----------|
| Same key, same request, already answered | The stored first response, including its status code. |
| Same key, original still in progress | `409 Conflict` with `"error": "request_in_progress"`. Wait about 5 seconds and retry with the same key. |
| Same key, different body, method, path, or organization | `422 Unprocessable Entity` with `"error": "idempotency_key_mismatch"`. Use a new key. |

Two consequences:

- **Retrying doesn't show progress.** If the first response was `202 Accepted`, retries return `202` even after the operation finishes. Poll the matching read endpoint for the outcome.
- **A failed `POST` stays failed for that key.** Error responses to `POST` requests are stored too, so retrying with the same key returns the same error. Check the resource's current state, then start again with a **new** key if the operation still needs to run. (For `DELETE`, a `5xx` error is not stored, so retrying with the same key runs the request again.)

Operations that accept `Idempotency-Key`:

- `POST /v1/sshkeys`, `DELETE /v1/sshkeys/{sshKeyId}`
- `POST /v1/fleets/{fleetId}/sshkeys`, `DELETE /v1/fleets/{fleetId}/sshkeys/{sshKeyId}`
- `POST /v1/fleets/{fleetId}/nodes/{nodeId}/power`
- `POST /v1/fleets/{fleetId}/storage/modify`
- `POST /v1/fleets/{fleetId}/storage/views`
- `POST /v1/fleets/{fleetId}/cluster-validation`
- `POST /v1/fleets/{fleetId}/kubernetes-v2/nodes/{nodeId}/cordon`, `/uncordon`, `/drain`

Other mutations are idempotent by design: storage view `PATCH` and `DELETE` act on the resource's state, and `POST /v1/audit-logs/export` returns the existing archive for the day.

## Asynchronous operations {#asynchronous-operations}

Operations that take time return `202 Accepted`. Poll the matching read endpoint, honor any `Retry-After` header, and back off between polls. See the [table in Core concepts](/docs/platform/cluster/get-started/core-concepts.md#synchronous-and-asynchronous-operations).

## Errors {#errors}

Most errors return a JSON body with a machine-readable `error` code and a human-readable `message`:

```json
{
  "error": "NOT_FOUND",
  "message": "Fleet not found. Please verify the identifier and try again.",
  "details": {}
}
```

| Field | Description |
|-------|-------------|
| `error` | Machine-readable error code, such as `NOT_FOUND`. Branch on this, not on `message`. |
| `message` | Human-readable explanation. The wording can change. |
| `details` | Optional structured detail, such as per-field validation errors. |

Some endpoints add their own fields (for example, fleet health returns `fleetId` and `status` with a `422`), and a few errors are plain text. Check the `Content-Type` header, and keep the raw body when the expected fields are missing.

See [Errors & troubleshooting](/docs/platform/cluster/reference/errors.md).

## Retries {#retries}

| Status | Retry? |
|--------|--------|
| No response (timeout or network error) | Yes, with the **same** `Idempotency-Key`. |
| `409` with `request_in_progress` | Yes, after about 5 seconds, with the same key. |
| `429`, `500`, `502`, `503` | Yes, with exponential backoff and jitter. For a `POST` with an `Idempotency-Key`, the error is stored with the key, so check the resource's state first and retry with a **new** key. |
| Other `4xx` | No. Fix the request first. |

---

**Navigation**

- Parent: [Reference](/docs/platform/cluster/reference.md)
