> For the complete documentation index, see [llms.txt](https://experience-digital-transform.gitbook.io/experience-digital-transformation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://experience-digital-transform.gitbook.io/experience-digital-transformation/analytics/technical-specifications/13.-openapi-3.0-specification-appendix.md).

# 13. OpenAPI 3.0 Specification (Appendix)

Appendix — an illustrative OpenAPI 3.0 extract covering data ingestion, multi-source reconciliation, query execution, and event subscription.

{% hint style="info" %}
💻 **Illustrative, not exhaustive** — six representative endpoints spanning ingestion, reconciliation, query, and subscriptions.
{% endhint %}

The following extract defines representative external interfaces for the Analytics Building Block: the Data Ingestion Interface, the Analytical Query Engine, and (new in this version) multi-source reconciliation and event subscription. It is illustrative; the full machine-readable definition is delivered as a separate artefact.

```yaml
openapi: 3.0.3
info:
  title: GovStack Analytics Building Block API
  version: 0.2.0
  description: >
    Endpoints for ingesting harmonised payloads into the Silver layer,
    submitting multi-source estimates for reconciliation, executing
    federated or OLAP queries, and subscribing to data-publication events.
servers:
  - url: https://api.analytics.govstack.global/v1
paths:
  /ingestion/payload:
    post:
      summary: Submit harmonised dataset (batch or micro-batch)
      security: [ { BearerAuth: [] } ]
      requestBody:
        required: true
        content: { application/json: { schema: { $ref: '#/components/schemas/IngestionPayload' } } }
      responses:
        '202': { description: Accepted; returns receipt_token }
  /reconciliation/estimates:
    post:
      summary: Submit one source's estimate for an analytical unit
      description: Stores an estimate (N per unit); does not merge sources.
      security: [ { BearerAuth: [] } ]
      requestBody:
        required: true
        content: { application/json: { schema: { $ref: '#/components/schemas/SourceEstimate' } } }
      responses:
        '201': { description: Estimate stored }
  /reconciliation/units/{unitKey}/result:
    get:
      summary: Retrieve reconciliation gap analysis and flag for a unit
      security: [ { BearerAuth: [] } ]
      responses:
        '200': { description: ReconciliationResult with discrepancy and flag_status }
  /reconciliation/units/{unitKey}/decision:
    post:
      summary: Record an append-only, governed source-selection decision
      security: [ { BearerAuth: [] } ]
      requestBody:
        required: true
        content: { application/json: { schema: { $ref: '#/components/schemas/ReconciliationDecision' } } }
      responses:
        '201': { description: Decision recorded (append-only) }
  /query:
    post:
      summary: Execute a federated or OLAP query (SQL or natural language)
      security: [ { BearerAuth: [] } ]
      requestBody:
        required: true
        content: { application/json: { schema: { $ref: '#/components/schemas/QueryRequest' } } }
      responses:
        '200': { description: Access-controlled QueryResult }
  /subscriptions:
    post:
      summary: Register a webhook for data-publication / promotion events
      security: [ { BearerAuth: [] } ]
      responses:
        '201': { description: Subscription registered }
components:
  securitySchemes:
    BearerAuth: { type: http, scheme: bearer, bearerFormat: JWT }
  schemas:
    SourceEstimate:
      type: object
      properties:
        unit_key: { type: string, example: 'AFOLU|forest_mgmt_area_3|af_forest_cover|cycle_2025' }
        source_id: { type: string, example: 'climate_trace_afolu' }
        kind: { type: string, enum: [bottom_up, observed] }
        value: { type: number }
        unit_of_measure: { type: string, example: 'MtCO2e' }
        confidence: { type: number, example: 0.75 }
        method: { type: string }
    ReconciliationDecision:
      type: object
      properties:
        unit_key: { type: string }
        selected_source: { type: string }
        designation: { type: string, enum: [official, supplementary, blend] }
        rationale: { type: string }
        actor_id: { type: string }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://experience-digital-transform.gitbook.io/experience-digital-transformation/analytics/technical-specifications/13.-openapi-3.0-specification-appendix.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
