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

# Get Lead Messages

> Return per-step sent (or pending) email content for a campaign lead (org-scoped).

Sourced from `outbound_jobs.content` (capped at 200 rows/lead). Rows not yet
sent (queued/scheduled/claimed/generating) are included with null
subject/body so the same UI drawer can preview upcoming steps. Ordered by
step asc.



## OpenAPI

````yaml https://api.bavlio.com/openapi.json get /api/v1/campaigns/{campaign_id}/leads/{campaign_lead_id}/messages
openapi: 3.1.0
info:
  title: Bavlio API
  description: >-
    Outreach automation API — lead enrichment, email campaigns, LinkedIn
    automation, and AI agent. Full docs at https://docs.bavlio.com.
  version: 1.0.0
  x-guidance:
    product: Bavlio Data API
    protocols:
      - x402
    description: >-
      Pay-per-call B2B data endpoints for AI agents. USDC on Base mainnet via
      x402 v2. See /openapi.json for pricing. Landing page + marketing details:
      https://bavlio.com/developers
    network: eip155:8453
    docs_url: https://docs.bavlio.com
  x-payment-merchant-address: '0xcca4725e0e931982830bff523b141e1a7a58d3e7'
servers: []
security: []
tags:
  - name: API Keys
    description: >-
      Create, list, and revoke API keys for programmatic access. JWT
      authentication required.
  - name: credits
    description: Credit balance, cost estimates, and transaction history.
  - name: campaigns
    description: Create, manage, launch, and monitor email campaigns.
  - name: campaign-personalization
    description: AI-powered email subject and body personalization for campaigns.
  - name: email-finder
    description: Find and verify email addresses for prospects.
  - name: sender-profiles
    description: Manage sender identity profiles for outreach.
  - name: sender-profile-chat
    description: Interactive chat for building sender profiles.
  - name: templates
    description: Email template CRUD.
  - name: suppression
    description: Do-not-contact suppression list management.
  - name: datasets
    description: Lead dataset listing, download, and updates.
  - name: user-extractions
    description: Uploaded lead file management and processing.
  - name: enrichment-chat
    description: Interactive chat for data enrichment sessions.
  - name: enrichment-processing
    description: Batch lead enrichment processing.
  - name: File Upload (CSV/Excel)
    description: Upload and preview CSV/Excel lead files.
  - name: connected-accounts
    description: LinkedIn account connections via Unipile.
  - name: linkedin-content
    description: LinkedIn post creation, scheduling, and management.
  - name: linkedin-playground
    description: Direct LinkedIn actions (profile lookup, messaging, engagement).
  - name: bavimail-proxy
    description: BaviMail domain, alias, and email management.
  - name: agent
    description: Bavi AI agent chat with SSE streaming.
  - name: notifications
    description: Notification preferences and delivery.
  - name: referral
    description: Referral code management and stats.
  - name: feedback
    description: User feedback submission.
  - name: authentication
    description: JWT token verification and user info.
  - name: users
    description: User quota and usage information.
  - name: Health
    description: Health checks and system status.
  - name: Personalization
    description: Core lead personalization engine.
  - name: Session Management
    description: Enrichment session lifecycle.
  - name: Session Processing
    description: Session data processing.
  - name: webhooks
    description: Inbound webhook handlers (Stripe, BaviMail, Unipile).
paths:
  /api/v1/campaigns/{campaign_id}/leads/{campaign_lead_id}/messages:
    get:
      tags:
        - campaigns
      summary: Get Lead Messages
      description: >-
        Return per-step sent (or pending) email content for a campaign lead
        (org-scoped).


        Sourced from `outbound_jobs.content` (capped at 200 rows/lead). Rows not
        yet

        sent (queued/scheduled/claimed/generating) are included with null

        subject/body so the same UI drawer can preview upcoming steps. Ordered
        by

        step asc.
      operationId: >-
        get_lead_messages_api_v1_campaigns__campaign_id__leads__campaign_lead_id__messages_get
      parameters:
        - name: campaign_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Campaign Id
        - name: campaign_lead_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Campaign Lead Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadMessagesResponse'
        '401':
          description: Unauthorized - Invalid or missing JWT token
        '404':
          description: Campaign or lead not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    LeadMessagesResponse:
      properties:
        messages:
          items:
            $ref: '#/components/schemas/LeadMessage'
          type: array
          title: Messages
          description: Messages ordered by step
        total:
          type: integer
          title: Total
          description: Number of messages returned
      type: object
      required:
        - messages
        - total
      title: LeadMessagesResponse
      description: Per-step sent/pending email content for one campaign lead, step asc.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LeadMessage:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
          description: Outbound job ID (stable, deep-linkable)
        step:
          type: integer
          title: Step
          description: 1-indexed sequence step
        variant_label:
          anyOf:
            - type: string
            - type: 'null'
          title: Variant Label
          description: A/B variant label
        alias_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Alias Id
          description: Sending alias ID
        subject:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject
          description: Rendered subject (null if not yet generated)
        body_html:
          anyOf:
            - type: string
            - type: 'null'
          title: Body Html
          description: >-
            Rendered HTML body when the stored body is HTML. UNSANITIZED stored
            email HTML interpolating lead/LLM-generated data — clients MUST
            sanitize (e.g. DOMPurify) before rendering. Never inject as raw
            HTML.
        body_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Body Text
          description: Plain-text body, when the stored body is plain
        sent_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Sent At
          description: >-
            Claim time (immediately before send, ±worker latency); populated
            only for terminal-sent statuses, null otherwise (incl. legacy sent
            rows with no claim timestamp). NOT enrolment time.
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
          description: BaviMail email ID (provider message id)
        status:
          type: string
          title: Status
          description: >-
            Raw outbound_jobs.status (13 possible: queued, claimed,
            claimed_stranded, generating, sending, sent, scheduled, cancelled,
            failed, bounced, complained, delivered, skipped). Clients MUST
            render unknown values safely — the set may grow.
      type: object
      required:
        - job_id
        - step
        - status
      title: LeadMessage
      description: >-
        A single sent (or pending) email for a campaign lead.


        Sourced from `outbound_jobs.content` (JSONB written by the send worker).

        Rows that have not reached send (queued/scheduled/claimed/generating)
        are

        included with `subject`/`body_*` null so the same UI drawer can preview

        upcoming steps. `status` is the raw `outbound_jobs.status` value (a
        wider

        set than `OutboundJobStatus`, e.g. `claimed`/`skipped`), passed through

        verbatim rather than coerced so the contract never crashes on a new
        state.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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