Documentation
Datasets
View .mdOpenAPI

Upload a dataset file

PUThttps://weights.fyi/run/v1/datasets/{dataset_id}/contentscope: submit
text
PUT https://weights.fyi/run/v1/datasets/<dataset_id>/content
Authorization: Bearer <token>                    scope: submit
Content-Type: application/x-ndjson

<the file: one labelled page per line>
Available since
2026-10-08, with fine-tuning. Implemented 2026-10-09: credit needed, bounded uploads, clean retries. the whole dataset checked at upload.
Answer time
synchronous: the answer comes when the last byte of the file has been read, checked and stored. The customer journey uploaded its dataset at 3.72 MiB/s on the live service on 2026-10-08, so the time is mostly the time your connection takes to carry the file.

Uploads the NDJSON file of a dataset made with POST /v1/datasets: one labelled page per line, the fields and rules on Fine-tune a model. The file streams to storage in parts of 64 MiB, hashed on the way; each line is read in memory for its keys only and never logged. The upload checks each row and the whole dataset, including identifiers, split overlap, provenance, state digests and label support, and refuses blank lines. The local check below catches the same issues before uploading.

The upload is all or nothing: a refused line, a file past its limit or a line longer than one part discards what was stored and leaves the dataset failed; send the corrected file to the same address, and the service first removes what the failed attempt left. Since the merge of 2026-10-09 an upload needs available credit, your account runs 1 at a time and the service 2, and an upload is cut after 30 s without data or 900 s in all; the 161 MB dataset of the live drill took 41 s on 2026-10-08. Fine-tuning is switched on for this service.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token with submit; counts against its request rate.
Content-Typeheadernoapplication/x-ndjson (also application/ndjson, application/jsonl, application/x-jsonlines, application/octet-stream, text/plain, or none); others 415.
Content-LengthheadernoWhen given and over the limit, refused before a byte is read; a chunked upload is read until it passes the limit.
dataset_idpathyesA dataset in status uploading or failed.
the bodybodyyesThe file, at most 440 MiB and, since the merge of 2026-10-09, at most what the dataset reserved.

Return value

200 OK when the whole file is stored; the dataset is ready.

FieldMeaning
dataset_idThe dataset's identifier, as in the path.
statusready: the file is accepted and a training job may use the dataset.
rowsHow many accepted rows the file holds; blank lines are refused.
train_rowsHow many rows have split train.
validation_rowsHow many rows have split validation.
other_rowsHow many rows have any other split; they are kept in the file and left out of training. This count appears only in this answer, not in the dataset's view.
bytesThe file's size in bytes, exactly as received.
sha256The SHA-256 of the file exactly as received. Compare it with the digest of your own copy, for example with shasum -a 256, to know that what arrived is what you sent.

Errors

StatusCodeWhen it happensWhat to do
400invalid_json_line, invalid_lineA line is not JSON, or not a JSON object; line gives its number.Fix that line and upload again.
400missing_fieldA line lacks id, split, label or state; field names it and line gives the line.Add the field.
400unknown_labelA line's label is not one of the dataset's; allowed lists them.Use one of the five labels.
400invalid_splitA line's split is not a non-empty string.Use train or validation.
400no_rowsThe file holds no row at all; expected describes a line.Send the file with its rows.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
403scope_required, account_suspendedThe token lacks submit, or the account is suspended.Use a token with submit.
404dataset_not_foundThere is no such dataset, it is another account's, or it was deleted.Check the id; make a new dataset if it was deleted.
404not_configuredFine-tuning is not switched on for this service (feature is training).See Fine-tune a model.
409dataset_already_uploadedThe dataset is already ready; a file cannot be replaced.Make a new dataset for the new file.
413dataset_too_largeThe file is larger than max_bytes.Split the pages over more than one dataset, or leave some out.
413line_too_largeOne line is longer than one upload part; line and limit_bytes say which and how much.Shorten the page in that line.
415unsupported_media_typeThe Content-Type is not one of those above.Send application/x-ndjson.
429rate_limitedThe token sends work faster than its request rate.Wait the Retry-After seconds and send again.
400invalid_identifier, duplicate_example_id, group_split_overlap, invalid_provenance, invalid_example_weight, invalid_state, state_digest_mismatch, multiple_labels, field_targets_not_trainable, train_and_validation_required, missing_label_supportThe dataset check at upload; line says where, train_rows and validation_rows count the splits, split and missing_labels name the missing support.Fix the rows named.
402no_creditYour available credit is zero or less (merged 2026-10-09).Add credit.
408upload_timed_outNo data arrived for 30 s (merged 2026-10-09).Send the file again.
409dataset_busyAnother upload or a delete of this dataset is running (merged 2026-10-09).Wait for it to end.
429upload_concurrency_limitYour account's or the service's uploads are all in use (merged 2026-10-09).Wait the Retry-After seconds.
502storage_unavailableOur storage refused a part; storage_status and storage_code give its own status and code, never more.Send the file again; the dataset is failed and takes a new upload.

