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

# Update a lead

> **Update mutable fields on a lead**

Only the fields you provide are updated. `custom_fields` uses **merge patch**
semantics: existing keys are preserved, the keys you send are added/updated,
and keys explicitly set to `null` are removed.

Updatable fields: `first_name`, `last_name`, `company`, `custom_fields`.

## Example

```python
import requests

campaign_id = "550e8400-e29b-41d4-a716-446655440000"
lead_id     = "650e8400-e29b-41d4-a716-446655440000"

response = requests.put(
    f"https://api.coldsend.io/api/public/v1/campaigns/{campaign_id}/leads/{lead_id}",
    headers={"X-API-Key": "your-api-key"},
    json={
        "first_name": "Jane",
        "custom_fields": {"industry": "SaaS", "old_field": None}  # removes old_field
    }
)
print(response.json())
```



## OpenAPI

````yaml /public_openapi.json put /api/public/v1/campaigns/{campaign_id}/leads/{lead_id}
openapi: 3.0.3
info:
  title: ColdSend Public API
  description: >-
    Programmatic access to ColdSend for managing cold email campaigns and sender
    accounts.
  version: 1.0.0
  contact:
    name: ColdSend Support
    email: support@coldsend.pro
    url: https://coldsend.pro
servers:
  - url: https://api.coldsend.pro
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/public/v1/campaigns/{campaign_id}/leads/{lead_id}:
    put:
      tags:
        - Leads
      summary: Update a lead
      description: >-
        **Update mutable fields on a lead**


        Only the fields you provide are updated. `custom_fields` uses **merge
        patch**

        semantics: existing keys are preserved, the keys you send are
        added/updated,

        and keys explicitly set to `null` are removed.


        Updatable fields: `first_name`, `last_name`, `company`, `custom_fields`.


        ## Example


        ```python

        import requests


        campaign_id = "550e8400-e29b-41d4-a716-446655440000"

        lead_id     = "650e8400-e29b-41d4-a716-446655440000"


        response = requests.put(
            f"https://api.coldsend.io/api/public/v1/campaigns/{campaign_id}/leads/{lead_id}",
            headers={"X-API-Key": "your-api-key"},
            json={
                "first_name": "Jane",
                "custom_fields": {"industry": "SaaS", "old_field": None}  # removes old_field
            }
        )

        print(response.json())

        ```
      operationId: update_lead_api_public_v1_campaigns__campaign_id__leads__lead_id__put
      parameters:
        - name: campaign_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Campaign Id
        - name: lead_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Lead Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadUpdateRequest'
      responses:
        '200':
          description: Lead updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadResponse'
        '401':
          description: Missing or invalid API key
        '403':
          description: Insufficient permissions - requires 'leads:update' scope
        '404':
          description: Lead or campaign not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    LeadUpdateRequest:
      properties:
        first_name:
          type: string
          nullable: true
          title: First Name
          description: First name
        last_name:
          type: string
          nullable: true
          title: Last Name
          description: Last name
        company:
          type: string
          nullable: true
          title: Company
          description: Company name
        custom_fields:
          additionalProperties: true
          type: object
          nullable: true
          title: Custom Fields
          description: >-
            Custom field updates. Keys set to null are removed; other keys are
            merged.
      type: object
      title: LeadUpdateRequest
      description: Request body for updating a lead's mutable fields.
    LeadResponse:
      properties:
        lead_id:
          type: string
          format: uuid
          title: Lead Id
          description: Lead ID
        batch_id:
          type: string
          format: uuid
          nullable: true
          title: Batch Id
          description: Batch ID this lead belongs to
        email:
          type: string
          title: Email
          description: Lead email address
        first_name:
          type: string
          nullable: true
          title: First Name
          description: First name
        last_name:
          type: string
          nullable: true
          title: Last Name
          description: Last name
        company:
          type: string
          nullable: true
          title: Company
          description: Company name
        custom_fields:
          additionalProperties: true
          type: object
          title: Custom Fields
          description: Custom lead fields
        status:
          type: string
          title: Status
          description: Lead status
        sequence_step:
          type: integer
          title: Sequence Step
          description: Current sequence step
          default: 0
        next_followup_scheduled_for:
          type: string
          format: date-time
          nullable: true
          title: Next Followup Scheduled For
          description: When the next pending follow-up is scheduled
        last_contacted_at:
          type: string
          format: date-time
          nullable: true
          title: Last Contacted At
          description: Last contact timestamp
        opened_at:
          type: string
          format: date-time
          nullable: true
          title: Opened At
          description: Email opened timestamp
        replied_at:
          type: string
          format: date-time
          nullable: true
          title: Replied At
          description: Reply timestamp
        email_opened:
          type: boolean
          title: Email Opened
          description: Whether email was opened
          default: false
        email_replied:
          type: boolean
          title: Email Replied
          description: Whether lead replied
          default: false
        unsubscribed:
          type: boolean
          title: Unsubscribed
          description: Whether lead unsubscribed
          default: false
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Lead creation timestamp
        delivery_status:
          type: string
          nullable: true
          title: Delivery Status
          description: Delivery status from Azure (latest email)
        current_intent_tag:
          $ref: '#/components/schemas/LeadIntentTagInfo'
          nullable: true
          description: Latest INTENT-group thread tag across the lead's threads (rollup)
      type: object
      required:
        - lead_id
        - batch_id
        - email
        - first_name
        - last_name
        - company
        - status
        - last_contacted_at
        - opened_at
        - replied_at
        - created_at
      title: LeadResponse
      description: Response schema for individual lead.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LeadIntentTagInfo:
      properties:
        tag_id:
          type: string
          format: uuid
          title: Tag Id
          description: Tag ID
        tag_name:
          type: string
          title: Tag Name
          description: Tag display name
        tag_color:
          type: string
          nullable: true
          title: Tag Color
          description: Tag hex color
        is_ai_applied:
          type: boolean
          title: Is Ai Applied
          description: Whether AI or manual
          default: true
        confidence:
          type: number
          nullable: true
          title: Confidence
          description: AI confidence 0-1
      type: object
      required:
        - tag_id
        - tag_name
      title: LeadIntentTagInfo
      description: Lightweight intent tag summary for lead list responses.
    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:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key with format cs_live_xxx

````