# Registry builds

Private neuron registries for your own models.

Related guide: [Builds and canary sets](https://provenanceauth.com/docs/trace/guides/registry-builds.md)

## Endpoints

- `POST /v1/trace/registry_builds`: [Create a registry build](#post-v1-trace-registry-builds)
- `GET /v1/trace/registry_builds/{id}`: [Retrieve a registry build](#get-v1-trace-registry-builds-id)
- `GET /v1/trace/registry_builds`: [List registry builds](#get-v1-trace-registry-builds)

## The registry build object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Unique identifier for the object. |
| `object` | enum | yes | The type of object. One of `registry_build`. |
| `status` | string | yes | The object's current status. |
| `hf_id` | string | yes | The model's Hugging Face ID. |
| `revision` | string | yes | The model's commit revision. |
| `corpus_ref` | string | yes | The corpus the build read. |
| `families` | array of strings | yes | Canary families. |
| `registry_size` | integer | yes | How many neurons to describe. |
| `attempts` | integer | yes | How many delivery attempts were made. |
| `result` | object \| null | yes | The build's result once it completes (the registry it wrote), else null. |
| `error` | string \| null | yes | An error, when one occurred. |
| `created_at` | string | yes | When it was created. |
| `updated_at` | string | yes | When it last changed. |
| `expires_at` | string | yes | When it expires. |
| `poll_url` | string | yes | The URL to poll for the result. |

### Example

```json
{
  "id": "tjob_01M6VQC403RG3M4981BTHAQGC8",
  "object": "registry_build",
  "status": "pending",
  "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
  "revision": "7ae55760",
  "corpus_ref": "default",
  "families": [
    "prompt_injection"
  ],
  "registry_size": 4096,
  "attempts": 0,
  "result": null,
  "error": null,
  "created_at": "2026-11-07T19:22:10.307Z",
  "updated_at": "2026-11-07T19:22:10.307Z",
  "expires_at": "2026-11-10T19:22:10.307Z",
  "poll_url": "/v1/trace/registry_builds/tjob_01M6VQC403RG3M4981BTHAQGC8"
}
```

## Create a registry build

`POST /v1/trace/registry_builds`

*Available on Enterprise.*

Builds a private neuron registry for your own model on a trace worker: labeled neurons and canary families measured on held-out examples. Poll the job.

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). |
| `hf_id` | body | string | yes | The model's Hugging Face ID. |
| `revision` | body | string | yes | A Hugging Face commit SHA, not a branch. |
| `corpus_ref` | body | string | no | A corpus the worker ships, by name (never a URL or path). |
| `families` | body | array of strings | no | Canary families to select (default: all eval sets on the worker). |
| `registry_size` | body | integer | no | How many neurons to describe. |

### Returns

The build, now queued. Poll it for the result. See [the registry build object](#object).

### 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)
- [`trace_backend_not_configured`](https://provenanceauth.com/docs/platform/errors.md#trace_backend_not_configured)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/trace/registry_builds" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
      "prompt_injection"
    ]
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/registry_builds`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
      "prompt_injection"
    ]
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/registry_builds", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
        "prompt_injection"
    ]
}).json()
```

### Response 202

```json
{
  "id": "tjob_01M6VQC403RG3M4981BTHAQGC8",
  "object": "registry_build",
  "status": "pending",
  "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
  "revision": "7ae55760",
  "corpus_ref": "default",
  "families": [
    "prompt_injection"
  ],
  "registry_size": 4096,
  "attempts": 0,
  "result": null,
  "error": null,
  "created_at": "2026-11-07T19:22:10.307Z",
  "updated_at": "2026-11-07T19:22:10.307Z",
  "expires_at": "2026-11-10T19:22:10.307Z",
  "poll_url": "/v1/trace/registry_builds/tjob_01M6VQC403RG3M4981BTHAQGC8"
}
```

## Retrieve a registry build

`GET /v1/trace/registry_builds/{id}`

Returns a registry build's status and, when finished, the private model it created.

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

### Parameters

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

### Returns

The registry build. See [the registry build object](#object).

### 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 -s -X POST "$PROVENANCE_API/v1/trace/registry_builds" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
      "prompt_injection"
    ]
  }' > step.json
export BUILD_ID=$(jq -r '.id' step.json)
sleep 8
curl "$PROVENANCE_API/v1/trace/registry_builds/$BUILD_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/registry_builds`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
      "prompt_injection"
    ]
  }),
})).json();
const buildId = step1.id;
await new Promise((ok) => setTimeout(ok, 8000));
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/registry_builds/${buildId}`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import time
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/trace/registry_builds", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
    "revision": "7ae55760",
    "families": [
        "prompt_injection"
    ]
}).json()
build_id = step1["id"]
time.sleep(8)
data = httpx.get(f"{api}/v1/trace/registry_builds/{build_id}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "tjob_01M6VQC4040NBNY867G79N8X7M",
  "object": "registry_build",
  "status": "completed",
  "hf_id": "Qwen/Qwen2.5-0.5B-Instruct",
  "revision": "7ae55760",
  "corpus_ref": "default",
  "families": [
    "prompt_injection"
  ],
  "registry_size": 4096,
  "attempts": 1,
  "result": {
    "model_version_id": "qwen2.5-0.5b-instruct@7ae55760-a21d8266",
    "status": "fixture",
    "backend": "fixture",
    "neurons": 128,
    "labeler": "heuristic-topk@1 (token/topic agreement over top-5 examples; no LLM)",
    "canary_sets": [
      {
        "set_id": "cs_9f213ab11e014bdfb25c50b9",
        "family": "prompt_injection",
        "member_count": 2,
        "validation": {
          "precision": 0.5625,
          "recall": 0.9,
          "eval_set": "python/trace-worker/eval_sets/prompt_injection.jsonl#odd-pairs",
          "n": 20,
          "grade": "fixture"
        }
      }
    ],
    "build_notes": "fixture replay of the recorded build (scripts/gen_fixtures.py) — registry_size and corpus_ref were not applied"
  },
  "error": null,
  "created_at": "2026-11-07T19:22:10.308Z",
  "updated_at": "2026-11-07T19:22:10.355Z",
  "expires_at": "2026-11-10T19:22:10.308Z",
  "poll_url": "/v1/trace/registry_builds/tjob_01M6VQC4040NBNY867G79N8X7M"
}
```

## List registry builds

`GET /v1/trace/registry_builds`

Lists your account's registry builds.

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

### Parameters

No parameters.

### Returns

The registry builds, newest first.

### 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/registry_builds" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/registry_builds`, {
  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/registry_builds", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

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