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

# Create Batch Job

> Create a new batch job with multiple incentive lookup items. Items are queued and processed asynchronously by a background worker.

## Overview

Create a batch job with multiple addresses and device lookups. Items are validated upfront, then a worker is triggered immediately to process them in the background. A report is created up front and sites are populated as each item completes.

Each completed item's `result` field has the same shape as a single [`POST /incentives`](/api-reference/endpoint/check-incentives) response — including the `processing_summary` and per-program `processing_enabled` fields.

<Tip>
  Include `webhook_custom_fields` on each item when your organization has a webhook URL configured; the backend merges them into the webhook payload for each completed lookup.
</Tip>

Poll [`GET /batch-lookups/{job_id}`](/api-reference/endpoint/batch-get) for job status and use [`GET /batch-lookups/{job_id}/items`](/api-reference/endpoint/batch-items) to retrieve results.


## OpenAPI

````yaml POST /batch-lookups
openapi: 3.0.3
info:
  title: Leap Energy API
  description: >-
    The Leap Energy API provides a unified interface for managing rebate
    incentives and applications.


    ## Incentives API

    Search for and calculate incentive amounts across multiple utility programs.
    Given a customer

    address and building type, the API identifies applicable utility programs
    and calculates potential

    incentive amounts for various device and tier combinations. When your
    organization has a webhook URL

    configured (Webhook Config API), each successful lookup triggers a POST to
    your URL with the response

    and optional custom fields (`webhook_custom_fields`).


    ## Applications API

    Manage rebate applications on behalf of customers. Applications represent a
    customer's request

    for a rebate under a specific utility program, including customer
    information, device details,

    and application metadata.
  version: 2.0.0
  contact:
    name: Leap Energy
    url: https://leap.energy
servers:
  - url: https://api.incentives.leap.energy/alpha
    description: Production API
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /batch-lookups:
    post:
      summary: Create Batch Job
      description: >-
        Create a new batch job with multiple lookup items. Each item will be
        processed independently with its own device_ids.


        **Processing:**

        - Items are queued immediately with status `pending`

        - Background worker processes items automatically (every 5 minutes)

        - You can poll the job status or manually trigger the worker


        **Validation:**

        - All items are validated before job creation

        - Duplicate `reference_id` values within a batch are rejected

        - Invalid items are reported with specific error messages


        **Limits:**

        - Maximum 10,000 items per batch

        - Each item can have different `device_ids`

        - Each item can have different `create_application` setting
      operationId: createBatchJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchRequest'
      responses:
        '201':
          description: Batch job created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBatchResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchError'
        '401':
          description: Unauthorized - missing or invalid authentication
        '500':
          description: Internal server error
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X POST
            "https://api.incentives.leap.energy/alpha/batch-lookups" -H
            "x-api-key: leap_live_..." -H "Content-Type: application/json" -d
            '{"items":[{"reference_id":"deal-001","address":{"street_1":"123
            Main St","city":"San
            Francisco","state_or_province_code":"CA","postal_code":"94102","country_code":"US"},"building_type":"RESIDENTIAL","device_ids":[1]}]}'
components:
  schemas:
    CreateBatchRequest:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/BatchLookupItem'
          minItems: 1
          maxItems: 10000
    CreateBatchResponse:
      type: object
      properties:
        job_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - pending
        total_items:
          type: integer
        created_at:
          type: string
          format: date-time
        report:
          type: object
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            description:
              type: string
              nullable: true
            status:
              type: string
              enum:
                - processing
            report_type:
              type: string
              enum:
                - bulk_lookup
            total_sites:
              type: integer
            created_at:
              type: string
              format: date-time
          required:
            - id
            - name
            - status
            - report_type
            - total_sites
            - created_at
        message:
          type: string
    BatchError:
      type: object
      properties:
        error:
          type: string
          description: Error message
        invalid_items:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              error:
                type: string
          description: Details about invalid items (when creating batch)
        duplicates:
          type: array
          items:
            type: string
          description: Duplicate reference_ids found (when creating batch)
    BatchLookupItem:
      type: object
      required:
        - reference_id
        - address
        - building_type
        - device_ids
      properties:
        reference_id:
          type: string
          example: deal-12345
        address:
          $ref: '#/components/schemas/Address'
        building_type:
          type: string
          enum:
            - RESIDENTIAL
            - COMMERCIAL
            - MULTIFAMILY
          example: RESIDENTIAL
        device_ids:
          type: array
          items:
            type: integer
          minItems: 1
          example:
            - 1
            - 2
        create_application:
          type: boolean
          default: false
          example: false
        webhook_custom_fields:
          type: object
          additionalProperties:
            type: string
          description: Optional per-item custom fields for webhook payload
    Address:
      type: object
      required:
        - street_1
        - city
        - state_or_province_code
        - postal_code
        - country_code
      properties:
        street_1:
          type: string
          example: 123 Main Street
        street_2:
          type: string
          example: Apt 4B
        city:
          type: string
          example: San Francisco
        state_or_province_code:
          type: string
          example: CA
        postal_code:
          type: string
          example: '94102'
        country_code:
          type: string
          example: US
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >
        API key for authentication. Include your Leap API key in the `x-api-key`
        header: `x-api-key: leap_live_...`
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Clerk JWT token for portal authentication

````