StackData Discovery API

Find datasets and see what the catalog covers. Not metered.

GitHub OpenAPI

Operations 6

GET /v1/catalog Page through the whole catalog #
GET /v1/datasets/{dataset_id}/structure Published structure of one dataset (free, unmetered) #
GET /v1/datasets/{dataset_id} Full record for one dataset #
GET /v1/coverage Catalog coverage, bucketed #
GET /.well-known/data-manifest.json The Agent Data Exchange manifest — what this API covers, in which languages… #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/stackdata-io:stackdata-io-discovery-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

stackdata-io-discovery-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: StackData Discovery API
  version: 0.1.0
  summary: Public datasets from multilateral sources, searchable in any language, resolvable into tables and charts.
  description: 'StackData indexes open government and public data and resolves a plain-language

    question into a table or chart drawn from that data. Every answer links back to

    its source.


    Beyond the 50k-dataset catalog, the API serves **stored corpora** (China

    population and economic censuses, Statistical Yearbooks 2004–2013 — 14k+ tables

    with English overlays; see `GET /v1/table/{id}`), an **as-of customs-tariff API**

    across the EU, US, UK and Japan with legal citations (`GET /v1/tariff`), and an

    **MCP server** at `POST /mcp` so agent frameworks can mount the whole API as

    tools. Machine-readable coverage lives at `/.well-known/data-manifest.json`.


    ## The contract this API keeps (and most don''t)


    - **Unknown query parameters are a `400`, never silently ignored.** The error names

    the offending parameter and lists what is allowed.

    - **Every JSON response carries `meta.harvest`** — the last successful harvest time of

    each source, so staleness is visible without asking.

    - **Counts are typed** `{ "value": N, "exact": true|false }`, never a bare integer.

    - **Empty is distinguishable from failed.** An honest empty result has a `status`; a

    missing resource is a `404`; an upstream failure is a `502`. A zero is never faked.


    ## Authentication


    Send your key in the `X-API-Key` header. **It is optional** — with no key you are on

    the free tier, identified by IP address, subject to a lower daily limit. A key raises

    your limit and draws on prepaid credits.


    ## Metering


    Metered endpoints: `GET /v1/resolve`, `GET /v1/data`, `GET /v1/table/{id}`,

    `POST /v1/series` and `GET /v1/tariff`. The billed unit is a single *uncached upstream fetch* (for stored

    corpora: the table render / tariff lookup) — cached answers, refusals, empties and

    errors are free. All other endpoints (search, boards, coverage, health) are never metered.


    ## Paying per answer as an agent (x402)


    **x402** is an open, HTTP-native payment standard — an x402 Foundation

    project under the Linux Foundation. A server answers a request it won''t serve for free with

    HTTP `402 Payment Required` plus machine-readable payment terms; the caller pays from a

    wallet and retries the same request. No account, no API key, no card — the payment itself is

    the authorization, which is why it suits autonomous agents.


    **The flow here.** When an **anonymous** caller is over the free daily quota, `GET /v1/data`

    returns `402` (not a hard `429`) with the terms in the body — amount, asset, network, `payTo`

    and resource. The agent signs a stablecoin authorization and reissues the request with an

    `X-PAYMENT` header (base64-encoded JSON of the signed authorization). The server verifies it

    through a facilitator, serves the answer, and returns the settlement receipt in the

    `X-PAYMENT-RESPONSE` header (the JSON body also gains a `payment` object).


    - **Price** — $0.05 per uncached answer (one upstream pull); $0.25 for premium sources (tariff schedules, China statistics). The live 402 quote is always authoritative.

    - **Asset & network** — USDC on Base, settled on-chain.

    - **You pay only for work** — cached answers, refusals, empties and errors are free; money moves only if the answer actually cost an uncached fetch.

    - **Single-use** — each signed authorization buys exactly one answer; replaying it returns `402`.


    This flow is active only when the server has `X402_PAY_TO` configured.


    **Learn more:** x402.org · developer docs · reference implementation · the HTTP status itself is `402 Payment Required`.'
  contact:
    name: StackData
    email: hello@stackdata.io
    url: https://stackdata.io/contact.html
  license:
    name: Underlying data is licensed per-source (open government / CC BY 4.0 and equivalents)
    url: https://stackdata.io/attribution.html
servers:
- url: https://api.stackdata.io
  description: Production (set to your deployed API host)
- url: http://localhost:8080
  description: Local development (uvicorn api:app --app-dir serve --port 8080)
security:
- {}
- ApiKeyAuth: []
tags:
- name: Discovery
  description: Find datasets and see what the catalog covers. Not metered.
