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

# Create self-custodial bulk payments

> Submits a signed Permit2 batch and returns one durable bulk payment ID plus the receipt IDs created for its individual payments.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/payment/onchain/ncw_bulkpay/{user_id}
openapi: 3.0.3
info:
  title: UniFi Public API
  version: 1.0.0
  description: >-
    Production API operations organized around the UniFi payment lifecycle.
    Internal administration, worker, dashboard, support, scheduling, and Falcon
    orchestration routes are intentionally excluded.
servers:
  - url: https://api.payunifi.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Check API process availability and dependency health.
  - name: Deposit
    description: Resolve deposit addresses for a UniFi wallet.
  - name: Wallet
    description: Read stablecoin balances across wallets and chains.
  - name: Preflight
    description: >-
      Check balances, allowances, and estimated fees before submitting a
      payment.
  - name: Pay
    description: Create managed-wallet, merchant, and self-custodial payments.
  - name: History
    description: Track payment sessions, receipts, finality, and history.
paths:
  /v1/payment/onchain/ncw_bulkpay/{user_id}:
    post:
      tags:
        - Pay
      summary: Create self-custodial bulk payments
      description: >-
        Submits a signed Permit2 batch and returns one durable bulk payment ID
        plus the receipt IDs created for its individual payments.
      operationId: createSelfCustodialBulkPayment
      parameters:
        - $ref: '#/components/parameters/UserId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SelfCustodialBulkPaymentRequest'
            example:
              payload:
                base:
                  chain: Sepolia
                  batch:
                    - coin: USDT
                      to_address: '0x2222222222222222222222222222222222222222'
                      amount: '10.25'
                      memo: BulkPay
                    - coin: USDC
                      to_address: '0x3333333333333333333333333333333333333333'
                      amount: '4.50'
                      memo: BulkPay
                  tot_est_fee: '0.18'
                  deadline: 1893456000
                nonce: '0'
                sig: 0xpermit2-signature
              scheds: null
      responses:
        '200':
          description: The bulk payment ID and receipt IDs created for the batch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkPaymentResponse'
              example:
                status: 200 OK
                data:
                  bulk_pay_id: 1b0123456789abcdef01234567
                  receipt_ids:
                    - 1r0123456789abcdef01234567
                    - 1r89abcdef0123456701234567
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  parameters:
    UserId:
      name: user_id
      in: path
      required: true
      schema:
        type: string
      description: >-
        UniFi user identifier, such as a verified email address or wallet
        address.
  schemas:
    SelfCustodialBulkPaymentRequest:
      type: object
      required:
        - payload
      properties:
        payload:
          $ref: '#/components/schemas/SelfCustodialBulkPaymentPayload'
        scheds:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/Schedule'
      additionalProperties: false
    BulkPaymentResponse:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: string
        data:
          $ref: '#/components/schemas/BulkPaymentResult'
    SelfCustodialBulkPaymentPayload:
      type: object
      required:
        - base
        - nonce
        - sig
      properties:
        base:
          $ref: '#/components/schemas/BulkPaymentBase'
        nonce:
          type: string
          description: Permit2 nonce as a decimal integer string.
        sig:
          type: string
          description: Sender's Permit2 signature.
      additionalProperties: false
    Schedule:
      type: object
      required:
        - id
        - is_recurring
      properties:
        id:
          type: string
        is_recurring:
          type: boolean
      additionalProperties: false
    BulkPaymentResult:
      type: object
      required:
        - bulk_pay_id
        - receipt_ids
      properties:
        bulk_pay_id:
          type: string
        receipt_ids:
          type: array
          items:
            type: string
    BulkPaymentBase:
      type: object
      required:
        - chain
        - batch
        - tot_est_fee
        - deadline
      properties:
        chain:
          $ref: '#/components/schemas/Chain'
        batch:
          type: array
          minItems: 2
          items:
            $ref: '#/components/schemas/BulkPayItem'
        tot_est_fee:
          type: string
          pattern: ^[0-9]+(\.[0-9]+)?$
          description: Human-readable total estimated fee.
        deadline:
          type: integer
          format: int64
          description: Permit expiry as a Unix timestamp in seconds.
      additionalProperties: false
    Chain:
      type: string
      enum:
        - Ethereum
        - Polygon
        - Sepolia
      description: >-
        Production-supported mainnets and public testnets exposed by the public
        reference.
    BulkPayItem:
      type: object
      required:
        - coin
        - to_address
        - amount
        - memo
      properties:
        coin:
          $ref: '#/components/schemas/Stablecoin'
        to_address:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        amount:
          type: string
          pattern: ^[0-9]+(\.[0-9]+)?$
          description: Human-readable decimal token amount.
        memo:
          $ref: '#/components/schemas/Memo'
      additionalProperties: false
    Stablecoin:
      type: string
      enum:
        - USDT
        - USDC
        - DAI
    Memo:
      description: >-
        Payment purpose. Unit variants serialize as strings; data-carrying
        variants serialize as objects.
      oneOf:
        - type: string
          enum:
            - General
            - FliqPay
            - FliqPayMerchant
            - BulkPay
        - type: object
          required:
            - Custom
          properties:
            Custom:
              type: string
              maxLength: 48
          additionalProperties: false
        - type: object
          required:
            - SubscribeApi
          properties:
            SubscribeApi:
              type: array
              minItems: 2
              maxItems: 2
              items:
                type: string
              example:
                - Starter
                - Month
          additionalProperties: false
  responses:
    BadRequest:
      description: The request is invalid or cannot be completed in the current state.
      content:
        text/plain:
          schema:
            type: string
    Unauthorized:
      description: >-
        The bearer credential is missing, invalid, or not authorized for this
        user.
      content:
        text/plain:
          schema:
            type: string
    NotFound:
      description: The requested resource does not exist.
      content:
        text/plain:
          schema:
            type: string
    Conflict:
      description: The operation conflicts with the resource's current state.
      content:
        text/plain:
          schema:
            type: string
    RateLimited:
      description: The credential has exceeded its current request allowance.
      content:
        text/plain:
          schema:
            type: string
    ServerError:
      description: The API could not complete the request.
      content:
        text/plain:
          schema:
            type: string
    Unavailable:
      description: A required dependency is temporarily unavailable.
      content:
        text/plain:
          schema:
            type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: Use a UniFi API key generated from the web app and stored server-side.

````

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