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

# Partial update lead

> Base model view set providing standardized CRUD operations and error handling.

This view set enforces consistent response formats, error handling patterns,
and logging across all API endpoints. Subclasses must override the class
variables below.



## OpenAPI

````yaml /openapi/commercial.yaml patch /api/v1/leads/{id}
openapi: 3.0.3
info:
  title: Commercial Service API
  version: 1.0.0
  description: |2-

        **Commercial Service API** - Lead management and campaign workflow system.

        ## Versioning
        The API uses URL path versioning (e.g., `/api/v1/`, `/api/v2/`).
        Current version: **v1**
        
servers:
  - url: https://api.capedigital.co.ke/commercial
    description: Production
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /api/v1/leads/{id}:
    patch:
      tags:
        - Leads
      summary: Partial update lead
      description: >-
        Base model view set providing standardized CRUD operations and error
        handling.


        This view set enforces consistent response formats, error handling
        patterns,

        and logging across all API endpoints. Subclasses must override the class

        variables below.
      operationId: leads_partial_update
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
          description: A UUID string identifying this Lead.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedLeadRequest'
            examples:
              CreateLead:
                value:
                  name: ABC Corporation
                  contact_person: Jane Smith
                  contact_phone: '+254700000000'
                  contact_email: jane@abc.co.ke
                  lead_type: corporate
                  gender: F
                  lead_category: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                  source: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                  partner: null
                  products:
                    - 3fa85f64-5717-4562-b3fc-2c963f66afa6
                summary: Create lead
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedLeadRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedLeadRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Lead'
              examples:
                LeadResponse:
                  value:
                    id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                    reference: LD-2024-001
                    name: ABC Corporation
                    contact_person: Jane Smith
                    contact_phone: '+254700000000'
                    contact_email: jane@abc.co.ke
                    lead_type: corporate
                    gender: F
                    lead_category:
                      id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                      name: New Business
                    source:
                      id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                      name: Cold Call
                    partner: null
                    products:
                      - id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                        name: TV Spot 30s
                    status: New Lead
                    node: capture
                    created_at: '2024-01-15T08:00:00Z'
                    updated_at: '2024-01-15T08:00:00Z'
                  summary: Lead response
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    PatchedLeadRequest:
      type: object
      description: Lead Serializer
      properties:
        reference:
          type: string
          nullable: true
          description: Generated reference string
          maxLength: 30
        name:
          type: string
          minLength: 1
          description: Lead company name
          maxLength: 100
        contact_person:
          type: string
          minLength: 1
          description: Contact person name
          maxLength: 100
        contact_phone:
          type: string
          minLength: 1
          description: Contact phone number
          maxLength: 30
        contact_email:
          type: string
          format: email
          minLength: 1
          description: Contact email address
          maxLength: 50
        lead_type:
          enum:
            - individual
            - company
          type: string
          x-spec-enum-id: e09fc541d8e40a52
          description: |-
            Lead classification: individual or company

            * `individual` - Individual
            * `company` - Company
        gender:
          enum:
            - male
            - female
            - ''
            - null
          type: string
          x-spec-enum-id: d6713b157e7b4bdf
          nullable: true
          description: >-
            Gender of individual lead (only applicable when lead_type is
            individual)


            * `male` - Male

            * `female` - Female
        lead_category:
          type: string
          format: uuid
        source:
          type: string
          format: uuid
        partner:
          type: string
          format: uuid
        products:
          type: array
          items:
            type: string
            format: uuid
    Lead:
      type: object
      description: Lead Serializer
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        reference:
          type: string
          nullable: true
          description: Generated reference string
          maxLength: 30
        name:
          type: string
          description: Lead company name
          maxLength: 100
        contact_person:
          type: string
          description: Contact person name
          maxLength: 100
        contact_phone:
          type: string
          description: Contact phone number
          maxLength: 30
        contact_email:
          type: string
          format: email
          description: Contact email address
          maxLength: 50
        lead_type:
          enum:
            - individual
            - company
          type: string
          x-spec-enum-id: e09fc541d8e40a52
          description: |-
            Lead classification: individual or company

            * `individual` - Individual
            * `company` - Company
        gender:
          enum:
            - male
            - female
            - ''
            - null
          type: string
          x-spec-enum-id: d6713b157e7b4bdf
          nullable: true
          description: >-
            Gender of individual lead (only applicable when lead_type is
            individual)


            * `male` - Male

            * `female` - Female
        lead_category:
          type: string
          format: uuid
        source:
          type: string
          format: uuid
        partner:
          type: string
          format: uuid
        products:
          type: array
          items:
            type: string
            format: uuid
        status:
          type: string
          readOnly: true
          description: Lead status
        node:
          type: string
          readOnly: true
          description: Workflow Node
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - contact_email
        - contact_person
        - contact_phone
        - created_at
        - id
        - lead_category
        - name
        - node
        - products
        - source
        - status
        - updated_at
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````