# HTTP API

Base URL `https://runcompute.cloud`. Send the key as
`Authorization: Bearer rc_...`. Bodies are JSON. The full schema is at
[/api/openapi.json](/api/openapi.json), with an interactive version at
[/api/docs](/api/docs).

| Method and path | Auth | Description |
| --- | --- | --- |
| `POST /v1/signup` | no | Body `{"email": ...}`. Returns `{"api_key": ...}` |
| `GET /v1/offers` | no | Machine catalogue |
| `POST /v1/quote` | no | Job parameters in, ranked offers out |
| `GET /v1/me` | yes | Account for the key |
| `POST /v1/jobs` | yes | Submit a job |
| `GET /v1/jobs?status=&limit=` | yes | List jobs |
| `GET /v1/jobs/{id}` | yes | Job with its events |
| `GET /v1/jobs/{id}/events?after=` | yes | Events after a sequence number |
| `GET /v1/jobs/{id}/logs?tail=` | yes | Plain-text logs |
| `GET /v1/jobs/{id}/outputs` | yes | Saved files |
| `POST /v1/jobs/{id}/cancel` | yes | Cancel |
| `GET /v1/stats` | yes | Job counts and total spend |

## Submit with curl

```bash
curl -s https://runcompute.cloud/v1/jobs \
  -H "Authorization: Bearer $RUNCOMPUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"smoke","image":"pytorch/pytorch:latest","command":["python","-c","print(1)"],"min_vram":16,"work_units":0.5,"budget":5}'
```

## Errors

| Status | Meaning |
| --- | --- |
| `401` | Missing or unknown key |
| `404` | Job not found, or it belongs to another key |
| `422` | Invalid parameters, or no machine matches them |
