Register a pack
POST https://weights.fyi/run/v1/streams/{stage_id}/packs
Authorization: Bearer <token> scope: submit
Content-Type: application/json- Available since
- 2026-10-28: included in this build; see What is live for deployment status.
- Answer time
- synchronous registration; source verification adds network reads with a five-second timeout per connect and read, not per call.
Registers one runnable pack or a lazy pointer, or a batch of up to 64, in a stream created by POST /v1/compute/plans. Use its stream_id as {stage_id}, or the authored stage identifier with ?plan_id=.... Repeating the same normalized registration returns it again. A different registration for the same identifier or ordinal conflicts.
A lazy pointer reserves work without reading it. Promote it by reposting its identifier and ordinal with runnable fields and state: "pending"; retain its item count and source provenance. Sealing prevents new identifiers but permits promotion of existing lazy packs. On a continuous stream (workload.continuous: true) a registration after the seal, or after the stage completed, lifts the seal and reopens the stage, as long as the plan's window is open. The record reader checks byte count and digest before decompression, then checks the number of nonblank lines; a format label alone does not convert columnar data into records.
Request
JSON object, at most 1 MiB. Integer fields below fit signed 64-bit integers; booleans and fractions are invalid. Unknown fields are retained and affect replay comparison.
| Name | Where | Required | Meaning |
|---|---|---|---|
Authorization | header | yes | Bearer token with submit. |
stage_id, plan_id | path, query | stage only | Stream identifier; optional plan disambiguates an authored stage identifier. |
pack_id | body | yes | Immutable identifier, unique within the stream: 1–128 ASCII letters, digits, dots, underscores, colons or hyphens. |
packs | body | batch alternative | 1–64 pack objects in place of one pack's fields. Beside packs the body may carry only verify_source, max_pending_packs, plan_id and stage_id. Each pack inherits the last three unless it sets its own; verify_source: true on the batch checks every pack, and sources are read concurrently. |
ordinal | body | no | Nonnegative order; omitted or null assigns the next ordinal, or reuses this pack's existing ordinal. |
item_count | body | yes | Positive record count (or upper-bound sequence span on raw web-crawl shards when bodiless crawl rows are skipped and reported as rows_skipped). |
state, lazy | body | no | state: lazy, pending or null; alternative boolean or null lazy. Omitted/null means runnable; supplied values must agree. Lazy pointers need no digest, size or prepared input until promotion. |
source_uri | body | runnable alternative | Source below; a lazy pointer may name a prefix. |
r2_input_uri | body | runnable alternative | Already prepared input under your tenant's storage namespace; takes precedence over source_uri. |
sha256 | body | runnable | 64 hexadecimal digits for the fetched bytes, before decompression; with a range, hash only that range. |
compressed_bytes | body | runnable | Nonnegative fetched byte count, including for uncompressed input. |
est_input_tokens, est_output_tokens | body | conditional | Nonnegative estimates; default to zero for runnable source_uri input, required with runnable r2_input_uri. |
byte_range | body | no | [start, end], with 0 <= start < end; end exclusive. Set compressed_bytes to end - start. A compressed range must contain complete frames; buffered packs must not exceed 512 MiB, while streamed Zstandard classifier packs support up to 4 GiB decoded. |
format | body | no | Nonempty string; catalog values: parquet, arrow_ipc, lance, jsonl_zst, jsonl, safetensors. Custom labels are retained. |
source_shards, prefix_hash | body | no | Shard identifiers as nonempty strings in a list; optional prefix hint. |
max_pending_packs | body | no | Positive admission limit overriding the stage's limit for this call. Pending plus live leased packs count; lazy pointers do not. |
plan_id, stage_id | body | no | If present, must match the resolved plan and authored stage identifier. |
verify_source | body or query | no | Boolean in JSON; query accepts 1, true, 0, false, ignoring case and surrounding whitespace. A false value cannot disable a service-required check. |
| URI rules | body | runnable | Supported scheme, authority and nonempty path; no whitespace, credentials, backslash or empty/dot/traversal segments. Only HTTPS permits queries or fragments. A terminal @sha256:<64-hex> path suffix pins the whole object; without a range it must match sha256, ignoring case. With a range, sha256 identifies only its bytes. |
| Protocol | Source form and reading behavior |
|---|---|
s3 | s3://<bucket>/<path>; configured storage and tenant access rules apply. |
r2 | r2://tenants/<tenant_id>/<path>; your tenant only. |
gs | gs://<bucket>/<path>; anonymous HTTPS read. |
az | az://<container>/<path> using the configured account, or abfss://<container>@<account>.dfs.core.windows.net/<path>; anonymous HTTPS read. |
https | https://<host>/<path> including signed capability URLs with query parameters; public addresses only, no custom authorization header. Keep the URL valid until execution. |
hf | hf://[datasets/]<org>/<repository>@<revision>/<path>; anonymous HTTPS read. Runnable packs still require sha256. |
oci | oci://<registry>/<repository>@sha256:<64-hex>; accepted as a source reference, but requires prestaging. Supply prepared record bytes through r2_input_uri for a runnable pack. |
Return value
201 Created, including replays and promotions: normalized registration plus source_probe. Registration omits state, lazy, verify_source and max_pending_packs; read progress through GET /v1/streams/{stage_id}/packs.
| Receipt field | Meaning |
|---|---|
source_probe.verified, mode | true, live_range_probe when something was checked; otherwise false, syntax_and_custody_only. |
source_probe.probes | Entries with pack_id, uri, HTTP status, supports_range, remote_bytes, magic_ok. Unknown or inapplicable checks are null; no reads gives []. |
| Batch answer | {"plan_id", "stage_id", "packs", "source_probe"}. packs holds one single-pack receipt per pack, in the order sent, each with its own source_probe; the outer source_probe combines every probe. |
| Batch acceptance | A batch is not one transaction. With verification, every pack is validated and its source read before the first is written, so a refused source registers nothing. Registration then commits pack by pack, in order: a later refusal (a 400 on one pack when nothing was verified, a 409, a 429 stream_backpressure) leaves the earlier packs registered. Keep your identifiers and content, read the backlog, and send the same batch again: packs already registered answer again unchanged, the rest register. |
Verification checks a short range, bounds, whole-object size when declared, and recognized format headers. It does not verify the full digest. OCI gets a reachability HEAD only. A lazy pointer without prepared input remains unverified when it has shards or neither digest nor nonzero byte count. Whole-object reads can accept 200 when the known size is small enough or matches compressed_bytes; explicit ranges require 206. Checks precede admission, including on retries; a failed retry leaves earlier accepted work intact.
Errors
| Status | Code | Action |
|---|---|---|
400 | invalid_json, invalid_compute_plan | Fix the body, source, identifiers or query. |
400 | source_unreachable, source_range_unsupported, source_range_out_of_bounds, source_size_mismatch, source_format_mismatch | Fix the source before retrying; see Errors. Nothing is registered. |
401, 403 | unauthorized, invalid_token, token_revoked, token_expired, scope_required, account_suspended, compute_tenancy_unauthorized | Restore authentication, submit scope or tenant access. |
404 | compute_stage_not_found | Check ownership and identifiers. |
409 | ambiguous_compute_stage, compute_plan_conflict | Specify the plan, preserve immutable content, or use an open stream. |
409 | compute_schedule_window_closed | A continuous stream cannot reopen past its window; consolidate into a plan whose window is open. |
413 | body_too_large | Keep JSON within 1 MiB. |
429 | stream_backpressure | Wait for active work to drain. Fields: status: "backpressure", policy_signal: "WIND_DOWN_UNTIL_DRAINED", active_packs, pending, leased_live, max_pending_packs. No Retry-After is supplied by this refusal. In a batch, the packs before the refused one stay registered. |
429 | rate_limited | Wait Retry-After. |
503 | source_probe_unavailable | Required storage configuration is unavailable; retry after it is restored. |
Examples
Replace the illustrative source with your workload's records and actual digest and size. This transport example describes a three-byte object containing {} and a newline:
curl -s -X POST 'https://weights.fyi/run/v1/streams/STAGE_ID/packs?plan_id=PLAN_ID&verify_source=1' \
-H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
-d '{"pack_id":"p0","item_count":1,"source_uri":"https://files.example.test/p0.jsonl?sig=SIGNED_VALUE","sha256":"ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356","compressed_bytes":3,"format":"jsonl"}'{
"plan_id": "PLAN_ID", "stage_id": "STAGE_ID", "pack_id": "p0", "ordinal": 0,
"item_count": 1, "source_uri": "https://files.example.test/p0.jsonl?sig=SIGNED_VALUE",
"sha256": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
"compressed_bytes": 3, "format": "jsonl", "r2_input_uri": null,
"est_input_tokens": 0, "est_output_tokens": 0, "prefix_hash": null,
"source_probe": {"verified": true, "mode": "live_range_probe", "probes": [
{"pack_id": "p0", "uri": "https://files.example.test/p0.jsonl?sig=SIGNED_VALUE",
"status": 206, "supports_range": true, "remote_bytes": 3, "magic_ok": null}
]}
}Patterns
Reserve a range without preparing it:
{"pack_id":"p1","ordinal":1,"item_count":1,"state":"lazy","source_uri":"https://files.example.test/records.jsonl","byte_range":[1024,1027],"format":"jsonl"}After preparing that exact range, repost the same identity, count and provenance as runnable. Here the selected bytes are {} plus a newline:
{"pack_id":"p1","ordinal":1,"item_count":1,"state":"pending","source_uri":"https://files.example.test/records.jsonl","byte_range":[1024,1027],"format":"jsonl","sha256":"ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356","compressed_bytes":3,"verify_source":true}History
- 2026-10-28: documented runnable and lazy registrations, source verification and range hydration.
- 2026-11-16: documented the batch body, its answer and pack-by-pack acceptance.