# Observability

3 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## CPU, memory, disk and network use, read on the host[#]

GET`/v1/sandboxes/{id}/metrics`scope sandboxes:read

Read from outside the VM: it never wakes a sleeping sandbox or keeps one awake. Takes about a quarter second.

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

Responses

200401403404409501502

```
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/metrics \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## The sandbox's last commands, with exit codes and output tails[#]

GET`/v1/sandboxes/{id}/logs`scope sandboxes:read

Kept on the sandbox's host, the newest 200, and removed with the sandbox.

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

`limit`query · integer

—

Responses

200400401403404409501502

```
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/logs \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Replace the sandbox's labels (null clears them)[#]

PUT`/v1/sandboxes/{id}/labels`scope sandboxes:write

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

JSON body

`labels`requiredobject | null

Up to 16 labels: keys of 1-63 letters, digits, '.', '_', '/' or '-'; string values up to 256 characters

Responses

200400401403404

```
curl -s -X PUT https://api.kosa8.com/v1/sandboxes/$SBX/labels \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

---
Source: https://docs.kosa8.com/api/observability/
