---
title: Quick start
slug: quick-start
createdAt: 2026-11-24T23:26:53.025Z
---

In this guide you create an API key, find a machine, start a container on it, connect over SSH and stop it. Each step is shown four ways: the CLI, `curl`, Go and JavaScript. Follow the one you prefer.

You need an OctaSpace account with a positive balance: a running session is charged to it.

## 1. Create an API key

1. Sign in to the [OctaSpace dashboard](https://console.octa.space).
2. In the sidebar, open **Account → Credentials**.
3. In the **API Keys** section, click **New key**.
4. Enter a **Label** that tells you where the key is used, for example `quickstart`, and click **Create key**.
5. Copy the key. It starts with `octa_ak_`.

:::BlockQuote
**The key is shown in full only once**, right after you create it. If you lose it, delete it and create a new one.
:::

Export it in your shell, so the examples below can use it without the key appearing in your code or shell history:

```bash
read -rs OCTA_API_KEY && export OCTA_API_KEY
```

(Paste the key and press Enter; nothing is shown while you type.)

## 2. Install a tool

**CLI.** Download the binary for your platform from the [release page](https://github.com/octaspace/octa-cli/releases), put it on your `PATH` and log in:

```bash
octa --version
octa auth "$OCTA_API_KEY"
```

`octa auth` checks the key and saves it to `~/.config/octa/config.yaml` (readable only by you).

**curl.** Nothing to install. The examples also use [`jq`](https://jqlang.org) to read JSON.

**Go** (1.20 or later):

```bash
go get github.com/octaspace/go-sdk
```

**JavaScript / TypeScript** (Node.js 22 or later, Deno, Bun or a browser):

```bash
npm install @octaspace/sdk
```

## 3. Check your balance

**CLI**

```bash
octa account
```

**curl**

```bash
curl -s https://api.octa.space/accounts/balance \
  -H "Authorization: Bearer $OCTA_API_KEY"
```

The balance is in micro-USD: `12500000` is $12.50.

**Go**

```go
client := octaspace.NewClient(os.Getenv("OCTA_API_KEY"))

balance, err := client.Accounts.Balance(ctx)
if err != nil {
	log.Fatal(err)
}
fmt.Println("Balance:", balance.Balance) // Balance: $12.500000
```

**JavaScript**

```javascript
import { OctaClient, formatUsd } from '@octaspace/sdk'

const client = new OctaClient({ apiKey: process.env.OCTA_API_KEY })

const { balance } = await client.accounts.balance()
console.log('Balance:', formatUsd(balance)) // Balance: $12.500000
```

If you get `401 Invalid bearer token`, the key is wrong or was deleted.

## 4. Find a machine

Every machine has a **node number** such as `7KQ4-M2XD-4`. Pick one from the listing and note its number.

**CLI**

```bash
octa compute
octa compute search "rtx 4090"
```

`search` matches the CPU and GPU model, country and city.

**curl**

```bash
curl -s https://api.octa.space/services/compute \
  -H "Authorization: Bearer $OCTA_API_KEY" \
  | jq -r '.[] | [.node_number, .city, .base_price] | @tsv'
```

`base_price` is the price per hour in micro-USD.

**Go**

```go
machines, err := client.Compute.List(ctx)
if err != nil {
	log.Fatal(err)
}
for _, m := range machines {
	fmt.Println(m.NodeNumber, m.City, m.BasePrice, "per hour")
}
```

**JavaScript**

```javascript
const machines = await client.compute.list()
for (const m of machines) {
  console.log(m.node_number, m.city, formatUsd(m.base_price), 'per hour')
}
```

:::BlockQuote
The listing also works without an API key, but then it is refreshed only about once an hour, and a machine you pick may already be taken.
:::

## 5. Start a session

Start an `ubuntu:24.04` container with SSH access. Replace `7KQ4-M2XD-4` with the node number you picked.

**CLI**

```bash
octa compute start --node 7KQ4-M2XD-4 --image ubuntu:24.04 --ssh --wait
```

`--wait` follows the progress (image pull, setup) and, when the session is ready, prints how to reach it.

**curl**

```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": "ubuntu:24.04", "ssh": true}'
```

The response is `201` with the session UUID:

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

Poll the session until its `status` changes from `starting` to `ready` (every few seconds is enough):

```bash
UUID=96e33710-ec12-11ed-8588-fa163e49e8aa
curl -s https://api.octa.space/services/$UUID/info \
  -H "Authorization: Bearer $OCTA_API_KEY" \
  | jq '{status, progress, pull_percent}'
```

**Go**

```go
uuid, err := client.Compute.Start(ctx, &octaspace.ComputeStartParams{
	NodeNumber: "7KQ4-M2XD-4",
	Image:      "ubuntu:24.04",
	SSH:        octaspace.Bool(true),
})
if err != nil {
	log.Fatal(err)
}

waitCtx, cancel := context.WithTimeout(ctx, 10*time.Minute)
defer cancel()

session, err := client.Sessions.WaitReady(waitCtx, uuid, nil)
if err != nil {
	log.Fatal(err)
}
```

**JavaScript**

```javascript
const { uuid } = await client.compute.start({
  node_number: '7KQ4-M2XD-4',
  image: 'ubuntu:24.04',
  ssh: true,
})

const session = await client.sessions.waitReady(uuid, {
  timeoutMs: 10 * 60_000,
  onProgress: (s) => console.log(s.status, s.progress, s.pull_percent),
})
```

Starting usually takes from a few seconds to a few minutes, depending on the image size. If the session stops while starting (for example, SSH could not be set up), the SDKs raise a "session stopped" error and the CLI reports it.

:::BlockQuote
**Minimum rent.** Each machine has a minimum rent time (`min_rent_minutes`). A session stopped earlier is charged as if it ran that long.
:::

## 6. Connect

When the session is `ready`, its info contains the SSH endpoints: `ssh.direct` (straight to the node) and `ssh.proxy` (through the OctaSpace proxy), each with `host`, `port` and `user`, plus `ssh.web`, a web terminal URL.

**CLI**

```bash
octa compute connect 96e3
```

The CLI accepts a unique prefix of the session UUID.

**curl**

```bash
curl -s https://api.octa.space/services/$UUID/info \
  -H "Authorization: Bearer $OCTA_API_KEY" \
  | jq '.ssh'
```

Then connect with the values you got:

```bash
ssh -p <port> <user>@<host>
```

**Go**

```go
if d := session.SSH.Direct; d != nil {
	fmt.Printf("ssh -p %d %s@%s\n", d.Port, d.User, d.Host)
}
```

**JavaScript**

```javascript
const d = session.ssh?.direct
if (d) console.log(`ssh -p ${d.port} ${d.user}@${d.host}`)
```

## 7. Stop the session

A session is charged until you stop it. Stopping twice is safe.

**CLI**

```bash
octa sessions            # your running sessions
octa sessions stop 96e3
```

**curl**

```bash
curl -s -X POST https://api.octa.space/services/$UUID/stop \
  -H "Authorization: Bearer $OCTA_API_KEY"
```

**Go**

```go
if _, err := client.Sessions.Stop(ctx, uuid); err != nil {
	log.Fatal(err)
}
```

**JavaScript**

```javascript
await client.sessions.stop(uuid)
```

After a few seconds the session disappears from `GET /sessions`, and its info returns `404`.

## If something goes wrong

Errors come with an HTTP status and a message, for example `{"message": "Insufficient balance"}`.

| Status       | What it means                                                             | What to do                                                                                 |
| ------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `400`, `422` | A parameter is missing or invalid (wrong node number, unknown field)      | Read the message and fix the request                                                       |
| `401`        | The API key is missing, wrong or deleted                                  | Check `OCTA_API_KEY`, create a new key if needed                                           |
| `404`        | The session has stopped or the UUID is unknown; the node is not available | List your sessions or pick another machine                                                 |
| `409`        | The session is still starting or restarting                               | Wait and try again                                                                         |
| `429`        | Too many requests                                                         | Wait the number of seconds in `Retry-After`                                                |
| `5xx`        | A temporary problem on our side                                           | Retry later. Before you retry a start, check `GET /sessions`: the session may have started |

When you contact support about a failed call, include the request ID: the SDKs expose it on the error object.

## Next steps

- Expose ports and HTTP services, set environment variables, run a startup script: see the `POST /services/compute` parameters in the [API reference](https://api.octa.space/swagger) or `octa compute start --help`.
- Start many sessions at once with batch start (`client.Compute.StartBatch` in Go, `client.compute.startBatch` in JavaScript).
- Hosting nodes? Manage their prices and maintenance with `octa hosting` or the `client.hosting` resource.
- Use the CLI in scripts: every command has `-o json`.
