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

# POST /v1/streams/{stage_id}/seal

```text
POST https://weights.fyi/run/v1/streams/{stage_id}/seal
Authorization: Bearer <token>                    scope: submit
```

**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 state update; returns without waiting for unfinished packs.

Marks the end of a stream: no new pack identifiers may be registered. Register every intended pack first, including lazy pointers. Existing lazy registrations can still be promoted, and identical registration or completion replays remain valid after sealing.

Sealing does not cancel work or discard unfinished packs. The stream finishes when all registered packs are completed or otherwise settled under its incomplete-work policy and its dependencies allow completion. Repeating this call is safe; its returned state reflects current progress. On a continuous stream (`workload.continuous: true`) a later pack registration or [consolidation](/run/docs/reference/compute-plans-consolidate.md) lifts the seal; cancel the plan to end it.

## Request

No body is required; the handler does not read one.

| Name | Where | Required | Meaning |
|---|---|---|---|
| `Authorization` | header | yes | Bearer token with `submit`. |
| `stage_id` | path | yes | The plan's `stream_id`, or an authored stage identifier. |
| `plan_id` | query | no | Disambiguates an authored stage identifier; must agree with a qualified identifier. |

For classifier and embedding streams, the sum of registered `item_count` values must equal `total_items`. An open stream initially declaring `total_items: 0` adopts that sum on its first seal. Lazy packs count toward the sum.

## Return value

**200 OK**:

| Field | Meaning |
|---|---|
| `plan_id`, `stage_id`, `stream_id` | Plan identifier, authored stage identifier and qualified `plan_id~stage_id`. |
| `sealed` | Always `true` on success. Backlog reads expose this as `stream_sealed`. |
| `state` | Stage state after sealing; may already be `completed`. |
| `total_items` | Present for classifier and embedding streams, including an inferred total for an open stream. |

The last pack's completion can finish a sealed stream later. Sealing an already drained stream may finish it immediately; an unsealed terminal stage is refused.

## Errors

| Status | Code | Action |
|---|---|---|
| `400` | `invalid_compute_plan` | Use a stage that accepts stream packs. |
| `401` | `unauthorized`, `invalid_token`, `token_revoked`, `token_expired` | Supply a valid token. |
| `403` | `scope_required`, `account_suspended` | Restore `submit` scope or account access. |
| `404` | `compute_stage_not_found` | Check ownership and identifiers. |
| `409` | `ambiguous_compute_stage` | Supply `plan_id` or use `stream_id`. |
| `409` | `compute_plan_conflict` | Match the declared item total, or inspect the terminal stage's result. |
| `429` | `rate_limited` | Wait `Retry-After`. |

## Examples

```sh
curl -s -X POST 'https://weights.fyi/run/v1/streams/STAGE_ID/seal?plan_id=PLAN_ID' \
  -H "Authorization: Bearer $WEIGHTS_API_KEY"
```

A classifier stream whose registered packs have all completed:

```json
{
  "plan_id": "PLAN_ID", "stage_id": "STAGE_ID", "stream_id": "PLAN_ID~STAGE_ID",
  "sealed": true, "state": "completed", "total_items": 100
}
```

## History

- 2026-10-28: documented end-of-stream, inferred totals and completion after draining.

## 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}/packs/{pack_id}/complete](/run/docs/reference/streams-packs-complete.md).
