Getting started

Overview

What the Data API is, how data is organised into namespaces, tables and files, and a live, hands-on quickstart.

Last updated on

The Data API is a public HTTP interface for reading open data published on the Lithuanian Data Portal. It exposes the portal's data lake — Apache Iceberg tables and stored files: browse namespaces and read schemas with GET, then query or export table rows with POST, returning JSON, NDJSON, CSV, Excel or Parquet.

Read-only and public

No authentication is required — there are no API keys, tokens or OAuth scopes. Catalogue and file reads are GET; table queries and exports are POST with a JSON body (the API is still read-only — POST only carries the query definition). All examples use the base URL https://api.dataportal.gov.lt and real, live data.

Throughout these guides we use one real dataset — Toxicological test results in death cases (Higienos institutas) — so every example is copy‑pasteable:

ParameterTypeDescription
Namespace111958286The publishing organisation (Higienos institutas company code).
Tablemirusiuju_toksikologinis_rezultatas22,143 rows, 14 columns.

Try it live

Pick columns, set a filter, sort and page — then Run to call the real API from your browser. The request is proxied by the docs site so it works despite the API not sending CORS headers.

POST/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/query
Columns (select)
Sort
 
Filter
curl -X POST 'https://api.dataportal.gov.lt/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/query' \
  -H 'Content-Type: application/json' \
  -d '{"limit":5,"select":"pavadinimas,lytis,mirties_metai,amziaus_grupe,mirties_priezastis","sort":"mirties_metai"}'
2 rows shown · total: 22 143 · page 1
Response
lytisamziaus_grupemirties_metaipavadinimasmirties_priezastis
Moteris65_692021Etanolis (etilo alkoholis)Kita
Moteris65_692018KarboksihemoglobinasAtsitiktiniai apsinuodijimai

How data is organised

The API has three kinds of resource:

  • Namespace — a container, identified by a dot-separated path. Here the namespace is the publisher's company code, 111958286. A namespace holds child namespaces, tables and files, so the catalogue forms a tree you can walk from the root down.

  • Table — an Iceberg table you can inspect (its schema), query row by row as JSON, or export in bulk as NDJSON, JSON, CSV, Excel or Parquet.

  • File — a stored object (PDF, image, archive, …) served straight from object storage.

namespaces
  • 111958286Higienos institutas
    • mirusiuju_toksikologinis_rezultatasschemaqueryexport
    • gimimasschemaqueryexport
    • many more tables
    • report.pdfdownload

What you can do

ParameterTypeDescription
List the root namespacesGET /namespaceslistNamespaces →
Browse one namespaceGET /namespaces/{namespace}getNamespace →
Inspect a table's schema.../tables/{table}/schemagetTableSchema →
Read rows as JSONPOST .../tables/{table}/queryqueryTable →
Export a tablePOST .../tables/{table}/exportexportTable →
Download a file.../files/{fileName}downloadFile →

Quickstart

List the root namespaces

GET/namespaces
curl 'https://api.dataportal.gov.lt/namespaces'
{ "success": true, "data": { "namespaces": ["111958286", "188774975", "…"] } }

Drill into a namespace

See its child namespaces, tables and files.

curl 'https://api.dataportal.gov.lt/namespaces/111958286'
{
  "success": true,
  "data": {
    "current_namespace": "111958286",
    "child_namespaces": [],
    "tables": ["mirusiuju_toksikologinis_rezultatas", "gimimas", "…"],
    "files": []
  }
}

Inspect the table schema

Learn the column names and types before you query.

curl 'https://api.dataportal.gov.lt/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/schema'

Query rows

Send a JSON body asking for the first 5 rows, newest first, keeping a few columns:

curl -X POST 'https://api.dataportal.gov.lt/namespaces/111958286/tables/mirusiuju_toksikologinis_rezultatas/query' \
  -H 'Content-Type: application/json' \
  -d '{"limit":5,"sort":"-mirties_metai","select":"lytis,mirties_metai,pavadinimas"}'
{ "data": [ /* … 5 rows … */ ], "total": 22143, "total_pages": 4429, "current_page": 1 }

Export in bulk

When you want the whole result set as a file rather than paged JSON — the export endpoint takes the same body plus a format query parameter:

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 '{}'

Response format

Catalogue and schema endpoints wrap their payload in a { success, data } envelope. The query endpoint is different — it returns the rows plus offset-based pagination metadata, with no success wrapper:

{ "success": true, "data": { "…": "…" } }
{ "data": [ /* rows */ ], "total": 22143, "total_pages": 4429, "current_page": 1 }

A raw byte stream — NDJSON / JSON / CSV / Parquet, or the file's own content type — not JSON.

Errors carry an error_code and a message. See Errors for the exact shapes and status codes (400, 404, 502, 503, 504).

Where to next

See also

How is this guide?