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

# Update Lead in Campaign

> Updates fields on an existing lead within the specified campaign.

## Authentication
All requests require an `Authorization` header using Bearer token authentication:
`Authorization: Bearer <api_key>`



## OpenAPI

````yaml PATCH /api/v2/voice-campaigns/{campaign_id}/lead/update
openapi: 3.1.0
info:
  title: VoiceAIWrapper API
  description: >-
    REST API for managing campaigns, leads, clients, web widgets, and voice
    providers on VoiceAIWrapper.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.voiceaiwrapper.app
security:
  - bearerAuth: []
paths:
  /api/v2/voice-campaigns/{campaign_id}/lead/update:
    patch:
      tags:
        - Leads (v2)
      summary: Update Lead in Campaign
      description: >-
        Updates fields on an existing lead within the specified campaign.


        ## Authentication

        All requests require an `Authorization` header using Bearer token
        authentication:

        `Authorization: Bearer <api_key>`
      operationId: updateLeadInCampaignV2
      parameters:
        - name: campaign_id
          in: path
          required: true
          description: Identifier of the campaign. Required.
          schema:
            type: string
            example: camp_abc123
      requestBody:
        required: true
        description: Lead fields to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadRequest'
      responses:
        '200':
          description: Lead updated successfully. Returns status and confirmation message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessMessage'
              example:
                status: success
                message: Lead updated successfully
        '400':
          description: >-
            Invalid request data. Ensure phone_number is included in the request
            body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWithArray'
              example:
                message: Invalid data
                error:
                  - 'Lead phone number is missing: phone_number'
        '401':
          description: Authentication failed. Ensure the Bearer token is present and valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: >-
            Resource not found. No lead matched the given phone_number in this
            campaign.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                message: Lead not found
        '500':
          description: Internal server error. Contact support if this persists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                message: Internal server error
components:
  schemas:
    UpdateLeadRequest:
      type: object
      required:
        - phone_number
      properties:
        phone_number:
          type: string
          description: Phone number of the lead to update (used as identifier). Required.
          example: '+14155552671'
        first_name:
          type: string
          description: Updated first name. Optional.
          example: Jane
        last_name:
          type: string
          description: Updated last name. Optional.
          example: Doe
        email:
          type: string
          format: email
          description: Updated email address. Optional.
          example: jane.doe@example.com
        do_not_call:
          type: boolean
          description: >-
            When true, marks the lead as opted out and prevents future calls.
            Optional.

             Allowed values: true, false.
          example: false
        custom_fields:
          type: object
          additionalProperties: true
          description: Updated custom key-value fields. Optional.
          example:
            plan: pro
        mark_as_unanswered:
          type: boolean
          description: >-
            When true, resets the lead's answered status and re-queues them for
            outbound calling. Only applies when the lead is currently marked as
            answered. Optional. 


            Allowed values: true, false.
          example: true
    SuccessMessage:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
    ErrorWithArray:
      type: object
      properties:
        message:
          type: string
        error:
          type: array
          items:
            type: string
    ErrorMessage:
      type: object
      properties:
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````