> ## Documentation Index
> Fetch the complete documentation index at: https://data.kushiro.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Query numeric data

> Returns numeric data records. `source` is required; all other filters are optional exact-match or date-range filters.



## OpenAPI

````yaml /openapi.json get /api/v1/metrics
openapi: 3.1.0
info:
  title: k-Data
  version: 0.1.0
  description: >-
    Preview read-only API for reshaped public data collected from Kushiro City
    sources. Response shapes, URLs, and published datasets may change without
    notice.
  license:
    name: CC BY 4.0
    url: https://creativecommons.org/licenses/by/4.0/deed.ja
servers:
  - url: https://data.kushiro.app
    description: Production
security: []
tags:
  - name: service
    description: Service metadata and health endpoints.
  - name: sources
    description: Published source summaries.
  - name: metrics
    description: Numeric data records.
  - name: points
    description: >-
      Facility and location-style data records such as public facilities, AED
      locations, evacuation sites, and indexes.
  - name: terms
    description: Terms of use and attribution notes.
paths:
  /api/v1/metrics:
    get:
      tags:
        - metrics
      summary: Query numeric data
      description: >-
        Returns numeric data records. `source` is required; all other filters
        are optional exact-match or date-range filters.
      operationId: listMetrics
      parameters:
        - $ref: '#/components/parameters/SourceQuery'
        - name: metric
          in: query
          required: false
          description: >-
            Metric name exact match, for example `population_total` or
            `households_total`. Repeat the parameter (`?metric=a&metric=b`) to
            match any of several metrics (IN/OR). Takes precedence over
            `metric_prefix` when both are given.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              minLength: 1
            maxItems: 20
        - name: metric_prefix
          in: query
          required: false
          description: >-
            Metric name prefix match, for example `water_` to fetch every metric
            of one business line in a source that namespaces metrics by prefix.
            Ignored when `metric` is also supplied.
          schema:
            type: string
            minLength: 1
        - name: from
          in: query
          required: false
          description: >-
            Inclusive lower bound for `period.start_date` in `YYYY-MM-DD`
            format.
          schema:
            $ref: '#/components/schemas/DateString'
        - name: to
          in: query
          required: false
          description: Inclusive upper bound for `period.end_date` in `YYYY-MM-DD` format.
          schema:
            $ref: '#/components/schemas/DateString'
        - name: town
          in: query
          required: false
          description: Exact match for a town name.
          schema:
            type: string
            minLength: 1
        - name: age
          in: query
          required: false
          description: Exact match for an age label, for example `0歳` or `100歳以上`.
          schema:
            type: string
            minLength: 1
        - name: category_kind
          in: query
          required: false
          description: >-
            Exact match for a categorical axis kind (`dim_category.kind`), for
            example `industry`. Combine with `category_code`.
          schema:
            type: string
            minLength: 1
        - name: category_code
          in: query
          required: false
          description: >-
            Exact match for a categorical axis code (`dim_category.code`), for
            example the major industry code `E`. Used together with
            `category_kind`.
          schema:
            type: string
            minLength: 1
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: Metric query result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsResult'
              examples:
                default:
                  value:
                    metrics:
                      - id: 1
                        source_id: kushiro_population_households_monthly
                        metric: population_total
                        value: 163000
                        unit: persons
                        period:
                          granularity: month
                          start_date: '2026-04-01'
                          end_date: '2026-04-30'
                          label: 2026-04
                        town: null
                        age_bucket: null
                        category: null
                        fetched_at: '2026-04-29T00:00:00.000Z'
                        raw_blob_key: >-
                          raw/kushiro_population_households_monthly/2026-04-29T00-00-00.000Z/file.xlsx
                    total: 1
                    limit: 1000
                    offset: 0
        '400':
          $ref: '#/components/responses/InvalidQueryParameters'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    SourceQuery:
      name: source
      in: query
      required: true
      description: Source ID to query.
      schema:
        type: string
        minLength: 1
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return. Defaults to 1000.
      schema:
        type: integer
        minimum: 1
        maximum: 10000
        default: 1000
    Offset:
      name: offset
      in: query
      required: false
      description: Number of items to skip. Defaults to 0.
      schema:
        type: integer
        minimum: 0
        default: 0
  schemas:
    DateString:
      type: string
      pattern: ^\d{4}-\d{2}-\d{2}$
      example: '2026-04-01'
    MetricsResult:
      type: object
      required:
        - metrics
        - total
        - limit
        - offset
      properties:
        metrics:
          type: array
          items:
            $ref: '#/components/schemas/MetricRow'
        total:
          type: integer
          minimum: 0
        limit:
          type: integer
          minimum: 1
          maximum: 10000
        offset:
          type: integer
          minimum: 0
      additionalProperties: false
    MetricRow:
      type: object
      required:
        - id
        - source_id
        - metric
        - value
        - unit
        - period
        - town
        - age_bucket
        - category
        - fetched_at
        - raw_blob_key
      properties:
        id:
          type: integer
        source_id:
          type: string
        metric:
          type: string
        value:
          type: number
        unit:
          type:
            - string
            - 'null'
        period:
          $ref: '#/components/schemas/Period'
        town:
          type:
            - string
            - 'null'
        age_bucket:
          type:
            - string
            - 'null'
        category:
          description: >-
            Categorical axis (`dim_category`) such as industry or labour-force
            status. Null when the record has no categorical dimension.
          oneOf:
            - type: object
              required:
                - kind
                - code
                - label
              properties:
                kind:
                  type: string
                code:
                  type: string
                label:
                  type: string
              additionalProperties: false
            - type: 'null'
        fetched_at:
          type: string
          format: date-time
        raw_blob_key:
          type: string
      additionalProperties: false
    InvalidQueryError:
      type: object
      required:
        - error
        - issues
      properties:
        error:
          type: string
          example: invalid query parameters
        issues:
          type: array
          items:
            type: object
            required:
              - path
              - message
            properties:
              path:
                type: string
              message:
                type: string
            additionalProperties: false
      additionalProperties: false
    InternalServerError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: internal server error
      additionalProperties: false
    Period:
      type: object
      required:
        - granularity
        - start_date
        - end_date
        - label
      properties:
        granularity:
          type: string
          description: >-
            Time granularity label such as `month`, `year`, `calendar_year`, or
            `fiscal_year_h1`.
        start_date:
          $ref: '#/components/schemas/DateString'
        end_date:
          $ref: '#/components/schemas/DateString'
        label:
          type: string
      additionalProperties: false
  responses:
    InvalidQueryParameters:
      description: The query string failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InvalidQueryError'
          examples:
            missingSource:
              value:
                error: invalid query parameters
                issues:
                  - path: source
                    message: 'Invalid input: expected string, received undefined'
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
          examples:
            default:
              value:
                error: internal server error

````