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

# Get the provider invoice reconciliation for a month (bearer twin)

> What each cloud credential's provider billed for a month against what the metering estimated for the same clusters. Lines stay in the provider's currency; the estimate is converted at the stated rate. A credential with no imported document is absent, a failed import says so, a line nothing places on a cluster is listed with its amount, and a difference is stated only when the provider's figures are final and the estimate covers every hour of the month for every cluster the invoice names. Bearer-PAT twin of the browser route of the same name under /org.



## OpenAPI

````yaml https://platform.ankra.app/openapi.json get /api/v1/org/cloud-cost/reconciliation
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://platform.ankra.app
security: []
tags:
  - name: Clusters
    description: Create, inspect and manage clusters, and the stacks deployed on them.
  - name: Managed Clusters
    description: Provider-managed control planes, driven through one common surface.
  - name: Imported Clusters
    description: Clusters that already existed and were connected to Ankra.
  - name: Cluster Access
    description: Kubeconfigs, service-account tokens and per-cluster access grants.
  - name: Kubernetes
    description: Read and act on the Kubernetes objects inside a cluster.
  - name: AWS Clusters
    description: >-
      Provision and manage self-managed k3s / kubeadm clusters on AWS EC2 in
      your own VPC.
  - name: DigitalOcean Clusters
    description: Provision and manage DigitalOcean Kubernetes clusters.
  - name: Hetzner Clusters
    description: Provision and manage Hetzner Kubernetes clusters.
  - name: OVH Clusters
    description: Provision and manage OVH Kubernetes clusters.
  - name: Scaleway Clusters
    description: Provision and manage Scaleway Kapsule clusters.
  - name: UpCloud Clusters
    description: Provision and manage UpCloud Kubernetes clusters.
  - name: Applications
    description: Deploy, configure and observe applications across the fleet.
  - name: Backups
    description: >-
      Backup vaults, restore points, protection posture and captures for stacks
      and application deployments; a completed capture is not a verified
      restore.
  - name: Stack Profiles
    description: Reusable stack definitions, their versions and sharing.
  - name: Services
    description: >-
      Versioned service packages and explicit sharing. Runtime admission is
      separate from publication.
  - name: Charts
    description: Browse the chart catalogue behind stacks and addons.
  - name: Helm
    description: Helm registries, credentials and the charts they expose.
  - name: Executions
    description: Long-running platform executions and their jobs.
  - name: Operations
    description: Cancel in-flight cluster operations and their jobs.
  - name: Chat
    description: Conversational sessions, plans and confirmable actions.
  - name: AI Agent Runs
    description: Autonomous agent runs and their outcomes.
  - name: AI Tickets
    description: The AI ticket board, its sync connections and settings.
  - name: AI Playbooks
    description: Reusable playbooks the AI lanes execute.
  - name: AI Conditions
    description: Conditions that gate AI autonomy.
  - name: AI Remediation
    description: >-
      The organisation's auto-remediation policy: what the AI lanes may fix by
      themselves, and who approves the rest.
  - name: AI Engineering Handoffs
    description: Work the AI lanes escalate to a human engineer.
  - name: AI Environment
    description: The environment and base stacks AI demos deploy into.
  - name: Security
    description: Findings, advisories, SBOMs, compliance and posture.
  - name: Cost
    description: Cluster and fleet cost, rate cards and cost settings.
  - name: Decisions
    description: >-
      The decision ledger behind the Security and Cost queues: proposals a
      surface computed, the approve and set-aside decisions people took on them,
      and the receipts of running them.
  - name: Billing
    description: Subscription and spend caps.
  - name: Organisation
    description: Members, invitations, audit logs and organisation settings.
  - name: Account Tokens
    description: Personal access tokens for the API and CLI.
  - name: Credentials
    description: The shared credential store.
  - name: AWS Credentials
    description: >-
      AWS credentials: access keys or CloudFormation-onboarded STS roles for
      cost, EKS and self-managed provisioning.
  - name: Azure Credentials
    description: Azure credentials and SSH keys.
  - name: DigitalOcean Credentials
    description: DigitalOcean credentials and SSH keys.
  - name: Hetzner Credentials
    description: Hetzner credentials and SSH keys.
  - name: OVH Credentials
    description: OVH credentials and SSH keys.
  - name: Scaleway Credentials
    description: Scaleway credentials.
  - name: UpCloud Credentials
    description: UpCloud credentials and SSH keys.
  - name: Data Source Credentials
    description: Credentials for metrics and log sources.
  - name: DNS Credentials
    description: Credentials for DNS providers.
  - name: Object Storage Buckets
    description: >-
      Buckets Ankra creates and manages on an organisation's own provider
      credentials.
  - name: DNS
    description: DNS zones and records, including custom organisation zones.
  - name: Cloudflare
    description: Cloudflare domains and the credentials behind them.
  - name: Variables
    description: Organisation- and cluster-scoped variables.
  - name: SOPS
    description: Encrypt and decrypt values with the organisation SOPS config.
  - name: Alerts
    description: Alert integrations and ingest credentials.
  - name: Notifications
    description: Notification routes and their delivery targets.
  - name: Support
    description: Support tickets.
  - name: AI Settings
    description: Organisation AI provider, model catalog and per-function model settings
