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

# Post Mailbox Sortieren

> File handled mail by what its case means today: a mail whose
Wiedervorlage is still open goes to the Wiedervorlage folder, a mail
from a partner whose PARTIN and Zuordnung are both acknowledged goes
to the zugeordnet folder, everything else stays in the archive. The
rule reads today's truth, so the same sweep files new mail and
corrects old - an answered Wiedervorlage leaves the work folder by
itself. Unhandled inbox mail is never moved.



## OpenAPI

````yaml /setup/internal-openapi.json post /v1/process/erstkontakt/mailbox/sortieren
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) and the operator console
    endpoints. Requires the process API key; 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/process/erstkontakt/mailbox/sortieren:
    post:
      summary: Post Mailbox Sortieren
      description: |-
        File handled mail by what its case means today: a mail whose
        Wiedervorlage is still open goes to the Wiedervorlage folder, a mail
        from a partner whose PARTIN and Zuordnung are both acknowledged goes
        to the zugeordnet folder, everything else stays in the archive. The
        rule reads today's truth, so the same sweep files new mail and
        corrects old - an answered Wiedervorlage leaves the work folder by
        itself. Unhandled inbox mail is never moved.
      operationId: post_mailbox_sortieren_v1_process_erstkontakt_mailbox_sortieren_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MailboxSortierenRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailboxSortierenResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    MailboxSortierenRequest:
      properties:
        dry_run:
          type: boolean
          title: Dry Run
          default: false
        limit:
          type: integer
          maximum: 5000
          minimum: 0
          title: Limit
          description: 0 = uncapped
          default: 0
        lookback_days:
          type: integer
          maximum: 3650
          minimum: 0
          title: Lookback Days
          description: >-
            0 walks the whole mailbox (the one-off run over the backlog); a
            window keeps the routine sweep cheap
          default: 0
      type: object
      title: MailboxSortierenRequest
      description: |-
        File handled mail by what its case means today: open Wiedervorlage,
        fully zugeordnet, or neither.
    MailboxSortierenResponse:
      properties:
        dry_run:
          type: boolean
          title: Dry Run
        limit:
          type: integer
          title: Limit
        geprueft:
          type: integer
          title: Geprueft
        verschoben:
          items:
            $ref: '#/components/schemas/MailboxSortierenZiel'
          type: array
          title: Verschoben
        fehler:
          items:
            $ref: '#/components/schemas/MailboxSortierenZiel'
          type: array
          title: Fehler
      type: object
      required:
        - dry_run
        - limit
        - geprueft
        - verschoben
        - fehler
      title: MailboxSortierenResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MailboxSortierenZiel:
      properties:
        von:
          type: string
          title: Von
        nach:
          type: string
          title: Nach
        mp_id:
          type: string
          title: Mp Id
          default: ''
        sender:
          type: string
          title: Sender
          default: ''
        subject:
          type: string
          title: Subject
          default: ''
        fehler:
          type: string
          title: Fehler
          default: ''
      type: object
      required:
        - von
        - nach
      title: MailboxSortierenZiel
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      description: OIDC access token (Auth0 M2M)
      scheme: bearer

````