Skip to main content
Upload an ONNX model file (model.tar.gz) to a revision.

POST /revisions/:id/data/command (Command: upload)

Request Format

The model bytes travel in the request body, so the JSON command cannot. This endpoint reads a binary request: the file as the body, and the command as a header. X-Request-Body is named in the API’s Access-Control-Allow-Headers, so a browser client can send it. Posting the command as a plain JSON body instead — Content-Type: application/json, no X-Request-Body — parses, but delivers no bytes, so it answers 400 upload_size_mismatch and stores nothing. The archive travels inside the API request, which is limited to 6 MB once base64-encoded. Keep a single-part upload to 4 MiB or less, and send anything larger with Multipart Upload.

Request Body

Serialized into X-Request-Body, not into the body itself:

Response

The file bytes travel in this request, so no upload URL comes back — the model is already stored by the time the command answers. Poll Get Operation with operation_id to follow the post-processing that unpacks it: the operation ends completed, or failed when the archive does not hold exactly one regular file named model.onnx that parses as an ONNX model.

Errors

A refused upload stores nothing, creates no operation and starts no processing.

Example