paths:
  /api/v1/org/cloud-cost/reconciliation:
    get:
      tags:
        - Cost
      summary: Get the provider invoice reconciliation for a month (bearer twin)
      description: >-
        What each cloud credential's provider billed for a month against what
        the metering estimated for the same clusters. Lines stay in the
        provider's currency; the estimate is converted at the stated rate. A
        credential with no imported document is absent, a failed import says so,
        a line nothing places on a cluster is listed with its amount, and a
        difference is stated only when the provider's figures are final and the
        estimate covers every hour of the month for every cluster the invoice
        names. Bearer-PAT twin of the browser route of the same name under /org.
      operationId: cloud_cost_reconciliation_api_v1_org_cloud_cost_get
      parameters:
        - description: PAT organisation override.
          in: header
          name: x-ankra-organisation-id
          required: false
          schema:
            type: string
        - description: >-
            The UTC month as YYYY-MM, not in the future; the last closed month
            when omitted.
          in: query
          name: month
          required: false
          schema:
            pattern: ^[0-9]{4}-[0-9]{2}$
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconciliationResponse'
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: >-
            Missing or malformed Authorization header, or a month that is not
            YYYY-MM or lies in the future
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Unknown, expired, or revoked API token
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: >-
            Token may not use this surface (MCP-scoped token or service account
            restriction)
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Internal server error
      security:
        - BearerAuth: []
