# Public API (https://guides.dataportal.gov.lt/docs/api)



Use the public API to find official statistics and open data published on [dataportal.gov.lt](https://dataportal.gov.lt), read their descriptions and retrieve the data. The API has two parts.

<Features>
  <Feature icon="search" title="Metadata API">
    Search the catalogue for datasets, classifications, data reuses and publishing organisations. Metadata is available in Lithuanian and English.
  </Feature>

  <Feature icon="database" title="Data API">
    List an organisation’s tables and files, then inspect the columns of the table you need. Read its rows as JSON or download them as CSV, XLSX, Parquet, JSON or NDJSON.
  </Feature>
</Features>

<Callout title="Base URL and access">
  Send requests to `https://api.dataportal.gov.lt`. You do not need an account or an API key. The API does not send CORS headers. For a website on another origin, send requests from your server. Scripts and notebooks can call the API directly.
</Callout>

## How the pieces connect [#how-the-pieces-connect]

To go from a catalogue search to table rows, find the dataset, choose a distribution in the language you need and follow its `query` link.

<Steps>
  <Step>
    **Find the dataset.** Send your search terms to `POST /v1/datasets`. Each result includes an `id`.
  </Step>

  <Step>
    **Read the metadata.** Call `GET /v1/datasets/{id}`. For distributions backed by tables, look for the schema and query links.
  </Step>

  <Step>
    **Retrieve the data.** Send a `POST` request to the distribution’s `query` URL for rows, or use the corresponding `export` route for a file.
  </Step>
</Steps>

Work through these three requests with a population dataset in the [quickstart](https://guides.dataportal.gov.lt/docs/api/guides/overview).

## Explore [#explore]

<Cards>
  <Card title="Make your first data request" href="https://guides.dataportal.gov.lt/docs/api/guides/overview" description="Use three requests to find a population dataset, read its metadata and retrieve table rows." />

  <Card title="Search the catalogue through the API" href="https://guides.dataportal.gov.lt/docs/api/guides/searching" description="Search metadata by text, combine filters and choose which fields to return." />

  <Card title="Query table rows" href="https://guides.dataportal.gov.lt/docs/api/guides/querying" description="Choose columns, build a row filter and retrieve sorted results one page at a time." />

  <Card title="Export data and download files" href="https://guides.dataportal.gov.lt/docs/api/guides/downloading" description="Export a whole table or a filtered slice as a file, or download a file in its stored format." />

  <Card title="Datasets" href="https://guides.dataportal.gov.lt/docs/api/datasets/search-datasets" description="Reference: search, metadata, schemas and filter values." />

  <Card title="Tables and files" href="https://guides.dataportal.gov.lt/docs/api/data/query-table" description="Reference: tables, files, queries and exports." />
</Cards>

## Already using `/namespaces`? [#already-using-namespaces]

Existing integrations can continue to use the [Legacy routes](https://guides.dataportal.gov.lt/docs/api/legacy/query-table). For new integrations, use `/v1/data/organizations`. See [Moving to the v1 routes](https://guides.dataportal.gov.lt/docs/api/guides/migrating) for the equivalent URL for each operation.

## The specification [#the-specification]

The reference pages are generated from the OpenAPI 3 specification. Download it in [English](https://api.dataportal.gov.lt/openapi.json) or [Lithuanian](https://api.dataportal.gov.lt/openapi-lt.json), or open the [Swagger page](https://api.dataportal.gov.lt/docs/index.html).
