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

# Procurement, Ausgleichsenergie and Aufschlag of a month up to a day

> The calculation of fahrplan-ist added up from the 1st of the month to
``bis``: for Germany and per Regelzone. Reads every day of the month -
slow the first time. Shared between callers for 5 minutes.



## OpenAPI

````yaml /setup/internal-openapi.json get /v1/mobile/kalkulation
openapi: 3.1.0
info:
  title: n:lead Scheduling Bridge — Internal API
  version: 0.4.0
  description: >-
    Internal API of the n:lead scheduling bridge: the process endpoints that
    drive the day-ahead pipeline (aggregate, publish the open position, submit
    schedules, generate forecasts, orchestrate), the operator console endpoints,
    and the read-only operator-app endpoints under /v1/mobile. The process and
    console endpoints require the process API key, /v1/mobile a device key of
    the mobile scope; not for customer use.
servers:
  - url: https://{host}
    description: Deployed service
    variables:
      host:
        default: api.energy.nlead.ch
        description: >-
          The service hostname - n:lead provides it (see the Base URL on the API
          introduction page)
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /v1/mobile/kalkulation:
    get:
      tags:
        - mobile
      summary: Procurement, Ausgleichsenergie and Aufschlag of a month up to a day
      description: |-
        The calculation of fahrplan-ist added up from the 1st of the month to
        ``bis``: for Germany and per Regelzone. Reads every day of the month -
        slow the first time. Shared between callers for 5 minutes.
      operationId: get_kalkulation_v1_mobile_kalkulation_get
      parameters:
        - name: bis
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: >-
              the last day, default yesterday; from the 1st of its month. As far
              as fahrplan-ist reaches
            title: Bis
          description: >-
            the last day, default yesterday; from the 1st of its month. As far
            as fahrplan-ist reaches
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KalkulationMonat'
        '401':
          description: Missing or unknown device key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
        '403':
          description: A valid key of another scope - only device keys open /v1/mobile.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
        '422':
          description: A parameter out of range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
        '429':
          description: Rate limit exceeded; wait the seconds in `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
        '503':
          description: MakoFlow could not be read; try again later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    KalkulationMonat:
      properties:
        von:
          type: string
          format: date
          title: Von
          description: the 1st of bis' month
        bis:
          type: string
          format: date
          title: Bis
        generated_at:
          type: string
          format: date-time
          title: Generated At
        summe:
          $ref: '#/components/schemas/Kalkulation'
          description: Germany
        zonen:
          items:
            $ref: '#/components/schemas/KalkulationZone'
          type: array
          title: Zonen
          description: the Regelzonen with something scheduled or measured
      additionalProperties: false
      type: object
      required:
        - von
        - bis
        - generated_at
        - summe
        - zonen
      title: KalkulationMonat
    MobileError:
      properties:
        error:
          type: string
          enum:
            - unauthorized
            - forbidden
            - invalid_request
            - rate_limited
            - upstream_unavailable
            - internal
          title: Error
      additionalProperties: false
      type: object
      required:
        - error
      title: MobileError
      description: |-
        Every error under /v1/mobile: a code, nothing else - no detail text,
        no echo of the request.
    Kalkulation:
      properties:
        spot_kauf_kwh:
          type: number
          title: Spot Kauf Kwh
          description: Fahrplan bought day-ahead
        spot_kauf_eur:
          type: number
          title: Spot Kauf Eur
        spot_verkauf_kwh:
          type: number
          title: Spot Verkauf Kwh
          description: Fahrplan sold day-ahead
        spot_verkauf_eur:
          type: number
          title: Spot Verkauf Eur
        spot_netto_kwh:
          type: number
          title: Spot Netto Kwh
        spot_netto_eur:
          type: number
          title: Spot Netto Eur
        spot_preis_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Spot Preis Ct Kwh
        ausgleich_kurz_kwh:
          type: number
          title: Ausgleich Kurz Kwh
          description: Ist above the Fahrplan
        ausgleich_lang_kwh:
          type: number
          title: Ausgleich Lang Kwh
          description: Ist below the Fahrplan
        ausgleich_eur:
          type: number
          title: Ausgleich Eur
          description: 'positive: to pay; negative: a credit'
        ausgleich_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Ausgleich Ct Kwh
          description: per customer kWh
        ausgleich_geschaetzt:
          type: boolean
          title: Ausgleich Geschaetzt
          description: on a reBAP rebuilt, from the TSOs' estimator or forecast
        kunde_kwh:
          type: number
          title: Kunde Kwh
          description: >-
            what the customers took: the Ist, the Fahrplan where it has not
            arrived (kunde_bezug)
        kunde_spot_eur:
          type: number
          title: Kunde Spot Eur
          description: kunde_kwh at the spot price
        kunde_spot_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Kunde Spot Ct Kwh
        kunde_bezug:
          anyOf:
            - type: string
              enum:
                - ist
                - fahrplan
                - teilweise
            - type: 'null'
          title: Kunde Bezug
        gesamtkosten_eur:
          type: number
          title: Gesamtkosten Eur
          description: net procurement plus Ausgleich
        kosten_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Kosten Ct Kwh
        mehrkosten_eur:
          type: number
          title: Mehrkosten Eur
          description: Gesamtkosten minus kunde_spot_eur
        aufschlag_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Aufschlag Ct Kwh
          description: what the customers' spot price falls short by, per kWh
        viertelstunden_ist:
          type: integer
          title: Viertelstunden Ist
        viertelstunden_fahrplan:
          type: integer
          title: Viertelstunden Fahrplan
          description: counted on the Fahrplan
        viertelstunden_ohne_preis:
          type: integer
          title: Viertelstunden Ohne Preis
        vollstaendig:
          type: boolean
          title: Vollstaendig
      additionalProperties: false
      type: object
      required:
        - spot_kauf_kwh
        - spot_kauf_eur
        - spot_verkauf_kwh
        - spot_verkauf_eur
        - spot_netto_kwh
        - spot_netto_eur
        - spot_preis_ct_kwh
        - ausgleich_kurz_kwh
        - ausgleich_lang_kwh
        - ausgleich_eur
        - ausgleich_ct_kwh
        - ausgleich_geschaetzt
        - kunde_kwh
        - kunde_spot_eur
        - kunde_spot_ct_kwh
        - kunde_bezug
        - gesamtkosten_eur
        - kosten_ct_kwh
        - mehrkosten_eur
        - aufschlag_ct_kwh
        - viertelstunden_ist
        - viertelstunden_fahrplan
        - viertelstunden_ohne_preis
        - vollstaendig
      title: Kalkulation
      description: |-
        A day's or a period's procurement against what the customers took,
        in kWh and EUR - the console's calculation without the customers'
        contractual Aufschlag, their revenue and the margin.
    KalkulationZone:
      properties:
        spot_kauf_kwh:
          type: number
          title: Spot Kauf Kwh
          description: Fahrplan bought day-ahead
        spot_kauf_eur:
          type: number
          title: Spot Kauf Eur
        spot_verkauf_kwh:
          type: number
          title: Spot Verkauf Kwh
          description: Fahrplan sold day-ahead
        spot_verkauf_eur:
          type: number
          title: Spot Verkauf Eur
        spot_netto_kwh:
          type: number
          title: Spot Netto Kwh
        spot_netto_eur:
          type: number
          title: Spot Netto Eur
        spot_preis_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Spot Preis Ct Kwh
        ausgleich_kurz_kwh:
          type: number
          title: Ausgleich Kurz Kwh
          description: Ist above the Fahrplan
        ausgleich_lang_kwh:
          type: number
          title: Ausgleich Lang Kwh
          description: Ist below the Fahrplan
        ausgleich_eur:
          type: number
          title: Ausgleich Eur
          description: 'positive: to pay; negative: a credit'
        ausgleich_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Ausgleich Ct Kwh
          description: per customer kWh
        ausgleich_geschaetzt:
          type: boolean
          title: Ausgleich Geschaetzt
          description: on a reBAP rebuilt, from the TSOs' estimator or forecast
        kunde_kwh:
          type: number
          title: Kunde Kwh
          description: >-
            what the customers took: the Ist, the Fahrplan where it has not
            arrived (kunde_bezug)
        kunde_spot_eur:
          type: number
          title: Kunde Spot Eur
          description: kunde_kwh at the spot price
        kunde_spot_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Kunde Spot Ct Kwh
        kunde_bezug:
          anyOf:
            - type: string
              enum:
                - ist
                - fahrplan
                - teilweise
            - type: 'null'
          title: Kunde Bezug
        gesamtkosten_eur:
          type: number
          title: Gesamtkosten Eur
          description: net procurement plus Ausgleich
        kosten_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Kosten Ct Kwh
        mehrkosten_eur:
          type: number
          title: Mehrkosten Eur
          description: Gesamtkosten minus kunde_spot_eur
        aufschlag_ct_kwh:
          anyOf:
            - type: number
            - type: 'null'
          title: Aufschlag Ct Kwh
          description: what the customers' spot price falls short by, per kWh
        viertelstunden_ist:
          type: integer
          title: Viertelstunden Ist
        viertelstunden_fahrplan:
          type: integer
          title: Viertelstunden Fahrplan
          description: counted on the Fahrplan
        viertelstunden_ohne_preis:
          type: integer
          title: Viertelstunden Ohne Preis
        vollstaendig:
          type: boolean
          title: Vollstaendig
        control_area:
          type: string
          enum:
            - 50Hertz
            - Amprion
            - TenneT
            - TransnetBW
          title: Control Area
      additionalProperties: false
      type: object
      required:
        - spot_kauf_kwh
        - spot_kauf_eur
        - spot_verkauf_kwh
        - spot_verkauf_eur
        - spot_netto_kwh
        - spot_netto_eur
        - spot_preis_ct_kwh
        - ausgleich_kurz_kwh
        - ausgleich_lang_kwh
        - ausgleich_eur
        - ausgleich_ct_kwh
        - ausgleich_geschaetzt
        - kunde_kwh
        - kunde_spot_eur
        - kunde_spot_ct_kwh
        - kunde_bezug
        - gesamtkosten_eur
        - kosten_ct_kwh
        - mehrkosten_eur
        - aufschlag_ct_kwh
        - viertelstunden_ist
        - viertelstunden_fahrplan
        - viertelstunden_ohne_preis
        - vollstaendig
        - control_area
      title: KalkulationZone
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.