paths:
  /v1/search:
    get:
      tags:
      - Discovery
      operationId: search
      summary: Search the catalog
      description: 'Full-text and semantic search over dataset metadata. Works in **any language**

        (this is the multilingual arm — resolution below is English-only). Never metered.'
      parameters:
      - name: q
        in: query
        required: true
        description: The search query, in any language.
        schema:
          type: string
        example: unemployment rate
      - name: limit
        in: query
        required: false
        description: Clamped to 5..200 — retrieval never returns fewer than a top-5 candidate set, so `limit=1` yields 5 results.
        schema:
          type: integer
          default: 10
          minimum: 5
          maximum: 200
      - name: country
        in: query
        required: false
        description: Filter to datasets scoped to this country.
        schema:
          type: string
      - name: kind
        in: query
        required: false
        description: Filter by resource kind (e.g. a statistical dataflow vs. a document).
        schema:
          type: string
      - name: open_only
        in: query
        required: false
        description: Return only datasets under an open licence.
        schema:
          type: boolean
          default: false
      responses:
        '200':
          description: Ranked results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          $ref: '#/components/responses/UnknownParameter'
  /v1/catalog:
    get:
      tags:
      - Discovery
      operationId: catalog
      summary: Page through the whole catalog
      description: 'The full public catalog as pageable metadata — for bulk consumers: static site

        generators, crawlers, mirrors. Returns **values, not provenance envelopes**

        (`/v1/datasets/{id}` is the full-envelope tier). Cursor pagination is keyset on

        the stable dataset id: pass back `next_cursor` until it returns `null`. Never

        metered.'
      parameters:
      - name: cursor
        in: query
        required: false
        description: The `next_cursor` from the previous page; omit for the first page.
        schema:
          type: string
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 500
          minimum: 1
          maximum: 1000
      - name: source
        in: query
        required: false
        description: Restrict to one source id (e.g. `ilo-sdmx`).
        schema:
          type: string
      responses:
        '200':
          description: One page of the catalog.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CatalogResponse'
        '400':
          $ref: '#/components/responses/UnknownParameter'
  /v1/datasets/{dataset_id}/structure:
    get:
      tags:
      - Discovery
      operationId: getDatasetStructure
      summary: Published structure of one dataset (free, unmetered)
      description: 'Dimensions, member codes and labels, totals, frequencies, periods, the ISO3 countries

        the dataset can serve, and whether it is servable. Use it to build a `POST /v1/series`

        request. Never metered.


        `countries` lists an ISO3 code only when our country table holds it AND the

        publisher''s own label for the source code names that country: a code''s shape is

        never enough (Eurostat''s `FRA` is its overseas-departments region and `POL`

        Polynesia; France is `FR`). Every other geography code is listed under

        `aggregates`, by its native code. Labels carry the dataset''s language as `lang`

        (`und` when the catalog does not record it). On the frequency dimension each

        member states the ISO period frequency it serves (`period_frequency`: `A`, `Q`, `M`,

        or null when the structured path does not serve it). `max_countries` is how many

        geographies one request may name: 1 on readers that serve one geography per

        request (PxStat, PxWeb, StatBank, OData, DataStat, e-Stat, BDL, pindica).


        On national PxWeb and PxStat tables a region axis can appear as an ordinary

        dimension: selecting a region member there returns that region''s values,

        attributed to the national ISO3 the request named (the echo in `resolved.select`

        shows the region chosen).

        Unservable datasets (`licence_unverified`, `no_data_path`) answer from the catalog

        alone: no structure is fetched from the publisher, so `dimensions` is empty.'
      parameters:
      - name: dataset_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: 'The structure view. A dataset that cannot be served says so here

            (`servable: false` with `not_servable_reason`) rather than being hidden.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Structure'
              examples:
                ilo_unemployment:
                  $ref: '#/components/examples/StructureExample'
        '404':
          description: Unknown dataset (`unknown_dataset`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredNotFound'
        '502':
          description: The source could not deliver the structure (`upstream_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpstreamFailed'
  /v1/datasets/{dataset_id}:
    get:
      tags:
      - Discovery
      operationId: getDataset
      summary: Full record for one dataset
      description: 'The full provenance envelope for a single dataset: publisher, cadence, status,

        distribution and licence. A missing id is a `404` — **absent is not an empty success.**'
      parameters:
      - name: dataset_id
        in: path
        required: true
        description: 'The dataset id. May itself contain slashes (it is matched as a path), so when calling by hand, URL-encode any `/` in the id.

          '
        schema:
          type: string
      responses:
        '200':
          description: The dataset record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dataset'
        '404':
          description: No such dataset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/coverage:
    get:
      tags:
      - Discovery
      operationId: coverage
      summary: Catalog coverage, bucketed
      description: Count of datasets grouped along one dimension. Not metered.
      parameters:
      - name: by
        in: query
        required: false
        description: The dimension to group by.
        schema:
          type: string
          enum:
          - source
          - kind
          - publisher_type
          - licence
          default: source
      responses:
        '200':
          description: Buckets with typed counts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CoverageResponse'
        '400':
          description: Unknown dimension, or an unknown query parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /.well-known/data-manifest.json:
    get:
      tags:
      - Discovery
      operationId: dataManifest
      summary: The Agent Data Exchange manifest — what this API covers, in which languages…
      responses:
        '200':
          description: The manifest.
          content:
            application/json:
              schema:
                type: object
components:
  schemas:
    CatalogResponse:
      type: object
      properties:
        returned:
          $ref: '#/components/schemas/TypedCount'
        total:
          $ref: '#/components/schemas/TypedCount'
        next_cursor:
          type:
          - string
          - 'null'
          description: Pass back as `cursor` for the next page; `null` means exhausted (explicitly, never by absence).
        applied_filters:
          type: object
          additionalProperties: true
        datasets:
          type: array
          items:
            type: object
            description: 'One catalog record as plain values: id, source, title {value, lang, machine}, description, publisher, resource_kind, cadence, status, temporal, formats, licence {spdx, label, is_open}, endpoint, coverage (country list, when observed), first/last seen.

              '
            additionalProperties: true
        meta:
          $ref: '#/components/schemas/Meta'
    Dataset:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        title_lang:
          type: string
        description:
          type: string
        resource_kind:
          type: string
        publisher:
          type: object
          properties:
            name:
              type: string
            publisher_type:
              type: string
        cadence:
          type: string
        status:
          type: string
        native_theme:
          type: string
        access_rights:
          type: string
        distribution:
          type: object
          properties:
            access_service:
              type: string
            conforms_to:
              type: string
            format:
              type: string
            licence:
              type: object
              additionalProperties: true
        first_seen_at:
          type: string
        last_seen_at:
          type: string
        source:
          type: string
        meta:
          $ref: '#/components/schemas/Meta'
    Structure:
      type: object
      description: 'What a `POST /v1/series` request can name for one dataset. Geography and time are not

        dimensions here: geography is `countries` (ISO3, plus `aggregates`), time is `period`.

        '
      required:
      - dataset
      - servable
      - frequencies
      - periods
      - countries
      - aggregates
      - max_countries
      - dimensions
      properties:
        dataset:
          type: string
        title:
          type: string
          nullable: true
        publisher:
          type: string
        unit:
          type: string
          nullable: true
        licence:
          type: object
          additionalProperties: true
        servable:
          type: boolean
        not_servable_reason:
          type: string
          nullable: true
          description: Set when `servable` is false (e.g. `licence_unverified`, `no_data_path`, `not_in_serve_set`).
        frequencies:
          type: array
          items:
            type: string
          description: Frequency codes served. An empty list means undeclared (the period's frequency is accepted and filtered after the fetch).
        periods:
          type: object
          nullable: true
          description: Declared coverage per frequency, `{first, last}` in ISO form. Null means undeclared.
          additionalProperties:
            type: object
            properties:
              first:
                type: string
              last:
                type: string
        countries:
          type: array
          items:
            type: string
          description: ISO 3166-1 alpha-3 codes this dataset can serve. Listed only when our country table holds the code and the publisher's label for its source code names that country.
        aggregates:
          type: array
          description: Native region/aggregate codes usable in `countries` as given — every geography code the publisher lists that is not bound to a listed country (a code spelled like a listed country's ISO3 is left out, because a request naming it means the country).
          items:
            type: object
            properties:
              code:
                type: string
              label:
                type: string
              lang:
                type: string
        max_countries:
          type: integer
          description: How many distinct geographies one request may name. 25, or 1 on readers that serve one geography per request.
        dimensions:
          type: array
          items:
            $ref: '#/components/schemas/StructureDimension'
    TypedCount:
      type: object
      description: A count that states whether it is exact — never a bare integer.
      required:
      - value
      - exact
      properties:
        value:
          type: integer
        exact:
          type: boolean
      example:
        value: 2807
        exact: true
    CoverageResponse:
      type: object
      properties:
        by:
          type: string
        buckets:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              datasets:
                $ref: '#/components/schemas/TypedCount'
        total:
          $ref: '#/components/schemas/TypedCount'
        meta:
          $ref: '#/components/schemas/Meta'
    StructureMember:
      type: object
      required:
      - code
      - label
      - lang
      properties:
        code:
          type: string
        label:
          type: string
          description: The publisher's label
          in its own language.: null
        lang:
          type: string
          description: 'Language of `label`: the dataset''s recorded title language, `und` when the catalog does not record one.'
        period_frequency:
          type: string
          nullable: true
          enum:
          - A
          - Q
          - M
          - null
          description: On the frequency dimension only. The ISO period frequency this member serves (by the publisher's label, else its code); null when the structured path does not serve it — selecting it is `400 period_frequency_mismatch`.
        total:
          type: boolean
          description: True on the member the reader would use as the aggregate (total) default.
        default_reason:
          type: string
          nullable: true
          description: Why this member is the default; present with `total`.
    UpstreamFailed:
      type: object
      required:
      - status
      - reason
      properties:
        status:
          type: string
          enum:
          - upstream_failed
        reason:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
        note:
          type: string
      required:
      - error
      example:
        error: no dataset 'x'
        note: absent is not an empty success
    Meta:
      type: object
      description: Attached to every JSON response. `harvest` maps each source id to its last successful harvest timestamp.
      properties:
        harvest:
          type: object
          additionalProperties:
            type: string
        api_version:
          type: string
      example:
        harvest:
          ilo: '2026-08-10 03:14:22'
          wb: '2026-08-10 03:15:01'
        api_version: '0.1'
    StructureDimension:
      type: object
      required:
      - id
      - members
      properties:
        id:
          type: string
        role:
          type: string
          enum:
          - frequency
          description: Present on the frequency dimension.
        members:
          type: array
          items:
            $ref: '#/components/schemas/StructureMember'
    SearchResponse:
      type: object
      properties:
        query:
          type: string
        returned:
          $ref: '#/components/schemas/TypedCount'
        applied_filters:
          type: object
          description: Echo of the filters that actually ran (a filter that could not run is a 400, never a silent drop).
          additionalProperties: true
        results:
          type: array
          items:
            type: object
            description: A matched dataset (id, title, publisher, score, …).
            additionalProperties: true
        meta:
          $ref: '#/components/schemas/Meta'
    StructuredNotFound:
      type: object
      required:
      - error
      - detail
      properties:
        error:
          type: string
          enum:
          - unknown_dataset
        detail:
          type: string
  responses:
    UnknownParameter:
      description: 'An unknown query parameter was supplied. Unknown parameters are **rejected, never

        silently ignored** — the error names the offenders and lists what is allowed.

        '
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              allowed:
                type: array
                items:
                  type: string
              note:
                type: string
            example:
              error: 'unknown parameter(s): limitt'
              allowed:
              - country
              - kind
              - limit
              - open_only
              - q
              note: unknown parameters are rejected, never silently ignored
  examples:
    StructureExample:
      summary: Structure of an ILO unemployment-rate dataset (abridged member lists)
      value:
        dataset: ilo-sdmx:DF_UNE_DEAP_SEX_AGE_RT
        title: Unemployment rate by sex and age
        publisher: ilo-sdmx
        unit: null
        licence:
          id: null
          label: null
          spdx: CC-BY-4.0
          is_open: true
          source: null
        servable: true
        not_servable_reason: null
        frequencies:
        - S
        - A
        - W
        - D
        - B
        - F
        - T
        - Q
        - M
        - O
        periods: null
        countries:
        - JPN
        - KEN
        - KOR
        aggregates:
        - code: X01
          label: World
          lang: en
        max_countries: 25
        dimensions:
        - id: FREQ
          role: frequency
          members:
          - code: S
            label: Bi-annual
            lang: en
            period_frequency: null
          - code: A
            label: Annual
            lang: en
            total: true
            default_reason: explicit 'Annual'
            period_frequency: A
          - code: T
            label: Tri-annual
            lang: en
            period_frequency: null
          - code: Q
            label: Quarterly
            lang: en
            period_frequency: Q
          - code: M
            label: Monthly
            lang: en
            period_frequency: M
        - id: MEASURE
          members:
          - code: UNE_DEAP_RT
            label: Unemployment rate (previous ILO definition - ICLS13)
            lang: en
        - id: SEX
          members:
          - code: SEX_T
            label: Total
            lang: en
            total: true
            default_reason: explicit 'Total'
          - code: SEX_M
            label: Male
            lang: en
          - code: SEX_F
            label: Female
            lang: en
        - id: AGE
          members:
          - code: AGE_YTHADULT
            label: Youth and adults
            lang: en
          - code: AGE_YTHADULT_YGE15
            label: 15+
            lang: en
            total: true
            default_reason: working-age total code (AGE_YTHADULT_YGE15)
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your StackData API key. Optional — omit it to use the free tier (identified by IP).
    SessionCookie:
      type: apiKey
      in: cookie
      name: sd_session
      description: The httpOnly session cookie set at sign-in (production, same-site).
    BearerAuth:
      type: http
      scheme: bearer
      description: 'The session token returned in the login body, sent as `Authorization: Bearer <token>` (the app''s cross-origin path).'