# Sidecar

Signed readings from a trace worker you run yourself.

Related guide: [Sidecar](https://provenanceauth.com/docs/self-host/sidecar.md)

## Endpoints

- `POST /v1/trace/worker_keys`: [Register a worker key](#post-v1-trace-worker-keys)
- `GET /v1/trace/worker_keys`: [List worker keys](#get-v1-trace-worker-keys)
- `POST /v1/trace/labels`: [Send your sidecar's labels](#post-v1-trace-labels)
- `DELETE /v1/trace/worker_keys/{id}`: [Revoke a worker key](#delete-v1-trace-worker-keys-id)
- `POST /v1/trace/readings`: [Send a sidecar reading](#post-v1-trace-readings)

## Register a worker key

`POST /v1/trace/worker_keys`

Registers the public half of the key your self-hosted sidecar signs readings with. Every plan can register keys: one active key on the Free trial and Pro, five on Growth, unlimited on Enterprise. Revoke a key to free its place. Each reading a key signs counts as one `trace_reading`.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `name` | body | string | yes | A name you choose. |
| `public_key_pem` | body | string | yes | EC P-256 public key, PEM (SPKI). |

### Returns

The worker key.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`trial_ended`](https://provenanceauth.com/docs/platform/errors.md#trial_ended)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/trace/worker_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "prod-sidecar",
    "public_key_pem": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVXBJf2k8eRxHn3oV1nqRm9o4Cq0Yv5mYk0n1nXy9zq3b0c8mY2r1Jx7aZgk3oJt3d8fX9x3b6n0Yp5mQ2sLw1A==\n-----END PUBLIC KEY-----"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/worker_keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "prod-sidecar",
    "public_key_pem": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVXBJf2k8eRxHn3oV1nqRm9o4Cq0Yv5mYk0n1nXy9zq3b0c8mY2r1Jx7aZgk3oJt3d8fX9x3b6n0Yp5mQ2sLw1A==\n-----END PUBLIC KEY-----"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/worker_keys", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "prod-sidecar",
    "public_key_pem": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVXBJf2k8eRxHn3oV1nqRm9o4Cq0Yv5mYk0n1nXy9zq3b0c8mY2r1Jx7aZgk3oJt3d8fX9x3b6n0Yp5mQ2sLw1A==\n-----END PUBLIC KEY-----"
}).json()
```

### Response 201

```json
{
  "id": "wk_5e1c9a3f7d2b8e04c6a1f9d3",
  "object": "trace_worker_key",
  "name": "gpu-pod-us-east-1",
  "created_at": "2026-10-24T22:49:40.006Z",
  "revoked_at": null
}
```

## List worker keys

`GET /v1/trace/worker_keys`

Lists your sidecar's registered signing keys.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The worker keys.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/trace/worker_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/worker_keys`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/trace/worker_keys", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```

## Send your sidecar's labels

`POST /v1/trace/labels`

Accepts neuron labels your sidecar made with its own labeller key, signed by its worker key (typ `provenance-trace-labels+jwt`). The signature is the credential, so no API key is sent. The claims carry only the model, the neuron IDs and the labels, never prompt text. They're stored for the key's account and never billed.

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | body | string | yes | The compact JWS. Claims: `model_version_id`, `iat` and `labels` (1 to 100 of `{neuron, label, confidence, labeler}`). |

### Returns

The stored labels. `credits` is always 0.

### Errors

- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`trace_reading_signature_invalid`](https://provenanceauth.com/docs/platform/errors.md#trace_reading_signature_invalid)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/trace/labels" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtbGFiZWxzK2p3dCIsImtpZCI6IndrXzAxTTVRMktEM043VjRZOVcxWFEyQjhSNlRTIn0.eyJtb2RlbF92ZXJzaW9uX2lkIjoicXdlbjIuNS0wLjViLWluc3RydWN0QDdhZTU1NzYwIn0.c2lnbmF0dXJl"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/labels`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtbGFiZWxzK2p3dCIsImtpZCI6IndrXzAxTTVRMktEM043VjRZOVcxWFEyQjhSNlRTIn0.eyJtb2RlbF92ZXJzaW9uX2lkIjoicXdlbjIuNS0wLjViLWluc3RydWN0QDdhZTU1NzYwIn0.c2lnbmF0dXJl"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/labels", json={
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtbGFiZWxzK2p3dCIsImtpZCI6IndrXzAxTTVRMktEM043VjRZOVcxWFEyQjhSNlRTIn0.eyJtb2RlbF92ZXJzaW9uX2lkIjoicXdlbjIuNS0wLjViLWluc3RydWN0QDdhZTU1NzYwIn0.c2lnbmF0dXJl"
}).json()
```

### Response 201

```json
{
  "object": "list",
  "credits": 0,
  "data": [
    {
      "object": "trace_neuron_label",
      "id": "tlb_01M7S6R2C4E6G8J0L2N4Q6S8U0",
      "model_version_id": "qwen2.5-0.5b-instruct@7ae55760",
      "neuron": "L13.1053.pos",
      "label": "dates and times",
      "confidence": 0.7,
      "labeler": "claude-haiku-5-5 (own key)",
      "source": "sidecar",
      "rechecked": false,
      "trace_id": null,
      "credits": 0,
      "created_at": "2026-11-19T06:12:40.020Z"
    }
  ]
}
```

## Revoke a worker key

`DELETE /v1/trace/worker_keys/{id}`

Revokes a worker key. Readings it signs are then refused.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The deleted worker key.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X DELETE "$PROVENANCE_API/v1/trace/worker_keys/wk_01M5Q2KD3N7V4Y9W1XQ2B8R6TS" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/worker_keys/wk_01M5Q2KD3N7V4Y9W1XQ2B8R6TS`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.delete(f"{api}/v1/trace/worker_keys/wk_01M5Q2KD3N7V4Y9W1XQ2B8R6TS", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "wk_5e1c9a3f7d2b8e04c6a1f9d3",
  "object": "trace_worker_key",
  "deleted": true
}
```

## Send a sidecar reading

`POST /v1/trace/readings`

Accepts a canary reading signed by your sidecar's worker key. The signature is the credential, so no API key is sent. A reading can be sent once. Each accepted reading counts as one `trace_reading` for the account that registered the key: 1,000 across the Free trial, then included amounts and graduated volume tiers on Pro and Growth. A refused reading counts nothing.

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | body | string | yes | The compact JWS. |

### Returns

The reading, with the trip when the sidecar reported one.

### Errors

- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`spend_cap_reached`](https://provenanceauth.com/docs/platform/errors.md#spend_cap_reached)
- [`spend_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#spend_limit_exceeded)
- [`trace_reading_replayed`](https://provenanceauth.com/docs/platform/errors.md#trace_reading_replayed)
- [`trace_reading_signature_invalid`](https://provenanceauth.com/docs/platform/errors.md#trace_reading_signature_invalid)
- [`trial_ended`](https://provenanceauth.com/docs/platform/errors.md#trial_ended)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/trace/readings" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtcmVhZGluZytqd3QiLCJraWQiOiJ3a18wMU01UTJLRDNON1Y0WTlXMVhRMkI4UjZUUyJ9.eyJ0cmFjZV9pZCI6InRyY19zaWRlY2FyXzEifQ.c2lnbmF0dXJl"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/readings`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtcmVhZGluZytqd3QiLCJraWQiOiJ3a18wMU01UTJLRDNON1Y0WTlXMVhRMkI4UjZUUyJ9.eyJ0cmFjZV9pZCI6InRyY19zaWRlY2FyXzEifQ.c2lnbmF0dXJl"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/readings", json={
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtdHJhY2UtcmVhZGluZytqd3QiLCJraWQiOiJ3a18wMU01UTJLRDNON1Y0WTlXMVhRMkI4UjZUUyJ9.eyJ0cmFjZV9pZCI6InRyY19zaWRlY2FyXzEifQ.c2lnbmF0dXJl"
}).json()
```

### Response 201

```json
{
  "id": "trd_01M5R0D6J1N5R9U2X4Z7B0D3FH",
  "object": "trace_reading",
  "trace_id": "trc_5fedfa76200df1c0d8d6458b5ed7aa5f",
  "canary_hash": "c742eeca0429baec0cfc9b6a7ef70f1d31dc5aba0e7badeba7ae208b6eaa9d44",
  "model_version_id": "qwen2.5-0.5b-instruct@7ae55760",
  "received_at": "2026-10-24T22:50:01.338Z",
  "trip": null,
  "predictions": {}
}
```
