Input and results

The whole of a job, from the file you upload to the embeddings you download: how to prepare the input, submit it, watch it run, and read the results and the records we could not embed.

1. Prepare the input

The input is one UTF-8 JSONL file. Each line is one JSON object:

{"custom_id": "doc-1", "text": "The first document."}
{"custom_id": "doc-2", "text": "The second document.", "source": "crawl-7"}
  • custom_id is a string, unique in the file. It is how you match a result to your document.
  • text is a non-empty string: the text to embed.
  • Other fields are ignored, and blank lines are skipped.
  • The file must not start with a byte order mark.
  • Each line is at most 1 MiB (1,048,576 bytes), before its line ending.
  • The file is at most 1 GB (1,000,000,000 bytes).

We check every line before any work starts. A file that breaks a rule fails the job at once, and the job's error names up to 20 of the offending lines and why.

2. Submit the job

Reserve a file and upload to it directly. The API never handles your file's bytes.

POST /v1/files

201 Created
{
  "id": "file_...",
  "file_id": "file_...",
  "upload_url": "https://..."
}

Send the file with an HTTP PUT to upload_url, which is valid for one hour. Then create the job:

POST /v1/jobs
{
  "model": "<a model id from GET /v1/models>",
  "input": { "file_id": "file_..." },
  "overflow": "truncate"
}

output_format is parquet (the default) or jsonl. overflowsays what happens to a record longer than the model's token limit:

  • truncate(the default) embeds the record's first tokens. It is counted in records_truncated.
  • skipleaves the record out and lists it in the job's errors with the reason too_long.

The upload must exist and be within the 1 GB limit when you create the job, or the request is refused. We delete an uploaded file 7 days after the last job that read it ends, and at most 14 days after you upload it.

3. Watch progress

GET /v1/jobs/{id}

{
  "id": "job_...",
  "status": "running",
  "records_total": 1000000,
  "records_embedded": 411998,
  "records_truncated": 31,
  "records_skipped": 0,
  "records_errored": 2,
  "num_shards": 1000,
  "shards_completed": 412,
  "started_at": "2026-11-18T09:00:00Z",
  "updated_at": "2026-11-18T09:07:12Z",
  "shard_errors": [],
  ...
}
  • status is queued, running, completed, failed or cancelled.
  • records_total, records_embedded and the other record counts, num_shards and started_at are null until the input has been read through (shards_completed is 0). started_at is when that happened and the job began running.
  • updated_atmoves when the job's status or error changes and each time a shard completes. A running job whose updated_at has stopped moving is stalled, not slow.
  • shard_errors lists up to 5 shards that are being retried or have failed, each with its shard_index, attempts and last error (cut to 500 characters), most attempts first. A shard that keeps appearing here with a rising attempts is failing, not slow. It is only on this route, not in the job list.

4. Get the results

GET /v1/jobs/{id}/outputs?limit=50

{
  "data": [
    {
      "shard_index": 0,
      "url": "https://...",
      "expires_at": "2026-11-18T10:07:12Z",
      "num_embeddings": 1000
    }
  ],
  "has_more": true,
  "next_cursor": "..."
}
  • Each item is a presigned link to one Parquet file with the columns custom_id and embedding, in input order. Pages are in shard order, so reading them in order keeps the input's order. (With output_format: jsonl each line holds the same two fields.)
  • Pass next_cursor as cursor while has_more is true. limit is 1 to 200 and defaults to 50.
  • This route answers 409 job_not_completed until the job is completed.
  • A link works for one hour (see expires_at). Ask the route again for a fresh one.
  • The files themselves are deleted 30 days after they are written.
  • A shard in which no record could be embedded has no output file. When the job is completed, records_embedded counts the records with an embedding (truncated ones included), records_skipped those left out for length and records_errored those left out as invalid; together they make up records_total. Records left out never fail the job. A job that finishes with no record embedded fails, and so does one whose shard runs out of retries.

5. Per-record errors

A record we cannot embed does not fail the job. It is left out of the results and written to an error file instead.

GET /v1/jobs/{id}/errors

{
  "data": [
    {
      "shard_index": 3,
      "url": "https://...",
      "expires_at": "2026-11-18T10:07:12Z",
      "num_records": 2
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Each item links to a JSONL file for one shard, with one line per record left out, in input order. Only shards with such a record have one. It pages and expires like the outputs, and the list grows as shards complete; it is final once the job is, and unlike the outputs it is available in any status. A line looks like this:

{"custom_id": "doc-2", "reason": "too_long", "detail": "...", "byte_offset": 1843}
  • reason is invalid_record (the line broke an input rule) or too_long(over the model's limit, with overflow set to skip).
  • detail says why.
  • byte_offsetis where the record's line starts, counted in bytes from the start of the file you uploaded.

To read that line in your input:

# shell: byte_offset 1843
tail -c +$((1843 + 1)) input.jsonl | head -n 1

# Python
with open("input.jsonl", "rb") as f:
    f.seek(1843)
    line = f.readline()