---
title: API reference
slug: api-reference
createdAt: 2026-11-24T23:59:43.123Z
---

The OctaSpace API is a JSON REST API at:

```text
https://api.octa.space
```

## OpenAPI schema

The API is described by an OpenAPI 3 document. It is the source of truth for every endpoint, parameter, response and error message.

| Schema (JSON)        | [`https://api.octa.space/openapi.json`](https://api.octa.space/openapi.json) |
| -------------------- | ---------------------------------------------------------------------------- |
| Interactive explorer | [`https://api.octa.space/swagger`](https://api.octa.space/swagger)           |

In the explorer, click **Authorize**, paste your API key and you can send requests right from the page. Remember that start requests are real and charged to your balance.

## Endpoints

| Group        | Method and path                              | Key      | Description                                                          |
| ------------ | -------------------------------------------- | -------- | -------------------------------------------------------------------- |
| **Account**  | `GET /accounts/balance`                      | Yes      | Available balance                                                    |
| **Compute**  | `GET /services/compute`                      | Optional | Machines for rent                                                    |
|              | `POST /services/compute`                     | Yes      | Start a session; with an array body, a batch start                   |
|              | `POST /services/compute/{uuid}/restart`      | Yes      | Restart a session's container                                        |
|              | `GET /compute/apps`                          | Optional | Official apps, and your own with a key                               |
| **Render**   | `GET /services/render`                       | Optional | Render nodes for rent                                                |
|              | `POST /services/render`                      | Yes      | Start a render session, or a batch                                   |
| **VPN**      | `GET /services/vpn`                          | Optional | VPN nodes and the protocols they passed                              |
|              | `POST /services/vpn`                         | Yes      | Start a VPN session                                                  |
| **Sessions** | `GET /sessions`                              | Yes      | Your running sessions                                                |
|              | `GET /services/{uuid}/info`                  | Yes      | One session                                                          |
|              | `GET /services/{uuid}/logs`                  | Yes      | Platform events and container output (`tail` 1 to 1000, default 200) |
|              | `POST /services/{uuid}/stop`                 | Yes      | Stop a session                                                       |
| **Hosting**  | `GET /hosting/nodes`                         | Yes      | Your online nodes                                                    |
|              | `GET /hosting/nodes/{number}`                | Yes      | One of your nodes                                                    |
|              | `PATCH /hosting/nodes/{number}/prices`       | Yes      | Change prices; only the fields you send change                       |
|              | `PUT /hosting/nodes/{number}/maintenance`    | Yes      | Take the node off rent                                               |
|              | `DELETE /hosting/nodes/{number}/maintenance` | Yes      | Offer the node for rent again                                        |
| **Network**  | `GET /network`                               | No       | Platform statistics now                                              |
|              | `GET /network/history`                       | No       | Platform statistics over time                                        |
| **Stats**    | `GET /stats/gpu/current`                     | No       | GPU market: counts and price percentiles per model                   |
|              | `GET /stats/gpu/history`                     | No       | The same over time                                                   |
|              | `GET /stats/gpu/locations`                   | No       | GPUs by city and model                                               |
|              | `GET /stats/mining`                          | No       | Mining statistics                                                    |

## Conventions

| Topic          | Rule                                                                                                             |
| -------------- | ---------------------------------------------------------------------------------------------------------------- |
| Authentication | `Authorization: Bearer <api key>`, see [Authentication](#)                                                       |
| Request bodies | JSON with `Content-Type: application/json`. **Unknown fields are rejected with `400`**                           |
| Responses      | JSON. Treat unknown fields as normal: new fields are added without notice                                        |
| Amounts        | Integer micro-USD, see [Pricing and billing](#)                                                                  |
| Times          | Unix milliseconds for sessions and logs, Unix seconds for statistics, ISO 8601 for `online_at` of nodes          |
| Identifiers    | `{uuid}` is a session, `{number}` is a node number, see [Services and sessions](#)                               |
| Errors         | Status code and `{"message": "..."}`, see [Errors and rate limits](#)                                            |
| Request ID     | `X-Request-Id` response header; send your own to correlate with your logs                                        |
| Compression    | Send `Accept-Encoding: gzip`; large listings are served compressed                                               |
| Caching        | Machine listings carry an `ETag`. Send it back in `If-None-Match` to get `304 Not Modified` when nothing changed |

## Example: start a compute session

```bash
curl -s https://api.octa.space/services/compute \
  -H "Authorization: Bearer $OCTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "node_number": "7KQ4-M2XD-4",
    "image": "python:3.12",
    "disk_size": 50,
    "envs": { "MODEL": "custom" },
    "http_ports": [8080],
    "entrypoint": "sh -c",
    "args": "\"python -m http.server 8080\"",
    "ssh": true
  }'
```

`201 Created`:

```json
{ "uuid": "96e33710-ec12-11ed-8588-fa163e49e8aa" }
```

`400 Bad Request`:

```json
{ "message": "Insufficient balance" }
```

All start parameters are described in the guide [Configure a compute session](#) and in the schema (`ComputeRequest`).

## Generating a client for another language

Official SDKs exist for [Go](#) and [JavaScript / TypeScript](#). For any other language, generate a client from the schema with [OpenAPI Generator](https://openapi-generator.tech), for example for Python:

```bash
curl -s https://api.octa.space/openapi.json -o octaspace-openapi.json
npx @openapitools/openapi-generator-cli generate \
  -i octaspace-openapi.json -g python -o ./octaspace-client
```

A generated client gives you models and request methods, but not the extras of the official SDKs: waiting for a session to become ready, safe retries and typed errors. Follow the [retry rules](#) yourself: never repeat a start request automatically.

## Stability

The API is in active development. Endpoints and fields are added regularly; existing fields keep their meaning. To stay compatible:

- ignore response fields you do not use, and do not fail on new ones;
- validate the fields you do use;
- prefer the SDKs, which follow API changes in their releases.
