StackData Account API

Usage, the signed-in user's profile, API key, and settings.

GitHub OpenAPI

Operations 16

GET /v1/usage Current usage and limits #
POST /v1/account/visibility Set the default visibility for new boards (paid tiers) #
GET /v1/me The signed-in user's profile #
POST /v1/me Update nickname and/or default board visibility #
DELETE /v1/me Delete the account (confirm-gated, irreversible) #
POST /v1/billing/checkout Start a paid-plan checkout (Polar) #
POST /v1/billing/portal Open the customer billing portal #
POST /v1/billing/webhook Polar webhook receiver (signature-verified, idempotent) #
POST /v1/me/password Set or change the password #
POST /v1/me/avatar/shuffle Re-roll the generated avatar #
POST /v1/me/avatar/reset Reset the avatar to the stable default (user id seed) #
GET /v1/me/api-key Reveal the account's API key #
POST /v1/me/api-key/rotate Issue a new API key (old one stops working immediately) #
GET /v1/me/sessions Active sessions for this account #
POST /v1/me/sessions/revoke-others Sign out every other device #
GET /v1/avatar/{seed} Generated mesh avatar for a seed #

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-account-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-account-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: StackData Account 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: Account
  description: Usage, the signed-in user's profile, API key, and settings.
paths:
  /v1/usage:
    get:
      tags:
      - Account
      operationId: usage
      summary: Current usage and limits
      description: Usage counts and remaining allowance for the caller (by key, or by IP on the free tier). Not metered. Takes no query parameters.
      responses:
        '200':
          description: Usage status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  usage:
                    type: object
                    additionalProperties: true
                    description: Tier, counts used, and remaining allowance.
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          $ref: '#/components/responses/UnknownParameter'
  /v1/account/visibility:
    post:
      tags:
      - Account
      operationId: setAccountVisibility
      summary: Set the default visibility for new boards (paid tiers)
      description: 'Sets the account-wide default visibility applied to newly created boards. Only meaningful

        on paid tiers — free-tier boards are always public regardless of this setting.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - visibility
              properties:
                visibility:
                  type: string
                  enum:
                  - public
                  - private
      responses:
        '200':
          description: Updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: Invalid visibility, or caller is a free/anonymous account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
  /v1/me:
    get:
      tags:
      - Account
      operationId: getMe
      summary: The signed-in user's profile
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: The user.
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/NotSignedIn'
    post:
      tags:
      - Account
      operationId: updateMe
      summary: Update nickname and/or default board visibility
      security:
      - SessionCookie: []
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                nickname:
                  type: string
                  maxLength: 40
                default_visibility:
                  type: string
                  enum:
                  - public
                  - private
                explore_optout:
                  type: boolean
                  description: Free-tier only — opt this account's questions out of the public Explore stream.
      responses:
        '200':
          description: Updated; returns the user.
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/NotSignedIn'
    delete:
      tags:
      - Account
      operationId: deleteMe
      summary: Delete the account (confirm-gated, irreversible)
      security:
      - SessionCookie: []
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - confirm
              properties:
                confirm:
                  type: string
                  description: Must exactly equal the account's nickname.
      responses:
        '200':
          description: Deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deleted'
        '400':
          description: Confirmation did not match the nickname.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/billing/checkout:
    post:
      tags:
      - Account
      operationId: billingCheckout
      summary: Start a paid-plan checkout (Polar)
      security:
      - SessionCookie: []
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - plan
              properties:
                plan:
                  type: string
                  enum:
                  - starter
                  - team
      responses:
        '200':
          description: Redirect target.
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
        '400':
          description: Unknown plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/NotSignedIn'
        '502':
          description: Checkout could not be started.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Billing is not configured on this deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/billing/portal:
    post:
      tags:
      - Account
      operationId: billingPortal
      summary: Open the customer billing portal
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: Redirect target.
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
        '401':
          $ref: '#/components/responses/NotSignedIn'
        '404':
          description: No billing account yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Portal could not be opened.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/billing/webhook:
    post:
      tags:
      - Account
      operationId: billingWebhook
      summary: Polar webhook receiver (signature-verified, idempotent)
      description: Not for clients. Standard-Webhooks signature over the raw body; unknown event types are acknowledged with `handled` false.
      responses:
        '200':
          description: Handled or acknowledged.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  handled:
                    type: boolean
        '400':
          description: Bad JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Bad signature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/me/password:
    post:
      tags:
      - Account
      operationId: changePassword
      summary: Set or change the password
      description: If a password already exists, `current_password` must be correct. OAuth-only accounts set a first password with no current one.
      security:
      - SessionCookie: []
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - new_password
              properties:
                current_password:
                  type: string
                new_password:
                  type: string
                  minLength: 8
      responses:
        '200':
          description: Updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: New password too short.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Current password is wrong.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/me/avatar/shuffle:
    post:
      tags:
      - Account
      operationId: shuffleAvatar
      summary: Re-roll the generated avatar
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: New seed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  avatar_seed:
                    type: string
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/me/avatar/reset:
    post:
      tags:
      - Account
      operationId: resetAvatar
      summary: Reset the avatar to the stable default (user id seed)
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: Reset seed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  avatar_seed:
                    type: string
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/me/api-key:
    get:
      tags:
      - Account
      operationId: getMyKey
      summary: Reveal the account's API key
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: The key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_key:
                    type: string
                  tier:
                    type: string
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/me/api-key/rotate:
    post:
      tags:
      - Account
      operationId: rotateMyKey
      summary: Issue a new API key (old one stops working immediately)
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: The new key; boards move with it.
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_key:
                    type: string
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/me/sessions:
    get:
      tags:
      - Account
      operationId: listMySessions
      summary: Active sessions for this account
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: Sessions (the current one flagged).
          content:
            application/json:
              schema:
                type: object
                properties:
                  sessions:
                    type: array
                    items:
                      type: object
                      properties:
                        created_at:
                          type: string
                        last_seen_at:
                          type: string
                        user_agent:
                          type: string
                        current:
                          type: boolean
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/me/sessions/revoke-others:
    post:
      tags:
      - Account
      operationId: revokeOtherSessions
      summary: Sign out every other device
      security:
      - SessionCookie: []
      - BearerAuth: []
      responses:
        '200':
          description: Count revoked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  revoked:
                    type: integer
        '401':
          $ref: '#/components/responses/NotSignedIn'
  /v1/avatar/{seed}:
    get:
      tags:
      - Account
      operationId: avatar
      summary: Generated mesh avatar for a seed
      description: A deterministic SVG gradient-mesh avatar — a pure function of the seed, cached immutably. Point an `` at it. No auth.
      parameters:
      - name: seed
        in: path
        required: true
        schema:
          type: string
      - name: size
        in: query
        required: false
        schema:
          type: integer
          default: 160
          minimum: 24
          maximum: 512
      responses:
        '200':
          description: The avatar.
          content:
            image/svg+xml:
              schema:
                type: string
components:
  schemas:
    Ok:
      type: object
      properties:
        ok:
          type: boolean
    Deleted:
      type: object
      properties:
        deleted:
          type: boolean
    User:
      type: object
      description: The signed-in user. Never includes the password hash or raw session.
      properties:
        id:
          type: string
        nickname:
          type: string
        email:
          type: string
          description: May be null for an OAuth-only account.
        email_verified:
          type: boolean
        avatar_seed:
          type: string
          description: Seed for GET /v1/avatar/{seed}.
        has_password:
          type: boolean
        tier:
          type: string
        default_visibility:
          type: string
          enum:
          - public
          - private
        providers:
          type: array
          items:
            type: string
            enum:
            - google
            - github
          description: Linked OAuth providers.
        created_at:
          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'
  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
    NotSignedIn:
      description: No valid session (cookie or Bearer token).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  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).'