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

# Get Edifact Suche

> Find messages by reference, or list the whole exchange with one
partner. `referenz` matches the Datenaustauschreferenz (UNB 0020), the
message reference (UNH 0062) and, for CONTRL/APERAK, the interchange
they answer (UCI / RFF+ACE); `partner` narrows to one MP-ID and, alone,
lists everything exchanged with it - each acknowledgment with the
message it answers and its verdict. Searches the inbox of our market
parties, our own sent files and PARTINs that arrived as mail
attachments; PARTIN hits also surface the EDIFACT contact address.



## OpenAPI

````yaml /setup/internal-openapi.json get /v1/process/edifact/suche
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/edifact/suche:
    get:
      summary: Get Edifact Suche
      description: |-
        Find messages by reference, or list the whole exchange with one
        partner. `referenz` matches the Datenaustauschreferenz (UNB 0020), the
        message reference (UNH 0062) and, for CONTRL/APERAK, the interchange
        they answer (UCI / RFF+ACE); `partner` narrows to one MP-ID and, alone,
        lists everything exchanged with it - each acknowledgment with the
        message it answers and its verdict. Searches the inbox of our market
        parties, our own sent files and PARTINs that arrived as mail
        attachments; PARTIN hits also surface the EDIFACT contact address.
      operationId: get_edifact_suche_v1_process_edifact_suche_get
      parameters:
        - name: referenz
          in: query
          required: false
          schema:
            type: string
            maxLength: 35
            default: ''
            title: Referenz
        - name: partner
          in: query
          required: false
          schema:
            type: string
            pattern: ^(\d{13})?$
            default: ''
            title: Partner
        - name: lookback_days
          in: query
          required: false
          schema:
            type: integer
            maximum: 730
            minimum: 1
            default: 180
            title: Lookback Days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdifactSucheResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    EdifactSucheResponse:
      properties:
        referenz:
          type: string
          title: Referenz
          default: ''
        partner:
          type: string
          title: Partner
          default: ''
        lookback_days:
          type: integer
          title: Lookback Days
        durchsucht:
          additionalProperties:
            type: integer
          type: object
          title: Durchsucht
          description: 'Files scanned: `empfangen`, `gesendet`, `email_anhang`'
        treffer:
          items:
            $ref: '#/components/schemas/EdifactSucheTreffer'
          type: array
          title: Treffer
      type: object
      required:
        - lookback_days
        - treffer
      title: EdifactSucheResponse
      description: Messages found for a reference and/or a partner, both directions.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EdifactSucheTreffer:
      properties:
        richtung:
          type: string
          title: Richtung
          description: '''empfangen'', ''gesendet'' or ''empfangen (E-Mail-Anhang)'''
        edi_type:
          type: string
          title: Edi Type
        sender:
          type: string
          title: Sender
        recipient:
          type: string
          title: Recipient
        date:
          type: string
          title: Date
        referenz:
          type: string
          title: Referenz
          description: Datenaustauschreferenz (UNB 0020)
        nachricht:
          type: string
          title: Nachricht
          description: Message reference (UNH 0062)
          default: ''
        bezug:
          type: string
          title: Bezug
          description: 'For a CONTRL/APERAK: the interchange it answers (UCI / RFF+ACE)'
          default: ''
        verdict:
          type: string
          title: Verdict
          description: 'For a CONTRL/APERAK: `positiv` or `negativ`'
          default: ''
        edifact:
          type: string
          title: Edifact
          description: The complete interchange as MakoFlow or the ledger holds it
          default: ''
        grund:
          type: string
          title: Grund
          description: The rejection reason, if negative
          default: ''
        partner_name:
          type: string
          title: Partner Name
          default: ''
        kontakt_email:
          type: string
          title: Kontakt Email
          description: EDIFACT contact from a PARTIN hit (COM+..:EM)
          default: ''
      type: object
      required:
        - richtung
        - edi_type
        - sender
        - recipient
        - date
        - referenz
      title: EdifactSucheTreffer
    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

````