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

# Create lead

> Creates a new lead. When creating a lead, supply `stage_name` to assign the initial pipeline stage. Requires `crm:write` scope.

Creates a new lead deal record in your workspace.

### Stage assignment behavior

When creating a lead, supply the target stage name in the `stage_name` body field (for example, `"stage_name": "New Lead"`).

### Attribution and custom fields

You can pass Meta campaign attribution fields inside `meta_attribution` (`utm_source`, `utm_medium`, `utm_campaign`) and custom field values defined for leads inside `custom_fields`.

### Required permissions

Requires an API key with the `crm:write` scope.


## OpenAPI

````yaml POST /leads
openapi: 3.1.0
info:
  title: Automate CRM API
  description: >-
    External integration API for Automate CRM. Manage leads, contacts, products,
    follow-ups, custom fields, and real-time inbox lookups.
  version: 1.0.0
servers:
  - url: https://crm-api.automatebusiness.com/api/v1/integrations-public
    description: Production Integration Server
security:
  - apiKeyAuth: []
paths:
  /leads:
    post:
      summary: Create Lead
      description: >-
        Creates a new lead. When creating a lead, supply `stage_name` to assign
        the initial pipeline stage. Requires `crm:write` scope.
      operationId: createLead
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLeadInput'
      responses:
        '201':
          description: Lead created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadMutationResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '409':
          $ref: '#/components/responses/ConflictError'
      security:
        - apiKeyAuth:
            - crm:write
components:
  schemas:
    CreateLeadInput:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Lead title or organization name
          example: Acme Corp Enterprise Deal
        email:
          type: string
          format: email
          example: lead@acmecorp.com
        phone:
          type: string
          example: '+15559876543'
        pipeline_id:
          type: string
          description: >-
            Optional pipeline identifier; defaults to primary pipeline if
            omitted
          example: pipe_default
        stage_name:
          type: string
          description: >-
            Name of the target stage when creating the lead (e.g. 'New Lead',
            'Qualified')
          example: New Lead
        assigned_to:
          type: string
          description: Team member user ID
          example: user_sarah
        tags:
          type: array
          items:
            type: string
          example:
            - enterprise
            - inbound
        custom_fields:
          type: object
          additionalProperties: true
          example:
            deal_value: 50000
        meta_attribution:
          type: object
          properties:
            utm_source:
              type: string
            utm_medium:
              type: string
            utm_campaign:
              type: string
    LeadMutationResponse:
      allOf:
        - $ref: '#/components/schemas/MutationSuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Lead'
    MutationSuccessEnvelope:
      type: object
      description: >-
        Standard envelope returned by POST, PATCH, PUT, and DELETE (mutation)
        endpoints
      properties:
        success:
          type: boolean
          example: true
        data:
          description: The created or updated entity
        error:
          type: 'null'
          example: null
      required:
        - success
        - data
        - error
    Lead:
      type: object
      properties:
        id:
          type: string
          example: lead_890ef12a
        name:
          type: string
          example: Acme Corp Enterprise Deal
        email:
          type: string
          format: email
          example: lead@acmecorp.com
        phone:
          type: string
          example: '+15559876543'
        pipeline_id:
          type: string
          example: pipe_default
        stage_id:
          type: string
          example: stage_contacted
        stage_name:
          type: string
          example: Contacted
        assigned_to:
          type: string
          example: user_sarah
        tags:
          type: array
          items:
            type: string
          example:
            - enterprise
            - q4-inbound
        custom_fields:
          type: object
          additionalProperties: true
          example:
            deal_value: 50000
            industry: Technology
        meta_attribution:
          type: object
          properties:
            utm_source:
              type: string
              example: google
            utm_medium:
              type: string
              example: cpc
            utm_campaign:
              type: string
              example: fall_promo
        created_at:
          type: string
          format: date-time
          example: '2026-10-26T09:30:00.000Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-26T09:30:00.000Z'
    ErrorEnvelope:
      type: object
      description: Standard error envelope returned when a request fails
      properties:
        success:
          type: boolean
          example: false
        data:
          type: 'null'
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Validation failed
            details:
              type: array
              items:
                type: object
                properties:
                  message:
                    type: string
                    example: Required
                  field:
                    type: string
                    example: email
                  code:
                    type: string
                    example: invalid_type
          required:
            - message
      required:
        - success
        - data
        - error
  responses:
    ValidationError:
      description: Validation failed (e.g., missing required fields, invalid format)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: Validation failed
              details:
                - message: Required
                  field: email
                  code: invalid_type
    UnauthorizedError:
      description: Unauthorized (invalid or missing x-api-key)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: Invalid or missing API key.
    ForbiddenError:
      description: Forbidden (API key lacks required crm:read or crm:write scope)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: 'Forbidden: insufficient permissions for this operation.'
    ConflictError:
      description: Resource conflict (e.g. duplicate unique code)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: 'Conflict: resource with unique identifier already exists.'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Workspace API key header. The key implicitly determines your workspace
        isolation. Scopes: `crm:read` for GET/HEAD/OPTIONS, `crm:write` for
        POST/PATCH/PUT/DELETE.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.