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

# Convert a lead into a customer



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json post /v1/leads/{id}/convert
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}/convert:
    post:
      tags:
        - Lead
      summary: Convert a lead into a customer
      operationId: lead.convert
      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/LeadConvertRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      result:
                        type: string
                      customer:
                        $ref: '#/components/schemas/CustomerResource'
                      lead:
                        $ref: '#/components/schemas/LeadResource'
                    required:
                      - result
                      - customer
                      - lead
                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:
    LeadConvertRequest:
      type: object
      properties:
        existing_customer_id:
          type:
            - integer
            - 'null'
          description: The existing customer ID to merge into.
      title: LeadConvertRequest
    CustomerResource:
      type: object
      properties:
        id:
          type: integer
        first_name:
          type:
            - string
            - 'null'
        last_name:
          type:
            - string
            - 'null'
        phone_number:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        date_of_birth:
          type:
            - string
            - 'null'
          format: date-time
        gender:
          anyOf:
            - $ref: '#/components/schemas/Gender'
            - type: 'null'
        country_name:
          type: string
        identity_number:
          type:
            - string
            - 'null'
        job:
          type:
            - string
            - 'null'
        address:
          type:
            - string
            - 'null'
        default_channel_id:
          type:
            - integer
            - 'null'
        avatar_url:
          type:
            - string
            - 'null'
        related_user:
          $ref: '#/components/schemas/RelatedUserResource'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagResource'
        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
        - phone_number
        - email
        - date_of_birth
        - gender
        - country_name
        - identity_number
        - job
        - address
        - default_channel_id
        - avatar_url
        - related_user
        - created_at
        - updated_at
        - deleted_at
      title: CustomerResource
    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
    Gender:
      type: string
      enum:
        - male
        - female
        - other
      title: Gender
    RelatedUserResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
        - id
        - name
      title: RelatedUserResource
    TagResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        name:
          type: string
        color:
          type: string
        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
        - tenant_id
        - name
        - color
        - created_at
        - updated_at
        - deleted_at
      title: TagResource
    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
  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

````