Downloading data & files
Stream a whole table as NDJSON, JSON, CSV or Parquet with the export endpoint, and download stored files.
Last updated on
The query endpoint is for reading rows page by page as JSON. When you want the whole result set as a file, use the export endpoint instead — it streams the data in your chosen format with no pagination.
POST/namespaces/{namespace}/tables/{tableName}/export
Same body as query
Export takes the same JSON request body as the query endpoint
— select, filter, sort, limit, offset, exclude_nulls — so any query you
build can be exported. The only extra is a format query parameter that picks
the file type. Omit the body ({}) to export the whole table.
Formats
Set the format query parameter. ndjson is the default:
| Parameter | Type | Description |
|---|---|---|
ndjson | default | Newline-delimited JSON — one object per line, ideal for streaming into data tools. |
json | format | A JSON stream of row objects. |
csv | format | Comma-separated values, one header row then data. |
xlsx | format | Microsoft Excel workbook. Capped at 1,000,000 rows — filter or paginate larger tables. |
parquet | format | Columnar binary — smallest and fastest for analytics. |
# Whole table as NDJSON
curl -L -o toksikologija.ndjson \
-X POST 'https://api.dataportal.gov.lt/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/export?format=ndjson' \
-H 'Content-Type: application/json' \
-d '{}'{"_id":"11939610733872445230","vda_id":"166d143f8929ba0","pavadinimas":"Etanolis (etilo alkoholis)","lytis":"Moteris","mirties_metai":2021, …}
{"_id":"00016506519020014367","vda_id":"4f277520b7ccca2","pavadinimas":"Etanolis (etilo alkoholis)","lytis":"Vyras","mirties_metai":2019, …}Swap format=csv, format=json, format=xlsx or format=parquet for a different
file type and change the output filename to match. The xlsx (Excel) format is
capped at 1,000,000 rows — narrow the export with a filter or limit for
tables larger than that.
Selected columns & filters
Because export shares the query body, narrow the export with select and filter
exactly as you would a query — the querying guide
documents the full filter grammar:
# Only three columns, female decedents, as NDJSON
curl -L -o subset.ndjson \
-X POST 'https://api.dataportal.gov.lt/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/export?format=ndjson' \
-H 'Content-Type: application/json' \
-d '{"select":"lytis,mirties_metai,pavadinimas","filter":"lytis=Moteris"}'Request body
| Parameter | Type | Description |
|---|---|---|
select | string | Comma-separated columns to include. Omit for all columns. |
filter | string | Filter expression — same grammar as the query endpoint. |
sort | string | Comma-separated sort keys. Prefix - for descending. |
limit | int | Cap the number of rows written to the file. |
offset= 0 | int | Rows to skip before writing. |
exclude_nulls | string[] | Columns that must be non-null; rows with a null there are dropped. |
format query parameter
format goes on the URL as a query string (?format=ndjson), not in the JSON
body. The body carries only the query fields above.
Downloading files
Stored files (PDFs, images, archives) attached to a namespace are downloaded by
name. The file name is a single basename — it must not contain /.
/namespaces/{namespace}/files/{fileName}
curl -L -O 'https://api.dataportal.gov.lt/namespaces/{namespace}/files/report.pdf'The response is the raw bytes with the upstream Content-Type and filename
preserved.
See also
How is this guide?