Using the API directly is not recommended for most users. Instead, we recommend using the Python SDK.
Usage Notes
- You can only download one file at a time via the API. You must make multiple requests to download multiple files. The Python SDK supports downloading multiple files at once.
- The file will be returned as bytes. You will need to decode the bytes and save them to a file.
- The dataset stores files in the order they were uploaded. You can view the ordering of files using the
list-dataset-files
endpoint.
Request Body
The ID of the dataset to download the file from
The name of the file to download
Headers
Your Sutro API key using Key authentication scheme.Format:
Key YOUR_API_KEY
Example: Authorization: Key sk_live_abc123...
Response
If successful, returns the file as bytes. Otherwise, returns a JSON object containing an error message.Code Examples
Response Handling
The API returns different content types based on the result:- Successful Download:
Content-Type: application/octet-stream
with file bytes in the response body - Error:
Content-Type: application/json
with error details
Content-Type
header to determine how to handle the response.
Important Considerations
- Single File Limit: API supports one file per request (use Python SDK for batch downloads)
- Binary Data: Files are returned as raw bytes that need to be saved to disk
- File Ordering: Use the
list-dataset-files
endpoint to see available files and their order - Error Handling: Check response headers to distinguish between file data and error messages