The DiVA API enables you to define a Marqeta platform dataset and export it as a compressed CSV file. You can choose between Zip or Gzip compression. After export, you use the API to download the compressed file.Documentation Index
Fetch the complete documentation index at: https://www.marqeta.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Exporting a dataset as a file
You can export any dataset as a CSV file by sending aGET request to the appropriate endpoint. To construct your endpoint URL, start with the URL you would use to retrieve that same dataset in JSON format, for example:
/views/authorizations/month?program=my_program
Then insert the export_type path parameter (/csv) before the query string, for example:
/views/authorizations/month/csv?program=my_program
By default, the resulting dataset is compressed as a gz file. You can compress it as a zip file by including the compress query parameter, for example:
/views/authorizations/month/csv?compress=zip&program=my_program
Because the export operation is processed asynchronously, you should receive an immediate 202 Accepted response. The JSON-formatted response body contains a token that you will use in downloading your data-set file, for example:
JSON
Downloading the exported file
Note
By default, the DiVA API returns 1,048,575 rows in a file export and can take several minutes to generate the file. You can increase the download limit up to 5,000,000 rows by including the
By default, the DiVA API returns 1,048,575 rows in a file export and can take several minutes to generate the file. You can increase the download limit up to 5,000,000 rows by including the
max_count=5000000 parameter.GET request to the /download?token={my_download_token} endpoint, where {my_download_token} is the value of the token field that was returned in response to your export request, for example:
/download?token=db63c24d8307c24b7e17d33735114dc8f807838a.csv.gz
Note
The
The
token value includes two filename extensions (for example, .csv.gz). You must include these extensions in your request URL.-
If the job is not finished: The
202 "Accepted"HTTP response code and a plain-text body containing the wordPending. -
If the job is finished: The
200 "OK"HTTP response code and the file as an application/octet-stream. -
If the job has expired: The
410 "Gone"HTTP response code. Completed jobs expire after 60 minutes.
my_downloaded_file.csv.gz
The following example of Python code illustrates how you can download an exported report file in CSV format:
Python