> ## Documentation Index
> Fetch the complete documentation index at: https://weights.fyi/run/llms.txt

# POST /v1/streams/{stage_id}/packs/{pack_id}/complete

```text
POST https://weights.fyi/run/v1/streams/{stage_id}/packs/{pack_id}/complete
Authorization: Bearer <token>                    scope: submit
Content-Type: application/json
```

**Available since:** 2026-10-28: included in this build; see [What is live](/run/docs/what-is-live.md) for deployment status.

**Answer time:** synchronous receipt validation and commit; does not download or verify output bytes.

Records the durable output receipt for an already leased pack owned by an `awow_harness_lease` stage. Current plan admission assigns every stream kind to managed execution, so those streams return `403` here; adding lease fields to the body cannot grant completion authority. Clients register inputs, seal and poll while the runtime reports completion. The harness receipt contract below applies only if a harness-owned pack already exists.

The output must be in the plan tenant's namespace and under the stage's `output_prefix_uri`. The completed item count must equal the registration's count. An identical normalized receipt is safe to repeat: it returns the stored receipt without charging or counting the pack again. A conflicting receipt is refused.

## Request

JSON object, at most 1 MiB.

| Name | Where | Required | Meaning |
|---|---|---|---|
| `Authorization` | header | yes | Account bearer token with `submit`. |
| `stage_id`, `pack_id` | path | yes | Stream identifier or authored stage identifier, and registered pack identifier. |
| `plan_id` | query | no | Disambiguates an authored stage identifier. |
| `output_pack_uri` | body | yes | Durable output URI within the tenant and stage output prefix. |
| `output_pack_sha256` | body | yes | 64 hexadecimal digits identifying the output bytes. |
| `items_materialized` | body | yes | Nonnegative signed 64-bit integer; must equal the registered positive `item_count`. |
| `model_sha256` | body | conditional | Nonempty string required for classifier and embedding work, or whenever supplied; must match a checkpoint digest recorded by the lease when present. |
| `seat_model` | body | conditional | Must match the leased model when executing through an agent seat. |
| `plan_id`, `stage_id`, `pack_id`, `ordinal` | body | no | Filled from registration; if supplied, must match it. The body stage identifier is authored, not qualified. |

## Return value

**200 OK** with the normalized receipt, including its four identity fields. Additional submitted receipt fields are retained and participate in replay comparison.

A first completion increments pack and item progress, records charges and emits a completion event. It may prepare more work. A sealed stream whose packs are settled can finish and release dependent stages; an unsealed stream remains open.

## Errors

| Status | Code or cause | Action |
|---|---|---|
| `400` | `invalid_json`, `invalid_compute_plan` | Correct the receipt identity, output location, digest, model or item count. |
| `401` | `unauthorized`, `invalid_token`, `token_revoked`, `token_expired` | Supply a valid token. |
| `403` | `scope_required`, `account_suspended`, `compute_tenancy_unauthorized` | Restore `submit` scope, account or tenant access. |
| `403` | Execution authorization refusal | Let managed execution report its own completion; this route requires a harness-owned stage. |
| `404` | `compute_stage_not_found`, `compute_pack_not_found` | Check ownership and identifiers. |
| `409` | `ambiguous_compute_stage` | Supply `plan_id` or use `stream_id`. |
| `409` | `compute_plan_conflict` | Pack is unleased, stage is terminal, or receipt differs from the stored completion. |
| `413` | `body_too_large` | Keep JSON within 1 MiB. |
| `429` | `rate_limited` | Wait `Retry-After`. |

## Examples

Receipt form for an already leased, one-record harness pack whose output prefix is `r2://tenants/TENANT_ID/results/`. Current plan admission does not create such streams:

```sh
curl -s -X POST 'https://weights.fyi/run/v1/streams/STAGE_ID/packs/PACK_ID/complete?plan_id=PLAN_ID' \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -d '{"output_pack_uri":"r2://tenants/TENANT_ID/results/p0.jsonl","output_pack_sha256":"ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356","items_materialized":1}'
```

```json
{
  "plan_id": "PLAN_ID", "stage_id": "STAGE_ID", "pack_id": "PACK_ID", "ordinal": 0,
  "output_pack_uri": "r2://tenants/TENANT_ID/results/p0.jsonl",
  "output_pack_sha256": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
  "items_materialized": 1
}
```

## History

- 2026-10-28: documented receipt validation, completion authority and idempotent replay.

## See also

- [POST /v1/streams/{stage_id}/packs](/run/docs/reference/streams-packs-create.md).
- [GET /v1/streams/{stage_id}/packs](/run/docs/reference/streams-packs-list.md).
- [POST /v1/streams/{stage_id}/seal](/run/docs/reference/streams-seal.md).
