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

# Create Lead

> Creates a new lead for the account. Phone number must be unique
within the account.
Requires `leads:import` permission.




## OpenAPI

````yaml POST /api/leads
openapi: 3.1.0
info:
  title: Naturalead Leads API
  version: 1.0.0
  description: |
    API for managing leads in the Naturalead platform. All endpoints require
    API key authentication and are scoped to the caller's account.
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Leads
    description: Lead CRUD, search, filtering, and bulk operations
paths:
  /api/leads:
    post:
      tags:
        - Leads
      summary: Create a lead
      description: |
        Creates a new lead for the account. Phone number must be unique
        within the account.
        Requires `leads:import` permission.
      operationId: createLead
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                phone:
                  type: string
                email:
                  type: string
                tags:
                  type: array
                  items:
                    type: string
              required:
                - phone
      responses:
        '201':
          description: Lead created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Lead'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: phone is required
        '409':
          description: Duplicate phone number
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: A lead with this phone number already exists
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    Lead:
      type: object
      properties:
        id:
          type: integer
          description: Sequential, account-scoped identifier
        name:
          type: string
        phone:
          type: string
          description: Unique per account
        email:
          type: string
          default: ''
        status:
          $ref: '#/components/schemas/LeadStatus'
        accountId:
          type: string
        source:
          type: string
          default: api
        tags:
          type: array
          items:
            type: string
        assignedAgentId:
          type: string
          description: ObjectId reference to AgentConfig
        abTestId:
          type: string
          description: ObjectId reference to AbTest
        agentAssignedBy:
          type: string
          enum:
            - manual
            - ab_test
            - auto
          default: auto
        customFields:
          type: object
          additionalProperties:
            type: string
          description: Key-value string map of custom fields
        lastContactedAt:
          type: string
          format: date-time
        importBatchId:
          type: string
        externalId:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - phone
        - email
        - status
        - accountId
    LeadStatus:
      type: string
      enum:
        - new
        - contacted
        - qualified
        - disqualified
  responses:
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            required:
              - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key prefixed with `nl_live_` or `nl_test_`
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token using an API key (format nl_live_* or nl_test_*)

````