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

# Enroll leads into a program

> Enrolls a batch of leads into a program. Each lead is processed independently and the result for each lead is returned. The program must be in the "running" state to accept leads.



## OpenAPI

````yaml /swagger.yml post /public/v1/programs/{programId}/leads/batch
openapi: 3.0.0
info:
  title: Public API Docs
  description: Clerk Public API
  version: '1.0'
  contact: {}
servers:
  - url: https://web-api.clerk.chat
    description: Production server
  - url: http://localhost:3000
    description: Production server
security: []
tags: []
paths:
  /public/v1/programs/{programId}/leads/batch:
    post:
      tags:
        - Programs
      summary: Enroll leads into a program
      description: >-
        Enrolls a batch of leads into a program. Each lead is processed
        independently and the result for each lead is returned. The program must
        be in the "running" state to accept leads.
      operationId: PublicProgramLeadsController_ingestBatch
      parameters:
        - name: programId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadBatchRequest'
      responses:
        '200':
          description: Per-lead enrollment result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadBatchResponse'
        '400':
          description: Invalid request body
        '401':
          description: Unauthorized request
        '403':
          description: You do not have permission to access this resource
        '404':
          description: Resource not found
        '422':
          description: Invalid request parameters
        '429':
          description: Too many requests for this resource
        '500':
          description: Internal server error
      security:
        - api_key: []
components:
  schemas:
    LeadBatchRequest:
      type: object
      required:
        - source
        - leads
      properties:
        source:
          type: string
          description: >-
            Where the leads in this batch came from. Applied to every lead that
            does not set its own `source`.
          example: spring-promo-landing
        leads:
          type: array
          description: The leads to enroll. Up to 50 per request.
          items:
            $ref: '#/components/schemas/LeadDto'
    LeadBatchResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/LeadBatchData'
    LeadDto:
      type: object
      properties:
        phone:
          type: string
          description: >-
            The phone number to reach this lead in E.164 format. Used to find or
            create the contact. A lead with a missing or unparseable number
            comes back with a `rejected` status.
          example: '+14155550100'
        name:
          type: string
          description: The lead's name.
          example: John Doe
        email:
          type: string
          description: The lead's email address.
          example: jdoe@example.com
        externalId:
          type: string
          description: Your identifier for this lead.
          example: crm-10472
        source:
          type: string
          description: >-
            Where this lead came from. Overrides the request-level source for
            this lead.
          example: summer-promo-landing
        sourceCampaign:
          type: string
          description: The campaign this lead is attributed to.
          example: summer-promo
        sourceUrl:
          type: string
          description: The web address where the lead was captured.
          example: https://example.com/get-a-quote
        occurredAt:
          type: string
          description: >-
            When the lead was captured, as an ISO 8601 timestamp. Defaults to
            the time of the request.
          example: '2026-06-26T14:30:00.000Z'
        fields:
          type: object
          description: >-
            Custom data for the lead, as key/value pairs. Keys that match one of
            your team's contact properties are saved to the contact.
          example:
            state: TX
            zip: '78701'
            propertyValue: 450000
            utm_source: google
        consent:
          type: array
          description: >-
            Consent the lead gave at capture (e.g. the webform opt-in), one
            entry per channel. Required to enroll: a lead with no consent for
            any of the program’s channels is rejected with reason
            `missing_consent`. Consent already on file for the contact counts.
          items:
            $ref: '#/components/schemas/ConsentDto'
    LeadBatchData:
      type: object
      required:
        - results
        - summary
      properties:
        results:
          type: array
          description: One result per lead sent, in the same order.
          items:
            $ref: '#/components/schemas/LeadResult'
        summary:
          description: Counts of each outcome across the request.
          allOf:
            - $ref: '#/components/schemas/LeadBatchSummary'
    ConsentDto:
      type: object
      required:
        - channel
        - scope
      properties:
        channel:
          type: string
          enum:
            - messaging
            - voice
          description: The channel this consent authorizes. `messaging` covers SMS and RCS.
          example: messaging
        scope:
          type: string
          enum:
            - conversational
            - promotional
          description: >-
            What the consent permits. `promotional` is required to send
            marketing and `conversational` covers replies.
          example: promotional
        basis:
          type: string
          enum:
            - pewc
            - keywordOptIn
          description: >-
            How consent was obtained. Defaults to `pewc` (prior express written
            consent).
          example: pewc
        capturedAt:
          type: string
          description: >-
            When consent was captured, as an ISO 8601 timestamp. Defaults to
            now.
          example: '2026-06-15T12:00:00.000Z'
        expiresAt:
          type: string
          description: >-
            When the consent expires, as an ISO 8601 timestamp. Omit for no
            expiry.
          example: '2027-06-15T12:00:00.000Z'
        sourceUrl:
          type: string
          description: The web address where consent was captured.
          example: https://example.com/get-a-quote
        ipAddress:
          type: string
          description: The consumer's IP address at the time of capture.
          example: 198.51.100.7
        certProvider:
          type: string
          description: Consent certificate provider, e.g. `trustedform` or `jornaya`.
          example: trustedform
        certToken:
          type: string
          description: The consent certificate token or URL.
          example: https://cert.trustedform.com/0a1b2c3d
    LeadResult:
      type: object
      required:
        - index
        - status
      properties:
        index:
          type: number
          description: The position of this lead in the leads you sent, starting at 0.
          example: 0
        externalId:
          type: string
          description: The externalId you sent for this lead, if any.
          example: crm-10472
        status:
          type: string
          enum:
            - enrolled
            - skipped
            - suppressed
            - rejected
          description: >-
            The outcome for this lead. enrolled: added to the program. skipped:
            already actively enrolled. suppressed: the contact has opted out.
            rejected: the lead could not be processed (see reason).
          example: enrolled
        leadId:
          type: string
          description: The id of the created lead, if created.
          example: 00000000-0000-0000-0000-000000000000
        enrollmentId:
          type: string
          description: The id of the created enrollment, if enrolled.
          example: 00000000-0000-0000-0000-000000000000
        reason:
          type: string
          description: Why the lead was not enrolled, if not enrolled.
          example: opted_out
    LeadBatchSummary:
      type: object
      required:
        - total
        - enrolled
        - skipped
        - suppressed
        - rejected
      properties:
        total:
          type: number
          description: Number of leads sent.
          example: 3
        enrolled:
          type: number
          description: Number of leads added to the program.
          example: 2
        skipped:
          type: number
          description: Number of leads already actively enrolled.
          example: 0
        suppressed:
          type: number
          description: Number of leads whose contact has opted out.
          example: 0
        rejected:
          type: number
          description: Number of leads that could not be processed.
          example: 1
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apiKey

````