> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Model

Download a file component of the ONNX model.

## **POST** `/revisions/:id/data/query` (Command: `download`)

### Request Format

The command travels as an ordinary JSON body, but two request headers are load-bearing:

| Header         | Value                                                                               |
| :------------- | :---------------------------------------------------------------------------------- |
| `Content-Type` | `application/json`. Any other value — including none — is rejected with `400`.      |
| `Accept`       | `application/octet-stream`, so the gateway hands back raw bytes rather than base64. |

`application/octet-stream` is the only binary media type this API declares, and the gateway converts a binary
payload only for a request whose `Accept` names one.

### Request Body

| Parameter | Type   | Required | Description                                        |
| :-------- | :----- | :------- | :------------------------------------------------- |
| `engine`  | string | Yes      | Must be `onnx`.                                    |
| `command` | string | Yes      | Must be `download`.                                |
| `path`    | string | Yes      | One of `model.tar.gz`, `model.onnx`, `model.json`. |

### Response

The file itself, as `application/octet-stream` — there is no presigned URL to follow. The JSON envelope
travels in the `X-Response-Body` header instead of the body, which holds the bytes:

| Header            | Value                                                  |
| :---------------- | :----------------------------------------------------- |
| `Content-Type`    | `application/octet-stream`                             |
| `X-Response-Body` | `{"status": "success"}` — no fields beyond the status. |

`Access-Control-Expose-Headers` names `X-Response-Body`, so a browser client can read it.

### Example

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST https://api.blobhub.io/v1/revisions/rev_001/data/query \
    -H "X-API-Key: $BLOB_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Accept: application/octet-stream" \
    -d '{"engine":"onnx","command":"download","path":"model.onnx"}' \
    -o model.onnx -D -
  ```

  ```json Response theme={null}
  {
    "status": "success"
  }
  ```
</CodeGroup>

The bytes land in `model.onnx`; the JSON above is what `-D -` prints as the `X-Response-Body` header.
