Documentation
Developers

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:

Limit
Value
Rows in one export1,000,000
Size of one CSV file262,144,000 bytes (250 MiB)
Time to generate the file600 seconds
Length of the export SQL32,000 characters and 64,000 UTF-8 bytes
Time a completed file stays available180 minutes
Life of each download URL60 seconds

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:read on 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:

  1. In the chat result, click Download options.

  2. Select Export full result (CSV).

    An export card appears in the chat and shows the export's status.

  3. 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:

Status
Card label
Card action
pendingPreparing full exportCancel
runningGenerating full exportCancel
completeReady to downloadDownload
failedFull export failedRegenerate
cancelledFull export cancelledRegenerate

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:

Operation
Method and path
Result
CreatePOST /api/v1/projects/:projectId/exportsReturns 202 and export metadata. Needs Idempotency-Key.
Read statusGET /api/v1/projects/:projectId/exports/:exportIdReturns the export metadata.
DownloadGET /api/v1/projects/:projectId/exports/:exportId/fileChecks access and returns a 302 redirect to a short-lived private storage URL.
RegeneratePOST /api/v1/projects/:projectId/exports/:exportId/regenerateReturns 202 and creates a new export after the parent is terminal or expired. Needs Idempotency-Key.
CancelPOST /api/v1/projects/:projectId/exports/:exportId/cancelRequests cancellation and returns export metadata.

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:

bash
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 as https://customer.dogsled.it.
  • $BOBSLED_API_KEY: a personal API key.
  • $BOBSLED_PROJECT_ID: the ID of the Project.

The request body works as follows:

  • mode is sql for a SQL query or part for a chat result. A part request sends the chatId, messageId, and partId of the result instead of sql.
  • sql must be one read-only query.
  • filename is optional. It must end in .csv, be at most 255 bytes, and contain no slash, backslash, or control character.
  • Idempotency-Key is 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:

json
{ "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.

bash
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:

bash
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:

Error code
Cause
Fix
source_not_deployed_model (422)A warehouse table in the query isn't a deployed source or derived model.Add the table as a source model, deploy the Blueprint, and export again.
project_not_deployed (409)The Project has no deployed Blueprint.Deploy the Blueprint, and then export again.
invalid_sql (400) or sql_too_large (413)The SQL isn't one valid read-only query, or exceeds the SQL limit.Correct or shorten the query.
idempotency_key_reused (409)The key belongs to a different request.Use a new key for a new request.
regeneration_not_allowed (409)The export can't be regenerated in its current state, such as while it's pending or running.Wait for a final state, or cancel the export.
export_expired (410)The 180-minute download window ended.Regenerate the export.
connection_files_changedA source file changed or disappeared after the answer.Ask the question again in chat, and export the new result.
row_limit_exceeded, byte_limit_exceeded, or timeoutThe result exceeds a limit.Filter or aggregate the query, or split it into smaller exports.
connection_unavailable, download_unavailable, or workflow_unavailable (503)A connection, storage, or the export service is temporarily unavailable.Retry with backoff, and reuse the same idempotency key for a create or regenerate.

What's next

On this page