> ## 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.

# The operational state at a glance

> Service state, the day ahead (T+1) with its stages, Engrate's verdict
and the gate, the day-ahead milestones, and the days from yesterday to
the end of the forecast horizon. Shared between callers for 15 seconds.



## OpenAPI

````yaml /setup/internal-openapi.json get /v1/mobile/summary
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/summary:
    get:
      tags:
        - mobile
      summary: The operational state at a glance
      description: |-
        Service state, the day ahead (T+1) with its stages, Engrate's verdict
        and the gate, the day-ahead milestones, and the days from yesterday to
        the end of the forecast horizon. Shared between callers for 15 seconds.
      operationId: get_summary_v1_mobile_summary_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileSummary'
        '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'
        '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'
      security:
        - APIKeyHeader: []
components:
  schemas:
    MobileSummary:
      properties:
        contract_version:
          type: string
          title: Contract Version
          examples:
            - '1.0'
        min_app_version:
          type: string
          title: Min App Version
          examples:
            - 0.1.0
        generated_at:
          type: string
          format: date-time
          title: Generated At
        generated_at_local:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: Generated At Local
          examples:
            - '14:30'
        caller:
          type: string
          title: Caller
        scopes:
          items:
            type: string
            const: mobile
          type: array
          title: Scopes
        version:
          type: string
          title: Version
        service_state:
          type: string
          enum:
            - running
            - stopped
          title: Service State
        engrate_environment:
          type: string
          enum:
            - staging
            - production
          title: Engrate Environment
        last_event_id:
          type: integer
          title: Last Event Id
        epoch:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Epoch
          description: >-
            timestamp of the first event; a change means the event log was
            replaced and event ids restarted
        last_orchestrate_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Orchestrate At
          description: >-
            the orchestrator's last call; null until it has run once since this
            was recorded
        heartbeat_stale:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Heartbeat Stale
        milestones:
          items:
            $ref: '#/components/schemas/Milestone'
          type: array
          title: Milestones
        t_plus_1:
          $ref: '#/components/schemas/TomorrowState'
        badge:
          $ref: '#/components/schemas/Badge'
        badge_timeline:
          items:
            $ref: '#/components/schemas/TimelineEntry'
          type: array
          title: Badge Timeline
          description: strictly ascending; the first entry is at generated_at
        timeline_end:
          type: string
          format: date-time
          title: Timeline End
          description: >-
            beyond this instant the timeline says nothing - clients render grey
            from here or from generated_at + expire_after_s, whichever comes
            first
        stale_after_s:
          type: integer
          title: Stale After S
          description: from generated_at + this, clients add 'Stand HH:MM'
        expire_after_s:
          type: integer
          title: Expire After S
          description: from generated_at + this, clients render grey
        overlays:
          $ref: '#/components/schemas/Overlays'
        days:
          items:
            $ref: '#/components/schemas/DaySummary'
          type: array
          title: Days
          description: T-1 to T+horizon, oldest first
        events_24h:
          $ref: '#/components/schemas/EventCounts'
          description: warnings and errors of the last 24 hours on the feed
        wiedervorlagen_count:
          type: integer
          title: Wiedervorlagen Count
        alert_channels:
          $ref: '#/components/schemas/AlertChannels'
        snapshot:
          $ref: '#/components/schemas/Snapshot'
      additionalProperties: false
      type: object
      required:
        - contract_version
        - min_app_version
        - generated_at
        - generated_at_local
        - caller
        - scopes
        - version
        - service_state
        - engrate_environment
        - last_event_id
        - epoch
        - last_orchestrate_at
        - heartbeat_stale
        - milestones
        - t_plus_1
        - badge
        - badge_timeline
        - timeline_end
        - stale_after_s
        - expire_after_s
        - overlays
        - days
        - events_24h
        - wiedervorlagen_count
        - alert_channels
        - snapshot
      title: MobileSummary
    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.
    Milestone:
      properties:
        key:
          type: string
          enum:
            - forecast_expected
            - trader_pickup
            - epex
            - gate_warn
            - gate_closure
          title: Key
        at:
          type: string
          format: date-time
          title: At
        at_local:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: At Local
          examples:
            - '14:30'
      additionalProperties: false
      type: object
      required:
        - key
        - at
        - at_local
      title: Milestone
    TomorrowState:
      properties:
        delivery_day:
          type: string
          format: date
          title: Delivery Day
        source:
          anyOf:
            - type: string
              enum:
                - customer
                - generated
                - backup
            - type: 'null'
          title: Source
          description: null while the day has no input
        aggregated:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Aggregated
        published:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Published
        submitted:
          type: string
          enum:
            - done
            - stale
            - pending
            - rejected
          title: Submitted
        interval_count:
          type: integer
          title: Interval Count
          description: 92, 96 or 100 quarter-hours
        accepted:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Accepted
          description: >-
            Engrate's verdict on the submission of the current input; null when
            the current input has not been submitted
        balanced:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Balanced
        imbalance_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Imbalance Count
        previous_accepted:
          type: boolean
          title: Previous Accepted
          description: an older input of this day was submitted and accepted
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published At
          description: >-
            when the current input's CSV went to the trader; null before that,
            and for days published before this was recorded
        published_at_local:
          anyOf:
            - type: string
              pattern: ^\d{2}:\d{2}$
              examples:
                - '14:30'
            - type: 'null'
          title: Published At Local
        gate_closure_at:
          type: string
          format: date-time
          title: Gate Closure At
        gate_closure_local:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: Gate Closure Local
          examples:
            - '14:30'
        warn_from:
          type: string
          format: date-time
          title: Warn From
        warn_from_local:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: Warn From Local
          examples:
            - '14:30'
        gate_warning_fired:
          type: boolean
          title: Gate Warning Fired
      additionalProperties: false
      type: object
      required:
        - delivery_day
        - source
        - aggregated
        - published
        - submitted
        - interval_count
        - accepted
        - balanced
        - imbalance_count
        - previous_accepted
        - published_at
        - published_at_local
        - gate_closure_at
        - gate_closure_local
        - warn_from
        - warn_from_local
        - gate_warning_fired
      title: TomorrowState
      description: The day ahead (T+1, Berlin) - the one the gate closes for today.
    Badge:
      properties:
        color:
          type: string
          enum:
            - neutral
            - green
            - amber
            - red
          title: Color
        code:
          type: string
          enum:
            - no_input
            - no_input_gate_passed
            - rejected
            - accepted
            - imbalance
            - old_version_accepted
            - gate_missed
            - gate_warning
            - awaiting_forecast
            - backup_only
            - new_forecast
            - not_published
            - published_late
            - running
            - stopped
          title: Code
        label_de:
          type: string
          title: Label De
        label_en:
          type: string
          title: Label En
        countdown_to:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Countdown To
          description: gate closure, only inside the warning window
        next_gate_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Next Gate At
          description: the next gate closure, once today's has passed
      additionalProperties: false
      type: object
      required:
        - color
        - code
        - label_de
        - label_en
        - countdown_to
        - next_gate_at
      title: Badge
      description: |-
        How the day ahead stands, decided by the server's rules. Clients
        render it as given; grey is theirs alone, for data too old to trust.
    TimelineEntry:
      properties:
        color:
          type: string
          enum:
            - neutral
            - green
            - amber
            - red
          title: Color
        code:
          type: string
          enum:
            - no_input
            - no_input_gate_passed
            - rejected
            - accepted
            - imbalance
            - old_version_accepted
            - gate_missed
            - gate_warning
            - awaiting_forecast
            - backup_only
            - new_forecast
            - not_published
            - published_late
            - running
            - stopped
          title: Code
        label_de:
          type: string
          title: Label De
        label_en:
          type: string
          title: Label En
        countdown_to:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Countdown To
          description: gate closure, only inside the warning window
        next_gate_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Next Gate At
          description: the next gate closure, once today's has passed
        at:
          type: string
          format: date-time
          title: At
        at_local:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: At Local
          examples:
            - '14:30'
        delivery_day:
          type: string
          format: date
          title: Delivery Day
      additionalProperties: false
      type: object
      required:
        - color
        - code
        - label_de
        - label_en
        - countdown_to
        - next_gate_at
        - at
        - at_local
        - delivery_day
      title: TimelineEntry
      description: |-
        What the badge will be from ``at`` on, if nothing changes and
        nothing is fetched - for widgets and complications offline.
    Overlays:
      properties:
        environment:
          type: string
          enum:
            - live
            - test
          title: Environment
        environment_label:
          type: string
          enum:
            - LIVE
            - TEST
          title: Environment Label
        stopped:
          type: boolean
          title: Stopped
        heartbeat_stale:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Heartbeat Stale
          description: >-
            the orchestrator has not run for longer than
            MOBILE_HEARTBEAT_STALE_AFTER_SECONDS (20 minutes); null until it has
            run once since this was recorded
      additionalProperties: false
      type: object
      required:
        - environment
        - environment_label
        - stopped
        - heartbeat_stale
      title: Overlays
    DaySummary:
      properties:
        delivery_day:
          type: string
          format: date
          title: Delivery Day
        offset_days:
          type: integer
          title: Offset Days
          description: days from today (Berlin), T-1 is -1
        source:
          anyOf:
            - type: string
              enum:
                - customer
                - generated
                - backup
            - type: 'null'
          title: Source
        aggregated:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Aggregated
        published:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Published
        submitted:
          type: string
          enum:
            - done
            - stale
            - pending
            - rejected
          title: Submitted
        interval_count:
          type: integer
          title: Interval Count
        customers_total:
          type: integer
          title: Customers Total
          description: confirmed customers in supply on the day (ramp-up snapshot)
        backup_weak:
          type: boolean
          title: Backup Weak
          description: the backup misses customers that had no reference shape
        deviation_pct:
          anyOf:
            - type: number
            - type: 'null'
          title: Deviation Pct
          description: >-
            backup minus customer forecast, in % of the customer's daily
            consumption; null unless both exist
      additionalProperties: false
      type: object
      required:
        - delivery_day
        - offset_days
        - source
        - aggregated
        - published
        - submitted
        - interval_count
        - customers_total
        - backup_weak
        - deviation_pct
      title: DaySummary
    EventCounts:
      properties:
        error:
          type: integer
          title: Error
        warning:
          type: integer
          title: Warning
      additionalProperties: false
      type: object
      required:
        - error
        - warning
      title: EventCounts
    AlertChannels:
      properties:
        pushover:
          type: boolean
          title: Pushover
        slack:
          type: boolean
          title: Slack
        teams:
          type: boolean
          title: Teams
        sms:
          type: boolean
          title: Sms
      additionalProperties: false
      type: object
      required:
        - pushover
        - slack
        - teams
        - sms
      title: AlertChannels
    Snapshot:
      properties:
        contract_version:
          type: string
          title: Contract Version
        generated_at:
          type: string
          format: date-time
          title: Generated At
        stale_after_s:
          type: integer
          title: Stale After S
        expire_after_s:
          type: integer
          title: Expire After S
        timeline_end:
          type: string
          format: date-time
          title: Timeline End
        badge:
          $ref: '#/components/schemas/Badge'
        badge_timeline:
          items:
            $ref: '#/components/schemas/TimelineEntry'
          type: array
          title: Badge Timeline
        overlays:
          $ref: '#/components/schemas/Overlays'
        t_plus_1:
          $ref: '#/components/schemas/SnapshotTomorrow'
        events_24h:
          $ref: '#/components/schemas/EventCounts'
        wiedervorlagen_count:
          type: integer
          title: Wiedervorlagen Count
      additionalProperties: false
      type: object
      required:
        - contract_version
        - generated_at
        - stale_after_s
        - expire_after_s
        - timeline_end
        - badge
        - badge_timeline
        - overlays
        - t_plus_1
        - events_24h
        - wiedervorlagen_count
      title: Snapshot
      description: |-
        Exactly what native surfaces (widgets, watch, Live Activity) may
        store: no energy, no names, no event text, no caller, no configuration
        beyond the staleness thresholds it needs offline - LIVE/TEST and stopped
        are in the overlays. Stored verbatim, so they are covered by this
        contract and its fixtures.
    SnapshotTomorrow:
      properties:
        delivery_day:
          type: string
          format: date
          title: Delivery Day
        aggregated:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Aggregated
        published:
          type: string
          enum:
            - done
            - stale
            - pending
          title: Published
        submitted:
          type: string
          enum:
            - done
            - stale
            - pending
            - rejected
          title: Submitted
        gate_closure_at:
          type: string
          format: date-time
          title: Gate Closure At
        warn_from:
          type: string
          format: date-time
          title: Warn From
      additionalProperties: false
      type: object
      required:
        - delivery_day
        - aggregated
        - published
        - submitted
        - gate_closure_at
        - warn_from
      title: SnapshotTomorrow
  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.