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

# Create lead

> Create a new lead.
   
You can assigned the lead with an existing partner using the `partnerId` property. You will be the source of the lead and the partner will have to
accept or refuse the lead.
  
You can set the source of the lead using the `sourcePartnerId` property. By doing that, you create the lead on behalf of the partner.
He won't have to accept or refuse the lead, the lead will be automatically accepted.
 
Use the `note` property to add a new note on create lead.
  
If the lead comes from your website via a referral link shared by a partner and you want to associate it with the correct partner, use the HTTP header:  
`Kiflo-Tracking-Code: AABBCCDDEEFF+=`  
 
The** tracking code** can be retrieved in javascript from your website using the JS SDK.Please referer to the[JS SDK documentation](https://docs.kiflo.com/category/26-js-sdk).
 
The `status` property is optional and can be used only in conjunction with the header parameter `Kiflo-Tracking-Code`.
It can be one of the following value:
- **Pending**: the lead is assigned to the source partner and must be validated by you
- **Accepted**: the lead is assigned to the source partner and is automatically accepted
- **Unassigned**: the lead is not assigned to any partner, but the source partner is set correctly. it can be shared to another partner manually



## OpenAPI

````yaml /openapi.json post /v3/leads
openapi: 3.0.1
info:
  title: Kiflo Public API v3
  description: "The Kiflo API allows you to have control over your integration and create the best experiences.\r\n\r\n***\r\n\r\n## Format\r\n\r\nThe API follows the REST standard using JSON to format requests and responses.  \r\nDecimals are formatted using invariant culture, ie: using \".\" (dot) as a decimal sperator and no thousands separator.  \r\nDates are formatted using ISO standards, in UTC format, including the timezone. Ex:  2015-03-25T12:00:00Z\r\n\r\n***\r\n\r\n## Security\r\n\r\nThe API is secured using an API token.\r\n\r\n**How to generate an API Access Token**  \r\n 1. Open your [account settings page](https://app.kiflo.com/account/integration)\r\n 2. Go to the \"API Access Token\" section\r\n 3. Click \"Add\" button\r\n 4. Choose a name that will be used to identify the token and click \"Add\"\r\n 4. Copy the generate token\r\n   \r\n> **Note:** For security reason, the generated API Access Token won't be visible after you close the settings page. Be sure to copy the generated token otherwise you won't be able to get it later.\r\n  \r\n**How to authenticate on the API**  \r\n  \r\nTo authenticate on the API, send the generated token in the Authorization header using the Bearer scheme:  \r\n`Authorization: Bearer #YOUR_GENERATED_TOKEN_HERE#`\r\n"
  version: v3
servers: []
security: []
paths:
  /v3/leads:
    post:
      tags:
        - Leads
      summary: Create lead
      description: "Create a new lead.\r\n   \r\nYou can assigned the lead with an existing partner using the `partnerId` property. You will be the source of the lead and the partner will have to\r\naccept or refuse the lead.\r\n  \r\nYou can set the source of the lead using the `sourcePartnerId` property. By doing that, you create the lead on behalf of the partner.\r\nHe won't have to accept or refuse the lead, the lead will be automatically accepted.\r\n \r\nUse the `note` property to add a new note on create lead.\r\n  \r\nIf the lead comes from your website via a referral link shared by a partner and you want to associate it with the correct partner, use the HTTP header:  \r\n`Kiflo-Tracking-Code: AABBCCDDEEFF+=`  \r\n \r\nThe** tracking code** can be retrieved in javascript from your website using the JS SDK.Please referer to the[JS SDK documentation](https://docs.kiflo.com/category/26-js-sdk).\r\n \r\nThe `status` property is optional and can be used only in conjunction with the header parameter `Kiflo-Tracking-Code`.\r\nIt can be one of the following value:\r\n- **Pending**: the lead is assigned to the source partner and must be validated by you\r\n- **Accepted**: the lead is assigned to the source partner and is automatically accepted\r\n- **Unassigned**: the lead is not assigned to any partner, but the source partner is set correctly. it can be shared to another partner manually"
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/LeadCreateRequestDto'
            example:
              properties:
                firstName: John
                lastName: Doe
                email: john@doe.com
                project_amount: 20000
              currency: USD
              ownerUserId: null
              partnerId: 42
              sourcePartnerId: 42
              userPartnerOwnerId: null
              assignedContactEmail: null
              deadLine: '2020-07-14T00:00:00'
              note: Very hot lead!
              status: null
              assignToPartnerOwner: null
          application/json:
            schema:
              $ref: '#/components/schemas/LeadCreateRequestDto'
            example:
              properties:
                firstName: John
                lastName: Doe
                email: john@doe.com
                project_amount: 20000
              currency: USD
              ownerUserId: null
              partnerId: 42
              sourcePartnerId: 42
              userPartnerOwnerId: null
              assignedContactEmail: null
              deadLine: '2020-07-14T00:00:00'
              note: Very hot lead!
              status: null
              assignToPartnerOwner: null
          text/json:
            schema:
              $ref: '#/components/schemas/LeadCreateRequestDto'
            example:
              properties:
                firstName: John
                lastName: Doe
                email: john@doe.com
                project_amount: 20000
              currency: USD
              ownerUserId: null
              partnerId: 42
              sourcePartnerId: 42
              userPartnerOwnerId: null
              assignedContactEmail: null
              deadLine: '2020-07-14T00:00:00'
              note: Very hot lead!
              status: null
              assignToPartnerOwner: null
          application/*+json:
            schema:
              $ref: '#/components/schemas/LeadCreateRequestDto'
            example:
              properties:
                firstName: John
                lastName: Doe
                email: john@doe.com
                project_amount: 20000
              currency: USD
              ownerUserId: null
              partnerId: 42
              sourcePartnerId: 42
              userPartnerOwnerId: null
              assignedContactEmail: null
              deadLine: '2020-07-14T00:00:00'
              note: Very hot lead!
              status: null
              assignToPartnerOwner: null
      responses:
        '200':
          description: Lead created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadDto'
        '400':
          description: Invalid request
      security:
        - oauth2:
            - Lead.Create
            - Api
components:
  schemas:
    LeadCreateRequestDto:
      type: object
      properties:
        properties:
          type: object
          additionalProperties:
            nullable: true
          nullable: true
        currency:
          type: string
          nullable: true
        ownerUserId:
          type: integer
          format: int32
          nullable: true
        partnerId:
          type: integer
          description: The partner to whom the lead is assigned.
          format: int32
          nullable: true
        sourcePartnerId:
          type: integer
          description: The partner to who declared the lead.
          format: int32
          nullable: true
        userPartnerOwnerId:
          type: integer
          description: The user partner assigned to the lead.
          format: int32
          nullable: true
        assignedContactEmail:
          type: string
          description: >-
            The email of the user partner assigned to the lead. PartnerId must
            be specified.
          nullable: true
        deadLine:
          type: string
          format: date-time
          nullable: true
        note:
          type: string
          description: Optional note to add to the lead after its creation.
          nullable: true
        status:
          $ref: '#/components/schemas/LeadStatus'
        assignToPartnerOwner:
          type: boolean
          description: >-
            If true, the Lead OwnerUserId will be the same as the Partner
            OwnerUserId
          nullable: true
      additionalProperties: false
    LeadDto:
      type: object
      properties:
        id:
          type: integer
          format: int32
        creationDate:
          type: string
          format: date-time
        properties:
          type: object
          additionalProperties:
            nullable: true
          nullable: true
        partnerId:
          type: integer
          format: int32
          nullable: true
        sourcePartnerId:
          type: integer
          format: int32
          nullable: true
        userPartnerOwnerId:
          type: integer
          format: int32
          nullable: true
        dealId:
          type: integer
          format: int32
          nullable: true
        customerId:
          type: integer
          format: int32
          nullable: true
        deadLine:
          type: string
          format: date-time
          nullable: true
        assignedDate:
          type: string
          format: date-time
          nullable: true
        acceptedDate:
          type: string
          format: date-time
          nullable: true
        refusedDate:
          type: string
          format: date-time
          nullable: true
        convertedDate:
          type: string
          format: date-time
          nullable: true
        abandonedDate:
          type: string
          format: date-time
          nullable: true
        status:
          $ref: '#/components/schemas/LeadStatus'
        partnerName:
          type: string
          nullable: true
        dealName:
          type: string
          nullable: true
        customerName:
          type: string
          nullable: true
        source:
          $ref: '#/components/schemas/DataSource'
        transferredLeadId:
          type: integer
          format: int32
          nullable: true
        currency:
          type: string
          nullable: true
        ownerUserId:
          type: integer
          format: int32
          nullable: true
        owner:
          $ref: '#/components/schemas/UserDto'
      additionalProperties: false
    LeadStatus:
      enum:
        - Unknown
        - Unassigned
        - Pending
        - Accepted
        - Refused
        - Reassigned
        - Converted
        - Abandoned
      type: string
    DataSource:
      enum:
        - Unknown
        - Website
        - Partner
        - Api
        - Zapier
        - Tenant
        - System
        - HubSpot
        - Stripe
        - PartnerDirectory
      type: string
    UserDto:
      type: object
      properties:
        id:
          type: integer
          format: int32
        email:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
      additionalProperties: false

````