Examples

sh
curl -s -T dataset.ndjson https://weights.fyi/run/v1/datasets/DATASET_ID/content \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/x-ndjson"
json
{
  "dataset_id": "ds_12be8b8818ceaf13696e7ff9",
  "status": "ready",
  "rows": 50,
  "train_rows": 40,
  "validation_rows": 10,
  "other_rows": 0,
  "bytes": 8935,
  "sha256": "96c0db13101fe3bbdf7aa2fa278fe54799434ae60fc1ecbe52e66f9fb972f506"
}

Patterns

Checking a dataset before you upload

This script applies the training's own rules, in its order, and prints the first one a file breaks with the code a failed job would show:

python
import hashlib, json, math, sys

LABELS = ["detail", "listing", "landing", "not_vacancy", "unresolved"]
ids, groups, support = set(), {}, {"train": set(), "validation": set()}
with open(sys.argv[1], encoding="utf-8") as file:
    for number, line in enumerate(file, 1):
        if not line.strip():
            sys.exit(f"line {number}: blank; the training reads every line as JSON")
        row = json.loads(line)
        key, split, group = str(row["id"]), row["split"], row.get("group_id")
        if key in ids:
            sys.exit(f"line {number}: duplicate_example_id")
        ids.add(key)
        if not group:
            sys.exit(f"line {number}: missing_group_id")
        if groups.setdefault(group, split) != split:
            sys.exit(f"line {number}: group_split_overlap")
        if split not in support:
            continue  # counted in other_rows, left out of training
        if row["label"] not in LABELS or type(row.get("provenance")) is not dict:
            sys.exit(f"line {number}: invalid_label_or_provenance")
        weight = float(row.get("weight", 1.0))
        if not math.isfinite(weight) or weight <= 0:
            sys.exit(f"line {number}: invalid_example_weight")
        state = row["state"]
        text = state if type(state) is str else json.dumps(state, ensure_ascii=False, separators=(",", ":"))
        if row.get("state_sha256") is not None and hashlib.sha256(text.encode()).hexdigest() != row["state_sha256"]:
            sys.exit(f"line {number}: state_digest_mismatch")
        support[split].add(row["label"])
if not support["train"] or not support["validation"]:
    sys.exit("train_and_validation_required")
for split, seen in support.items():
    if set(LABELS) - seen:
        sys.exit(f"missing_label_support:{split}")
print("ok:", len(ids), "rows")

History

  • 2026-10-08: live with fine-tuning: streamed uploads, the per-line check, the digest in the answer. The live drill's dataset uploaded at 3.72 MiB/s.
  • 2026-10-09 (merged): credit needed; uploads limited and cut when idle or too long; 64 MiB parts, also the longest line; a retry cleans up first.
  • 2026-10-10 implementation review: the whole contract checked at upload, blank lines refused.

See also

POST /v1/datasets, POST /v1/jobs (finetune), Fine-tune a model.