Documentation
Compute plans and streams
View .mdOpenAPI

Register a pack

POSThttps://weights.fyi/run/v1/streams/{stage_id}/packsscope: submit
text
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.

NameWhereRequiredMeaning
AuthorizationheaderyesBearer token with submit.
stage_id, plan_idpath, querystage onlyStream identifier; optional plan disambiguates an authored stage identifier.
pack_idbodyyesImmutable identifier, unique within the stream: 1–128 ASCII letters, digits, dots, underscores, colons or hyphens.
packsbodybatch alternative1–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.
ordinalbodynoNonnegative order; omitted or null assigns the next ordinal, or reuses this pack's existing ordinal.
item_countbodyyesPositive record count (or upper-bound sequence span on raw web-crawl shards when bodiless crawl rows are skipped and reported as rows_skipped).
state, lazybodynostate: 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_uribodyrunnable alternativeSource below; a lazy pointer may name a prefix.
r2_input_uribodyrunnable alternativeAlready prepared input under your tenant's storage namespace; takes precedence over source_uri.
sha256bodyrunnable64 hexadecimal digits for the fetched bytes, before decompression; with a range, hash only that range.
compressed_bytesbodyrunnableNonnegative fetched byte count, including for uncompressed input.
est_input_tokens, est_output_tokensbodyconditionalNonnegative estimates; default to zero for runnable source_uri input, required with runnable r2_input_uri.
byte_rangebodyno[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.
formatbodynoNonempty string; catalog values: parquet, arrow_ipc, lance, jsonl_zst, jsonl, safetensors. Custom labels are retained.
source_shards, prefix_hashbodynoShard identifiers as nonempty strings in a list; optional prefix hint.
max_pending_packsbodynoPositive admission limit overriding the stage's limit for this call. Pending plus live leased packs count; lazy pointers do not.
plan_id, stage_idbodynoIf present, must match the resolved plan and authored stage identifier.
verify_sourcebody or querynoBoolean in JSON; query accepts 1, true, 0, false, ignoring case and surrounding whitespace. A false value cannot disable a service-required check.
URI rulesbodyrunnableSupported 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.
ProtocolSource form and reading behavior
s3s3://<bucket>/<path>; configured storage and tenant access rules apply.
r2r2://tenants/<tenant_id>/<path>; your tenant only.
gsgs://<bucket>/<path>; anonymous HTTPS read.
azaz://<container>/<path> using the configured account, or abfss://<container>@<account>.dfs.core.windows.net/<path>; anonymous HTTPS read.
httpshttps://<host>/<path> including signed capability URLs with query parameters; public addresses only, no custom authorization header. Keep the URL valid until execution.
hfhf://[datasets/]<org>/<repository>@<revision>/<path>; anonymous HTTPS read. Runnable packs still require sha256.
ocioci://<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 fieldMeaning
source_probe.verified, modetrue, live_range_probe when something was checked; otherwise false, syntax_and_custody_only.
source_probe.probesEntries 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 acceptanceA 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

StatusCodeAction
400invalid_json, invalid_compute_planFix the body, source, identifiers or query.
400source_unreachable, source_range_unsupported, source_range_out_of_bounds, source_size_mismatch, source_format_mismatchFix the source before retrying; see Errors. Nothing is registered.
401, 403unauthorized, invalid_token, token_revoked, token_expired, scope_required, account_suspended, compute_tenancy_unauthorizedRestore authentication, submit scope or tenant access.
404compute_stage_not_foundCheck ownership and identifiers.
409ambiguous_compute_stage, compute_plan_conflictSpecify the plan, preserve immutable content, or use an open stream.
409compute_schedule_window_closedA continuous stream cannot reopen past its window; consolidate into a plan whose window is open.
413body_too_largeKeep JSON within 1 MiB.
429stream_backpressureWait 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.
429rate_limitedWait Retry-After.
503source_probe_unavailableRequired 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:

sh
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"}'
json
{
  "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:

json
{"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:

json
{"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.

See also