components:
  schemas:
    ReconciliationResponse:
      description: >-
        Per cloud credential and UTC month, what the provider billed (imported
        invoice lines, in the provider's own currency) against what the metering
        estimated for the clusters those lines are placed on. Nothing unknown
        reads as agreement.
      properties:
        month:
          description: The month read, as YYYY-MM.
          type: string
        month_closed:
          description: >-
            The month has ended; for a running month both sides are month to
            date.
          type: boolean
        period_hours:
          type: integer
        generated_at:
          type: string
          format: date-time
        credentials:
          items:
            $ref: '#/components/schemas/ReconciliationCredential'
          type: array
      required:
        - month
        - month_closed
        - period_hours
        - generated_at
        - credentials
      title: ReconciliationResponse
      type: object
    ContractDetailError:
      example:
        detail: Cluster not found
      properties:
        detail:
          oneOf:
            - type: string
            - additionalProperties: true
              properties: {}
              type: object
      required:
        - detail
      type: object
    ReconciliationCredential:
      description: >-
        One cloud credential's month. Amounts are in currency, the invoice's
        own; the estimate is converted into it at estimate_fx. A null amount is
        unknown, never zero, and difference_reason says why a difference is not
        stated.
      properties:
        credential_id:
          type: string
          format: uuid
        credential_name:
          anyOf:
            - description: Null when the credential has been deleted since.
              type: string
            - type: 'null'
        provider:
          type: string
        state:
          description: >-
            The last import attempt's state, or absent when no billing document
            was ever imported for the month.
          enum:
            - absent
            - complete
            - partial
            - failed
            - missing_billing_scope
            - not_supported
          type: string
        imports:
          items:
            $ref: '#/components/schemas/ReconciliationImport'
          type: array
        currency:
          anyOf:
            - type: string
            - type: 'null'
        currencies_mixed:
          description: The lines are in more than one currency, so no amount is summed.
          type: boolean
        invoice_minor:
          anyOf:
            - description: Every billed line but tax and credits, in minor units.
              type: integer
            - type: 'null'
        tax_minor:
          anyOf:
            - type: integer
            - type: 'null'
        credit_minor:
          anyOf:
            - type: integer
            - type: 'null'
        matched_minor:
          anyOf:
            - description: The reconcilable lines placed on a cluster.
              type: integer
            - type: 'null'
        unmatched_minor:
          anyOf:
            - description: The reconcilable lines nothing placed on a cluster.
              type: integer
            - type: 'null'
        estimate_minor:
          anyOf:
            - description: >-
                The metering's estimate for the clusters the matched lines are
                placed on, in currency; null when any of them has no estimate
                recorded for the month.
              type: integer
            - type: 'null'
        estimate_complete:
          anyOf:
            - description: >-
                Every one of those clusters was metered every hour of the month;
                false makes the estimate a floor.
              type: boolean
            - type: 'null'
        estimate_fx:
          anyOf:
            - $ref: '#/components/schemas/ReconciliationFX'
            - type: 'null'
        difference_pct:
          anyOf:
            - description: >-
                (matched - estimate) / estimate, as a percentage; stated only
                when the provider's figures are final and the estimate is
                complete.
              type: number
            - type: 'null'
        difference_reason:
          anyOf:
            - description: Why no difference is stated.
              type: string
            - type: 'null'
        unplaced_priced_minor:
          anyOf:
            - description: >-
                The part of unmatched_minor in categories the estimate prices
                (compute, storage, network, load balancers, control planes):
                billing that may belong to a cluster named here although nothing
                placed it.
              type: integer
            - type: 'null'
        difference_caveat:
          anyOf:
            - description: >-
                Set when unplaced lines exist in categories the estimate prices:
                the difference can understate what the named clusters were
                billed.
              type: string
            - type: 'null'
        clusters:
          items:
            $ref: '#/components/schemas/ReconciliationCluster'
          type: array
        unmatched_lines:
          items:
            $ref: '#/components/schemas/ReconciliationLine'
          type: array
        unmatched_line_count:
          type: integer
        unmatched_truncated:
          description: >-
            unmatched_lines lists only the largest of them; the count and the
            total cover every one.
          type: boolean
      required:
        - credential_id
        - credential_name
        - provider
        - state
        - imports
        - currency
        - currencies_mixed
        - invoice_minor
        - tax_minor
        - credit_minor
        - matched_minor
        - unmatched_minor
        - estimate_minor
        - estimate_complete
        - estimate_fx
        - difference_pct
        - difference_reason
        - unplaced_priced_minor
        - difference_caveat
        - clusters
        - unmatched_lines
        - unmatched_line_count
        - unmatched_truncated
      title: ReconciliationCredential
      type: object
    ReconciliationImport:
      description: >-
        One billing document's last import attempt. A failed attempt keeps the
        lines an earlier one stored: lines_state says whether they are final and
        succeeded_at when they were read.
      properties:
        source:
          enum:
            - api
            - csv
          type: string
        source_document_id:
          type: string
        state:
          enum:
            - complete
            - partial
            - failed
            - missing_billing_scope
            - not_supported
          type: string
        lines_state:
          anyOf:
            - description: >-
                Whether the stored lines are the provider's final figures
                (complete) or month to date (partial); null when no attempt ever
                stored any.
              enum:
                - complete
                - partial
              type: string
            - type: 'null'
        reason:
          anyOf:
            - type: string
            - type: 'null'
        currency:
          anyOf:
            - type: string
            - type: 'null'
        line_count:
          type: integer
        attempted_at:
          type: string
          format: date-time
        succeeded_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
      required:
        - source
        - source_document_id
        - state
        - lines_state
        - reason
        - currency
        - line_count
        - attempted_at
        - succeeded_at
      title: ReconciliationImport
      type: object
    ReconciliationFX:
      description: >-
        The rate the estimate (held in canonical USD) was converted at: the
        latest stored rate, not the month's own.
      properties:
        from:
          type: string
        to:
          type: string
        rate_from_usd:
          type: number
        as_of:
          anyOf:
            - description: >-
                When the stored rate was refreshed; null when the built-in seed
                rate was used.
              format: date-time
              type: string
            - type: 'null'
      required:
        - from
        - to
        - rate_from_usd
        - as_of
      title: ReconciliationFX
      type: object
    ReconciliationCluster:
      description: One cluster the invoice's lines are placed on.
      properties:
        cluster_id:
          type: string
          format: uuid
        cluster_name:
          type: string
        invoice_minor:
          anyOf:
            - type: integer
            - type: 'null'
        line_count:
          type: integer
        estimate_minor:
          anyOf:
            - description: >-
                Null when the metering recorded no estimate for the cluster that
                month.
              type: integer
            - type: 'null'
        metered_hours:
          anyOf:
            - type: integer
            - type: 'null'
        lifetime_hours:
          anyOf:
            - description: >-
                The whole hours of the month the cluster existed (to now, for a
                running month): what a complete estimate covers.
              type: integer
            - type: 'null'
        period_hours:
          type: integer
      required:
        - cluster_id
        - cluster_name
        - invoice_minor
        - line_count
        - estimate_minor
        - metered_hours
        - lifetime_hours
        - period_hours
      title: ReconciliationCluster
      type: object
    ReconciliationLine:
      description: >-
        One billed line nothing placed on a cluster, kept with its amount in its
        own currency.
      properties:
        line_key:
          type: string
        external_id:
          anyOf:
            - type: string
            - type: 'null'
        external_id_kind:
          anyOf:
            - type: string
            - type: 'null'
        category:
          type: string
        description:
          type: string
        amount_minor:
          type: integer
        currency:
          type: string
      required:
        - line_key
        - external_id
        - external_id_kind
        - category
        - description
        - amount_minor
        - currency
      title: ReconciliationLine
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: PAT
      scheme: bearer
      type: http

````