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

# Push up to 100 leads

> Push up to 100 leads into a standing API campaign in one request. Each item has exactly the single-push body ({ lead, idempotencyKey }) and gets the same treatment: idempotencyKey is required per lead, and a reused key (in this batch or an earlier request) is reported as a duplicate with no second dial. Campaign-level problems reject the whole batch; problems with one lead are reported in that lead's result and do not affect the others. A rejected lead with retryable: true (journey live cap, or a failure on our side) was not accepted and should be resent later with the same idempotencyKey. Results are returned in request order. A batch counts as one request against the per-key rate limit.

**Required scope:** `campaigns.edit`

<Info>Scopes apply to scoped API keys. Keys issued without scopes can call every `/v1` endpoint.</Info>


## OpenAPI

````yaml /api-reference/openapi.json post /v1/campaigns/{campaignId}/leads/batch
openapi: 3.0.3
info:
  title: Pineyard API
  version: 1.0.0
  description: >-
    Programmatic access to agents, campaigns, calls, phone numbers, WhatsApp and
    results in your Pineyard workspace.
servers:
  - url: https://api.pineyard.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/campaigns/{campaignId}/leads/batch:
    post:
      summary: Push up to 100 leads
      description: >-
        Push up to 100 leads into a standing API campaign in one request. Each
        item has exactly the single-push body ({ lead, idempotencyKey }) and
        gets the same treatment: idempotencyKey is required per lead, and a
        reused key (in this batch or an earlier request) is reported as a
        duplicate with no second dial. Campaign-level problems reject the whole
        batch; problems with one lead are reported in that lead's result and do
        not affect the others. A rejected lead with retryable: true (journey
        live cap, or a failure on our side) was not accepted and should be
        resent later with the same idempotencyKey. Results are returned in
        request order. A batch counts as one request against the per-key rate
        limit.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                leads:
                  type: array
                  items:
                    nullable: true
                  minItems: 1
                  maxItems: 100
              required:
                - leads
      responses:
        '200':
          description: Batch processed — see per-lead results
          content:
            application/json:
              schema:
                type: object
                properties:
                  requestId:
                    type: string
                    format: uuid
                  summary:
                    type: object
                    properties:
                      queued:
                        type: integer
                      duplicate:
                        type: integer
                      rejected:
                        type: integer
                    required:
                      - queued
                      - duplicate
                      - rejected
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                          minimum: 0
                        idempotencyKey:
                          type: string
                        phone:
                          type: string
                        status:
                          type: string
                          enum:
                            - queued
                            - duplicate
                            - rejected
                        requestId:
                          type: string
                          format: uuid
                        leadId:
                          type: string
                        resultUrl:
                          type: string
                        warnings:
                          type: object
                          properties:
                            undeclaredVariables:
                              type: array
                              items:
                                type: string
                          required:
                            - undeclaredVariables
                        error:
                          type: string
                        reason:
                          type: string
                        issues:
                          type: array
                          items:
                            nullable: true
                        retryable:
                          type: boolean
                      required:
                        - index
                        - status
                        - requestId
                required:
                  - requestId
                  - summary
                  - results
        '401':
          description: >-
            - `invalid_api_key`: The API key is unknown, revoked or expired, or
            its workspace was deleted.

            - `unauthorized`: No `Authorization: Bearer` header, or an empty
            token.
        '403':
          description: >-
            - `api_key_owner_inactive`: The member the key acts for was removed
            or suspended.

            - `forbidden`: The key lacks the permission named in
            `requiredPermission`, or the resource belongs to another workspace.

            - `workspace_pending_approval`: The workspace has not been approved
            yet.

            - `workspace_suspended`: The workspace is suspended.
        '404':
          description: >-
            - `not_found`: The resource does not exist in your workspace, or the
            feature is not enabled for it.
        '409':
          description: Campaign not source=API, or not RUNNING
        '422':
          description: 'Body is not { leads: [...] } with 1–100 items'
        '429':
          description: '- `rate_limited`: Too many requests.'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your API key, e.g. `pk_live_xxxxxxxxxxxxxxxxxxxxxxxx`.

````

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