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

# Approve Lead Email

> Freeze a per-step approved email on this campaign_lead.

Writes into `campaign_leads.metadata.approved_emails[step_index]`. The
send-time short-circuit (PR A2) reads this exact blob and skips LangGraph.



## OpenAPI

````yaml https://api.bavlio.com/openapi.json post /api/v1/campaigns/{campaign_id}/leads/{campaign_lead_id}/approve
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
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: email-verification
    description: Validate email addresses and prune invalid entries from datasets.
  - 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: Google OAuth
    description: Google OAuth login flow and access tokens.
  - name: Google Sheets OAuth
    description: Google Sheets import and access management.
  - name: stripe
    description: Stripe checkout, billing portal, and subscription status. JWT only.
  - 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}/approve:
    post:
      tags:
        - playground
      summary: Approve Lead Email
      description: >-
        Freeze a per-step approved email on this campaign_lead.


        Writes into `campaign_leads.metadata.approved_emails[step_index]`. The

        send-time short-circuit (PR A2) reads this exact blob and skips
        LangGraph.
      operationId: >-
        approve_lead_email_api_v1_campaigns__campaign_id__leads__campaign_lead_id__approve_post
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApproveLeadRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApproveLeadResponse'
        '401':
          description: Unauthorized
        '404':
          description: Campaign or lead not found
        '409':
          description: Concurrent edit conflict
        '422':
          description: Validation failure
      security:
        - HTTPBearer: []
components:
  schemas:
    ApproveLeadRequest:
      properties:
        step_index:
          type: integer
          maximum: 32
          minimum: 1
          title: Step Index
          description: Step number being approved (1-indexed, matches steps_config).
        variant_label:
          type: string
          maxLength: 10
          minLength: 1
          title: Variant Label
          description: >-
            Variant label being approved; must match the lead's assigned variant
            for this step.
        subject:
          type: string
          maxLength: 998
          minLength: 1
          title: Subject
          description: Approved subject line (frozen).
        body:
          type: string
          maxLength: 50000
          minLength: 1
          title: Body
          description: Approved body (frozen).
        custom_prompt:
          anyOf:
            - type: string
              maxLength: 32000
            - type: 'null'
          title: Custom Prompt
          description: >-
            If provided, overrides the resolved prompt hierarchy for this
            approval.
        prompt_snapshot:
          anyOf:
            - type: string
              maxLength: 32000
            - type: 'null'
          title: Prompt Snapshot
          description: >-
            Exact prompt text used to generate the draft. If omitted, server
            resolves it.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: LLM model identifier used for the draft (e.g., 'gemini-2.0-flash').
        generation_latency_ms:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Generation Latency Ms
          description: 'Optional: generation latency for observability.'
        research_sources:
          title: Research Sources
          description: >-
            Optional: research-cache source contents used to produce the draft.
            Hashed into research_cache_fingerprint.
        expected_step_config_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Step Config Fingerprint
          description: >-
            Optional: fingerprint the client computed at draft time. If it
            differs from the server-computed fingerprint, approval fails with
            422 — the step variant/sender/template was swapped after drafting.
      type: object
      required:
        - step_index
        - variant_label
        - subject
        - body
      title: ApproveLeadRequest
      description: POST /campaigns/{id}/leads/{lead_id}/approve body.
    ApproveLeadResponse:
      properties:
        campaign_id:
          type: string
          format: uuid
          title: Campaign Id
        campaign_lead_id:
          type: string
          format: uuid
          title: Campaign Lead Id
        step_index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Index
        approved_steps:
          items:
            type: integer
          type: array
          title: Approved Steps
          description: >-
            All step indices currently approved for this lead after the
            operation.
        approved_entry:
          anyOf:
            - $ref: '#/components/schemas/ApprovedEmailEntry'
            - type: 'null'
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - campaign_id
        - campaign_lead_id
        - updated_at
      title: ApproveLeadResponse
      description: POST approve/unapprove/reset response.
    ApprovedEmailEntry:
      properties:
        subject:
          type: string
          title: Subject
        body:
          type: string
          title: Body
        prompt_snapshot:
          type: string
          title: Prompt Snapshot
        prompt_version_hash:
          type: string
          title: Prompt Version Hash
        research_cache_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Research Cache Fingerprint
        lead_identity_fingerprint:
          type: string
          title: Lead Identity Fingerprint
        step_index:
          type: integer
          title: Step Index
        variant_label:
          type: string
          title: Variant Label
        sender_profile_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sender Profile Id
        template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Id
        step_config_fingerprint:
          type: string
          title: Step Config Fingerprint
        approved_at:
          type: string
          format: date-time
          title: Approved At
        approved_by:
          type: string
          title: Approved By
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        generation_latency_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Generation Latency Ms
      type: object
      required:
        - subject
        - body
        - prompt_snapshot
        - prompt_version_hash
        - lead_identity_fingerprint
        - step_index
        - variant_label
        - step_config_fingerprint
        - approved_at
        - approved_by
      title: ApprovedEmailEntry
      description: One entry in campaign_leads.metadata.approved_emails.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````