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

# Create Leads in Bulk

> Create up to 100 leads in one request with POST /api/leads/bulk. Each item is handled like POST /api/leads and gets its own result.

Create up to 100 leads in one request. Each item takes the same body as [`POST /api/leads`](https://octanist.com/docs/api-reference/endpoint/create-lead) and follows the same rules: validation, lead filtering, external ID idempotency, duplicate handling and plan limits.

Items are processed one at a time, in the order you send them. A later item sees the leads created by earlier items, as it would with separate requests. One item failing does not stop the others.

The response is `200 OK` with a summary and one result per item, also when some or all items failed. Check `success` on each result.

## Request Body

| Field | Type | Required | Description |
| - | - | - | - |
| `leads` | array | Yes | 1 to 100 lead objects, each with the body of [`POST /api/leads`](https://octanist.com/docs/api-reference/endpoint/create-lead#request-body) |

An empty array, more than 100 items, or a body without `leads` returns `400 VALIDATION_ERROR` and nothing is created.

## Example Request

```bash theme={null}
curl -X POST \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "leads": [
      {
        "externalId": "QUOTE-2026-0042",
        "name": "John Doe",
        "email": "john@example.com",
        "value": 2500
      },
      {
        "externalId": "QUOTE-2026-0043",
        "name": "Jane Roe",
        "phone": "+31612345678"
      },
      {
        "note": "No contact details"
      }
    ]
  }' \
  "https://octanist.com/api/leads/bulk"
```

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "summary": {
      "total": 3,
      "succeeded": 2,
      "failed": 1
    },
    "results": [
      {
        "index": 0,
        "success": true,
        "status": 201,
        "data": {
          "id": "lead_abc123",
          "externalId": "QUOTE-2026-0042",
          "created": true,
          "locked": false,
          "message": "Lead added"
        }
      },
      {
        "index": 1,
        "success": true,
        "status": 200,
        "data": {
          "id": "lead_def456",
          "externalId": "QUOTE-2026-0043",
          "created": false,
          "locked": false,
          "message": "Existing lead returned"
        }
      },
      {
        "index": 2,
        "success": false,
        "status": 400,
        "error": {
          "code": "VALIDATION_ERROR",
          "message": "Missing required field (externalId, email, name, phone or custom)"
        }
      }
    ]
  },
  "meta": {
    "requestId": "req_a1b2c3d4e5f6",
    "timestamp": "2026-03-10T12:00:00.000Z"
  }
}
```

## Response Fields

| Field | Type | Description |
| - | - | - |
| `summary.total` | integer | Number of items in the request |
| `summary.succeeded` | integer | Items that succeeded |
| `summary.failed` | integer | Items that failed |
| `results` | array | One result per item, in request order |
| `results[].index` | integer | Position of the item in `leads`, starting at 0 |
| `results[].success` | boolean | Whether the item succeeded |
| `results[].status` | integer | HTTP status the item would get as a single `POST /api/leads` request: `201` created, `200` existing lead, or an error status |
| `results[].data` | object | On success: the same `data` as [`POST /api/leads`](https://octanist.com/docs/api-reference/endpoint/create-lead#response-fields) |
| `results[].error` | object | On failure: `code`, `message` and, for validation errors, `details` |

## Error Responses

These errors apply to the whole request. Errors of single items are in `results`.

| Status | Code | Description |
| - | - | - |
| 400 | `VALIDATION_ERROR` | Invalid JSON, or `leads` is missing, empty or longer than 100 items |
| 401 | `UNAUTHORIZED` | Missing or invalid API key |
| 403 | `FORBIDDEN` | A [read-only API key](https://octanist.com/docs/api-reference/authentication.md#key-access), or the organization is a read-only demo |
| 500 | `INTERNAL_ERROR` | Server error |


## OpenAPI

````yaml POST /api/leads/bulk
openapi: 3.0.1
info:
  title: Octanist API
  description: >-
    The Octanist API allows you to create, update and read leads, run reports,
    read workspace settings, retrieve statistics, and access ad spend data.
  version: 2.5.0
  contact:
    name: Octanist Support
    url: https://octanist.com/docs
servers:
  - url: https://octanist.com
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /api/leads/bulk:
    post:
      tags:
        - Bulk
      summary: Create Leads in Bulk
      description: >-
        Create 1 to 100 leads. Each item takes the body of POST /api/leads and
        is handled like it, in order. One item failing does not stop the others;
        the response is 200 with a result per item.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - leads
              properties:
                leads:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    $ref: '#/components/schemas/CreateLeadRequest'
      responses:
        '200':
          description: Result per item
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      summary:
                        $ref: '#/components/schemas/BulkSummary'
                      results:
                        type: array
                        items:
                          $ref: '#/components/schemas/BulkCreateItemResult'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          description: Invalid JSON, or leads is missing, empty or longer than 100 items
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: A read-only API key, or the organization is a read-only demo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateLeadRequest:
      type: object
      description: At least one of externalId, name, email, phone, or custom is required.
      properties:
        externalId:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            Customer-owned lead identifier, unique within the organization.
            Whitespace is trimmed and the value acts as an idempotency key.
          example: QUOTE-2026-0042
        name:
          type: string
          description: Lead name
          example: John Doe
        email:
          type: string
          format: email
          description: Lead email
          example: john@example.com
        phone:
          type: string
          description: Lead phone number
          example: '+1234567890'
        custom:
          oneOf:
            - type: string
            - type: object
            - type: array
          description: >-
            Custom data. Accepts a string or JSON object/array. Non-string
            values are automatically stringified. Always returned as a string in
            responses.
        note:
          type: string
          description: Note to attach to the lead
        value:
          oneOf:
            - type: number
              minimum: 0
            - type: string
          description: >-
            Expected deal value, 0 or higher. Strings in US or European notation
            ("1,250.50" or "1.250,50") are converted to numbers. Only set when a
            new lead is created, not on an existing lead that is returned.
          example: 2500
        labelId:
          type: string
          description: >-
            Label ID from GET /api/workspace. Only set when a new lead is
            created. An unknown ID returns 400.
          example: label_xyz
        sessionId:
          type: string
          description: >-
            Existing Octanist pixel session ID. Use the value from the hidden
            `octa_sid` form field or `window.OCT.getSessionId()`. When provided,
            the lead uses the existing session attribution and direct
            attribution fields in this request are ignored.
          example: 550e8400-e29b-41d4-a716-446655440000
        website:
          type: string
          description: Website URL
          example: https://example.com
        path:
          type: string
          description: Page path
          example: /contact
        gclid:
          type: string
          description: Google Ads Click ID
        dclid:
          type: string
          description: Google Display Click ID
        wbraid:
          type: string
          description: Google Ads web-to-app click ID
        gbraid:
          type: string
          description: Google Ads app-to-web click ID
        fbc:
          type: string
          description: Meta (Facebook) Click ID
        fbp:
          type: string
          description: Meta (Facebook) Browser ID
        ga4cid:
          type: string
          description: Google Analytics 4 Client ID
        ga4sid:
          type: string
          description: Google Analytics 4 Session ID
        li_fat_id:
          type: string
          description: LinkedIn Click ID
        msclkid:
          type: string
          description: Microsoft Ads Click ID
        ttclid:
          type: string
          description: TikTok Click ID
        twclid:
          type: string
          description: X (Twitter) Click ID
        rdt_cid:
          type: string
          description: Reddit Click ID
        sccid:
          type: string
          description: Snapchat Click ID
        epik:
          type: string
          description: Pinterest click ID
        utm_source:
          type: string
          description: UTM source
          example: google
        utm_medium:
          type: string
          description: UTM medium
          example: cpc
        utm_campaign:
          type: string
          description: UTM campaign
        ad_storage:
          oneOf:
            - type: boolean
            - type: string
              enum:
                - 'true'
                - 'false'
          default: false
          description: >-
            Ad storage consent. Boolean, or the string "true" or "false"
            (case-insensitive). Other strings return 400.
        ad_user_data:
          oneOf:
            - type: boolean
            - type: string
              enum:
                - 'true'
                - 'false'
          default: false
          description: >-
            Ad user data consent. Boolean, or the string "true" or "false"
            (case-insensitive). Other strings return 400.
        ad_personalization:
          oneOf:
            - type: boolean
            - type: string
              enum:
                - 'true'
                - 'false'
          default: false
          description: >-
            Ad personalization consent. Boolean, or the string "true" or "false"
            (case-insensitive). Other strings return 400.
        analytics_storage:
          oneOf:
            - type: boolean
            - type: string
              enum:
                - 'true'
                - 'false'
          default: false
          description: >-
            Analytics storage consent. Boolean, or the string "true" or "false"
            (case-insensitive). Other strings return 400.
    BulkSummary:
      type: object
      properties:
        total:
          type: integer
          example: 3
        succeeded:
          type: integer
          example: 2
        failed:
          type: integer
          example: 1
    BulkCreateItemResult:
      type: object
      properties:
        index:
          type: integer
          description: Position of the item in the request, starting at 0
          example: 0
        success:
          type: boolean
          example: true
        status:
          type: integer
          description: HTTP status the item would get as a single request
          example: 200
        data:
          allOf:
            - $ref: '#/components/schemas/CreateLeadResult'
          description: 'On success: the same data as the single endpoint'
        error:
          type: object
          description: On failure
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
            details:
              type: object
    Meta:
      type: object
      properties:
        requestId:
          type: string
          example: req_a1b2c3d4e5f6
        timestamp:
          type: string
          format: date-time
          example: '2026-03-10T12:00:00.000Z'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human readable error message
              example: Human readable error message
            details:
              type: object
              description: Optional additional error details
        meta:
          $ref: '#/components/schemas/Meta'
    CreateLeadResult:
      type: object
      properties:
        id:
          type: string
          example: lead_abc123
        externalId:
          type: string
          nullable: true
          example: QUOTE-2026-0042
        created:
          type: boolean
          description: >-
            `true` for a new lead (201), `false` when an existing lead was
            returned (200)
          example: true
        locked:
          type: boolean
          description: >-
            `true` when the lead is over the plan's lead limit. A locked lead is
            kept and still sends conversions, but is hidden in lead lists and
            details until the plan is upgraded.
          example: false
        message:
          type: string
          example: Lead added
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication

````

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