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

# Update a lead



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json put /v1/leads/{id}
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: '## Flextell API'
servers:
  - url: https://dev.flextell.ai/api
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/leads/{id}:
    put:
      tags:
        - Lead
      summary: Update a lead
      operationId: lead.update
      parameters:
        - name: id
          in: path
          required: true
          description: The lead identifier
          schema:
            type: integer
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/LeadResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                    const: Lead not found
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        const: Lead not found
                    required:
                      - message
                  errors:
                    type: 'null'
                required:
                  - success
                  - error
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    LeadUpdateRequest:
      type: object
      properties:
        first_name:
          type:
            - string
            - 'null'
          description: The first name.
          maxLength: 255
        last_name:
          type: string
          description: The last name.
          maxLength: 255
        phone_number:
          type:
            - string
            - 'null'
          description: The phone number in E.164 format.
          maxLength: 50
        email:
          type:
            - string
            - 'null'
          format: email
          description: The email address.
          maxLength: 255
        description:
          type:
            - string
            - 'null'
          description: The description.
        message:
          type:
            - string
            - 'null'
          description: The message body.
        preferred_contact:
          type:
            - string
            - 'null'
          description: Preferred contact channel.
          maxLength: 50
        source_page_url:
          type:
            - string
            - 'null'
          format: uri
          description: URL of the page that produced the lead.
          maxLength: 2048
        lead_status_id:
          type:
            - integer
            - 'null'
          description: The lead status ID.
        lead_reference_source_id:
          type:
            - integer
            - 'null'
          description: The lead reference source ID.
        assigned_user_id:
          type:
            - integer
            - 'null'
          description: The assigned user ID.
        country_id:
          type:
            - integer
            - 'null'
          description: The country ID.
        marketing_attribution:
          type:
            - array
            - 'null'
          description: The marketing attribution.
          items:
            type: string
      title: LeadUpdateRequest
    LeadResource:
      type: object
      properties:
        id:
          type: integer
        first_name:
          type:
            - string
            - 'null'
        last_name:
          type: string
        full_name:
          type: string
        phone_number:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        message:
          type:
            - string
            - 'null'
        preferred_contact:
          type:
            - string
            - 'null'
        source_page_url:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/RelatedLeadStatusResource'
        reference_source:
          $ref: '#/components/schemas/RelatedLeadReferenceSourceResource'
        assigned_user:
          $ref: '#/components/schemas/RelatedUserResource'
        country_id:
          type:
            - integer
            - 'null'
        country_name:
          type: string
        is_converted:
          type: string
        converted_at:
          type:
            - string
            - 'null'
          format: date-time
        customer_id:
          type:
            - integer
            - 'null'
        marketing_attribution:
          type:
            - array
            - 'null'
          items: {}
        external_id:
          type:
            - string
            - 'null'
        external_branch_id:
          type:
            - string
            - 'null'
        external_created_at:
          type:
            - string
            - 'null'
          format: date-time
        last_synced_at:
          type:
            - string
            - 'null'
          format: date-time
        import_source_id:
          type:
            - integer
            - 'null'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - first_name
        - last_name
        - full_name
        - phone_number
        - email
        - description
        - message
        - preferred_contact
        - source_page_url
        - country_id
        - is_converted
        - converted_at
        - customer_id
        - marketing_attribution
        - external_id
        - external_branch_id
        - external_created_at
        - last_synced_at
        - import_source_id
        - created_at
        - updated_at
        - deleted_at
      title: LeadResource
    RelatedLeadStatusResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        slug:
          type: string
        color:
          type: string
        is_terminal:
          type: boolean
      required:
        - id
        - name
        - slug
        - color
        - is_terminal
      title: RelatedLeadStatusResource
    RelatedLeadReferenceSourceResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        external_id:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - external_id
      title: RelatedLeadReferenceSourceResource
    RelatedUserResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
        - id
        - name
      title: RelatedUserResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````