Large CSV exports
Export a complete query result as a CSV file from a chat, the API, or an MCP client, and download it before it expires.
This page explains how to export a complete query result as a CSV file, follow the export's status, and download the file. It covers the chat workflow, the API operations, and MCP clients. Use a large export when you need every row of a result, not only the rows that a chat shows.
How large exports work
A large CSV export runs the query again as durable Project work. The create request returns before Bobsled AI reads all rows. Bobsled AI then writes the result to a private file and serves it through short-lived download URLs.
Bobsled AI reads the result as follows:
- Export generation supports direct Snowflake, PostgreSQL, BigQuery, Databricks, and ClickHouse connections.
- Results from cross-source queries, live models, system sources, and uploaded CSV files or attachments use a bounded Sandbox file stream.
- Every result goes through the same CSV writer and uploads to private file storage.
- Each warehouse table in the query must be a deployed source or derived model in the Project's Blueprint. Otherwise, Bobsled AI rejects the export request.
- An export records the connection that it uses, not a copy of your provider credentials. When the export runs, Bobsled AI reads that Project connection again and resolves its current credentials.
- A result from files in a storage connection lists the files again when the export runs. Bobsled AI ignores files that are newer than the answer. If a file that the answer used changed or disappeared, the export fails with
connection_files_changed. For more information, see Export the full result.
A completed file stays available for 180 minutes after generation finishes. Downloading it again doesn't extend that time. Each download creates a new signed URL that is valid for at most 60 seconds. The client must start its request to that URL before the URL expires. The storage service then sends the CSV bytes directly to the client. Bobsled AI can record that it issued a URL, but it can't confirm that a download completed.
Limits
The following limits apply to each export:
An export that exceeds the row, size, or time limit fails with row_limit_exceeded, byte_limit_exceeded, or timeout.
Before you begin
- Get
data:readon the Project. The Reader, Maintainer, and Admin roles include it. - For the API, get a session, a personal API key, or a service-principal token. For more information, see API authentication.
Export from a chat
A chat result has two download options:
- Download displayed rows (CSV) writes only the rows that the browser has loaded. It doesn't create an export.
- Export full result (CSV) creates an export for the current result. Bobsled AI stores the request and starts durable work.
To export a full result, do the following:
-
In the chat result, click Download options.
-
Select Export full result (CSV).
An export card appears in the chat and shows the export's status.
-
When the card shows Ready to download, click Download.
The card shows the row count, the file size, and the time until the file expires.
The following table maps each export status to its label on the card:
After a completed file expires, the card shows Expired and offers Regenerate. If an export stays in pending for more than 5 minutes, the card suggests that you cancel it and generate it again. If the source files changed, the card says to ask again, and Regenerate isn't available.
When you click Download, Bobsled AI checks the Project, the export state, the expiry, and the private file. It then returns a 302 redirect to a new signed storage URL.
Export with the API
The export API is Project-scoped. Every operation needs data:read. The following table lists the operations:
Session-authenticated create, regenerate, and cancel requests need an Origin header that matches the request origin. Personal API keys and service principals don't need this same-origin check.
Create an export
The following command exports the result of one SQL query:
curl --fail-with-body --silent --show-error \
--request POST \
--header "Content-Type: application/json" \
--header "X-Dogsled-API-Key: $BOBSLED_API_KEY" \
--header "Idempotency-Key: orders-export-2026-11-30" \
--data '{"mode":"sql","sql":"select order_id, total from ANALYTICS.PUBLIC.ORDERS","filename":"orders.csv"}' \
"$BOBSLED_ORIGIN/api/v1/projects/$BOBSLED_PROJECT_ID/exports"The command reads the following shell variables:
$BOBSLED_ORIGIN: your Bobsled AI URL, such ashttps://customer.dogsled.it.$BOBSLED_API_KEY: a personal API key.$BOBSLED_PROJECT_ID: the ID of the Project.
The request body works as follows:
modeissqlfor a SQL query orpartfor a chat result. Apartrequest sends thechatId,messageId, andpartIdof the result instead ofsql.sqlmust be one read-only query.filenameis optional. It must end in.csv, be at most 255 bytes, and contain no slash, backslash, or control character.Idempotency-Keyis 1 to 128 printable ASCII characters. Use one key for each logical create or regenerate request, and reuse it when you retry after a network failure.
A repeated key returns the existing export when the request matches, and doesn't start another warehouse query. The same key with a different request fails with idempotency_key_reused.
The output is similar to the following:
{
"data": {
"exportId": "0198f2c1-5b1a-7c31-8a3e-1d2f3a4b5c6d",
"projectId": "PROJECT_ID",
"filename": "orders.csv",
"status": "pending",
"rowCount": null,
"byteCount": null,
"failureCode": null,
"createdAt": "2026-11-30T09:00:00.000Z",
"startedAt": null,
"completedAt": null,
"expiresAt": null
}
}Check the status and download the file
To check the status, call the status operation with the exportId. Poll until status is complete, failed, or cancelled. A completed export has rowCount, byteCount, and expiresAt. A failed export has failureCode.
curl --fail-with-body --silent --show-error \
--header "X-Dogsled-API-Key: $BOBSLED_API_KEY" \
"$BOBSLED_ORIGIN/api/v1/projects/$BOBSLED_PROJECT_ID/exports/$BOBSLED_EXPORT_ID"Set $BOBSLED_EXPORT_ID to the exportId from the create response.
The file operation needs your Bobsled AI credential for its first request only. Don't send that credential to the storage URL. curl --location sends custom headers, such as X-Dogsled-API-Key, to the redirected host. Instead, read the redirect location, and then download the file without the key:
BOBSLED_DOWNLOAD_URL=$(curl --fail-with-body --silent --show-error \
--header "X-Dogsled-API-Key: $BOBSLED_API_KEY" \
--output /dev/null \
--write-out "%{redirect_url}" \
"$BOBSLED_ORIGIN/api/v1/projects/$BOBSLED_PROJECT_ID/exports/$BOBSLED_EXPORT_ID/file")
curl --fail --silent --show-error --output orders.csv "$BOBSLED_DOWNLOAD_URL"Run the second command within 60 seconds. The storage URL is a short-lived bearer URL. Don't copy it into logs or store it as a permanent download link.
Regenerate or cancel an export
To cancel a pending or running export, send a POST request with no body to the cancel operation.
To create a new export from a terminal or expired one, call the regenerate operation with a new Idempotency-Key. The body depends on the parent's mode:
- A SQL-mode export must send the SQL again, as
{ "sql": "..." }. Bobsled AI compares its SHA-256 hash with the parent export's SQL. - A part-mode export sends
{}and reuses the saved chat part reference.
Export from an MCP client
An MCP client can create, poll, cancel, and regenerate an export when its Project authorization supports the operation. For the MCP tools and steps, see Export a query result as CSV.
An external MCP OAuth token authorizes the MCP transport. It doesn't authorize the native /api/v1/projects/:projectId/exports/:exportId/file route. To redeem that route, the MCP host needs a browser session or an API credential that the native route accepts.
The CSV bytes stay out of band. The host follows the native file response or opens its returned download location. Don't place the CSV bytes or the signed URL in an assistant message.
CSV safety and retention
Bobsled AI protects exported data as follows:
- It escapes formulas. It adds a leading apostrophe to a textual cell that starts with
=,+,-, or@, so spreadsheet applications treat the cell as text. It doesn't change numeric values. - An export record holds a bounded reference to its source, not your credentials.
- Bobsled AI encrypts the query plan while the export is pending and decrypts it only to run the export. It clears the plan when the export reaches a final state.
- Bobsled AI keeps export metadata until its retention policy removes it. The cleanup job deletes expired files before it removes the matching audit data.
- An orphan sweep removes old unreferenced files under the export prefix.
Troubleshoot an export
The following table lists common export errors:
What's next
- Query files with SQL to export results from files in a storage connection.
- Export a query result with MCP from a coding agent.
- Choose an API credential for scripted downloads.