The following article covers Sigma’s developer API for downloading queries. This can be used if you have a queryId from a previous call to Sigma’s workbook export endpoint.

Summary of Content

Endpoints
Download a Query Result
      Permissions
      Parameters
      cURL Request
      Response
      Example
Related Resources

Endpoints

GET /v2/query/{queryId}/download

      Downloads the result of a successful query. Learn more.
      Try it in Swagger

Download a Query Result

Downloads the result of a successful query.

GET /v2/query/{queryId}/download

It can take an arbitrary amount of time for our system to process the data into a file and have it ready to be downloaded. While the file is being processed, requests to the query download endpoint will respond with the status code 204 No Content.

For security and privacy reasons, by default the queryId expires 1 hour after your export request has been processed by our system and the file has become ready for download.

If you call this API with an expired "queryId," you will receive a status code 404 Not Found with the error:

The query download has expired. For security & privacy reasons, the Exports are retained for one hour.
A new queryId can be generated using the Workbook Export API.

If the "queryId" has expired, you can generate a new "queryId" using the Workbook Export API

(This default expiration time can be overridden for up to 6 hours by setting the optional request parameter "resultsValidityTimeMs" in the export request.)

 

Try it in Swagger

 

Permissions

If you encounter a permission error for the given endpoint, check with your organization Admin to verify your account type and permissions associated with your API token.

Parameters

None

cURL Request

curl --location --request GET 'https://api.sigmacomputing.com/v2/query/{queryId}/download' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \

 

Response

The file containing the requested downloaded data. The file type of the response varies depending on the query requested.

If you call this API and the requested file is still being processed, you will receive a status code 204 No Content.

If you call this API with an expired "queryId," you will receive a status code 404 Not Found with the error message:

The query download has expired. For Security & privacy reasons, the Exports are retained only for one hour. 
A new queryId can be generated using the Workbook Export API.

 

Example

Example Request:

curl --location --request GET 'https://api.sigmacomputing.com/v2/query/{queryId}/download' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \


Example Response:

The response will vary depending on the query requested. For example, you will receive either a PDF, PNG, CSV, or XLSX file. 

Related Resources

Get Started with Sigma's API
Create an API Token and Client Id
Identify Unique Ids in Sigma
Workbook Export API