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

# Preview EcoMailbox row

> Return preview data for an owned EcoMailbox row. Normal EcoLetters include rendered HTML content with consumer template fields swapped. CFPB rows return rendered CFPB HTML in the same `preview.content` key so the frontend can preview without generating the PDF. Use the download endpoint only when the consumer requests the PDF file.



## OpenAPI

````yaml /api/consumer.openapi.yaml get /e-letters/{consumerELetter}
openapi: 3.1.0
info:
  title: YouNegotiate Consumer API
  version: '2.0'
  description: >-
    Stateless API endpoints for consumer portal authentication and account
    access.
servers:
  - url: https://api.consumer.younegotiate.com
    description: Production
security: []
tags:
  - name: System
    description: Public consumer domain system and health endpoints.
  - name: Authentication
    description: >-
      Consumer identity matching, contact capture, OTP verification, token
      creation, and logout endpoints.
  - name: Profile - My ecoAddress
    description: Consumer profile tab for signed-in identity / ecoAddress context.
  - name: Profile - Communication Controls
    description: >-
      Consumer profile tab for communication permissions, email/mobile changes,
      and email/mobile verification.
  - name: Profile - My Billing Details
    description: >-
      Consumer profile tab for billing name and billing address details used for
      payment verification.
  - name: Profile - Personalize My Portal
    description: Consumer profile tab for portal colors and profile image personalization.
  - name: Accounts
    description: Consumer-owned account list and account detail endpoints.
  - name: Bill Pay Wallet
    description: >-
      Consumer Bill Pay Wallet saved payment profiles and scheduled payment
      method update endpoints.
  - name: Upcoming Payments
    description: >-
      Consumer My Bill Pay Calendar upcoming-payment rows and calendar display
      data.
  - name: Calendar Sync
    description: >-
      Consumer Google and Microsoft calendar connection, OAuth callback, and
      live-update endpoints.
  - name: Gift Registry
    description: >-
      Consumer Bill Pay Gift Registry account list, shared registry, and Helping
      Hand link endpoints.
  - name: EcoMailbox
    description: Consumer MyEcoMailBox list endpoints and unread sidebar badge state.
  - name: Notice Responses
    description: >-
      Consumer My Account notice-response wizard endpoints for sender details
      and account details.
paths:
  /e-letters/{consumerELetter}:
    get:
      tags:
        - EcoMailbox
      summary: Preview EcoMailbox row
      description: >-
        Return preview data for an owned EcoMailbox row. Normal EcoLetters
        include rendered HTML content with consumer template fields swapped.
        CFPB rows return rendered CFPB HTML in the same `preview.content` key so
        the frontend can preview without generating the PDF. Use the download
        endpoint only when the consumer requests the PDF file.
      operationId: consumerPreviewELetter
      parameters:
        - $ref: '#/components/parameters/ConsumerELetterId'
      responses:
        '200':
          description: EcoMailbox preview returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsumerELetterPreviewResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/ProfileIncomplete'
      security:
        - bearerAuth: []
components:
  parameters:
    ConsumerELetterId:
      name: consumerELetter
      in: path
      required: true
      description: EcoMailbox pivot row ID returned by `GET /e-letters`.
      schema:
        type: integer
  schemas:
    ConsumerELetterPreviewResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: '#/components/schemas/ConsumerELetterPreview'
        meta:
          type: object
          required:
            - state
          properties:
            state:
              $ref: '#/components/schemas/ConsumerSidebarState'
    ConsumerELetterPreview:
      type: object
      required:
        - id
        - consumer_id
        - e_letter_id
        - read_by_consumer
        - preview
      properties:
        id:
          type: integer
        consumer_id:
          type: integer
        e_letter_id:
          type: integer
        read_by_consumer:
          type: boolean
          description: >-
            Preview does not mark the row read; call `PATCH
            /e-letters/{consumerELetter}/read` when the frontend opens the
            preview.
        preview:
          $ref: '#/components/schemas/ConsumerELetterPreviewPayload'
    ConsumerSidebarState:
      type: object
      required:
        - eco_mailbox
      properties:
        eco_mailbox:
          $ref: '#/components/schemas/ConsumerEcoMailboxState'
    MessageResponse:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ProfileIncompleteResponse:
      type: object
      required:
        - code
        - message
        - required_steps
      properties:
        code:
          type: string
          example: profile_incomplete
        message:
          type: string
          example: Please complete your communication profile before viewing accounts.
        required_steps:
          type: array
          items:
            type: string
          example:
            - profile_communication
    ConsumerELetterPreviewPayload:
      type: object
      required:
        - type
        - content
        - with_qr_code
      properties:
        type:
          type: string
          enum:
            - normal
            - cfpb
        content:
          type:
            - string
            - 'null'
          description: >-
            Rendered preview HTML. Normal rows return rendered e-letter HTML.
            CFPB rows return rendered CFPB letter HTML. Null is reserved for
            rows that cannot be rendered.
          example: <p>Hello Jane, review Preview Account.</p>
        with_qr_code:
          type: boolean
          description: True for CFPB-with-QR rows.
    ConsumerEcoMailboxState:
      type: object
      required:
        - unread_count
        - display_count
        - has_unread
      properties:
        unread_count:
          type: integer
          minimum: 0
          example: 12
        display_count:
          type: string
          description: Sidebar badge text. Values above 99 are returned as `99+`.
          example: '12'
        has_unread:
          type: boolean
          example: true
  responses:
    Unauthenticated:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    ProfileIncomplete:
      description: >-
        The authenticated consumer profile must complete communication setup
        before My Account can be shown.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProfileIncompleteResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Sanctum token

````