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

# Configure a Terminal batch scenario

> Configures the durable current-batch situation for this simulated
Terminal. Submitted profiles replace their items, while omitted
existing profiles remain unchanged so an open batch cannot disappear
between observations. Calling `POST /terminal_batches/refresh` then creates
or updates the normal Ionic settlement profiles, batches, and batch
items; its response shape is identical for simulated and physical
Terminals.

A simulated Terminal with no configured batch scenario reports one
empty default profile, so batch refresh is always supported.




## OpenAPI

````yaml /openapi/terminal-testing.yaml post /test_helpers/terminals/{id}/batch_scenarios
openapi: 3.0.3
info:
  title: Ionic Terminal Testing API
  version: '2026-09-02'
  description: |
    Every test Account automatically owns the same built-in test topology:
    three Account-scoped simulated Terminals across two test Locations. List
    them with `GET /terminals` and select the `approved`, `declined`, or
    `delayed` Terminal by its `test_profile` field.

    Process a normal test PaymentIntent through
    `POST /terminals/{id}/process_payment_intent`; no test-helper call is
    required. The helpers in this API are optional exact-PaymentIntent
    overrides for cases beyond a Terminal's built-in profile. Your POS uses
    the same Terminal Payment integration when it moves to physical hardware.
servers:
  - url: '{baseUrl}/v1'
    variables:
      baseUrl:
        default: https://api.ionicfi.com
        description: API base URL for the selected environment.
security:
  - secretKey: []
tags:
  - name: Terminal Testing
    description: Override built-in Terminal behavior for focused automated tests.
paths:
  /test_helpers/terminals/{id}/batch_scenarios:
    post:
      tags:
        - Terminal Testing
      summary: Configure a Terminal batch scenario
      description: >
        Configures the durable current-batch situation for this simulated

        Terminal. Submitted profiles replace their items, while omitted

        existing profiles remain unchanged so an open batch cannot disappear

        between observations. Calling `POST /terminal_batches/refresh` then
        creates

        or updates the normal Ionic settlement profiles, batches, and batch

        items; its response shape is identical for simulated and physical

        Terminals.


        A simulated Terminal with no configured batch scenario reports one

        empty default profile, so batch refresh is always supported.
      operationId: createTerminalBatchScenario
      parameters:
        - $ref: '#/components/parameters/TerminalId'
        - $ref: '#/components/parameters/IonicAccount'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTerminalBatchScenarioRequest'
            example:
              profiles:
                - reference: default
                  items:
                    - operation: sale
                      amount: 1250
                      transaction_id: sim_sale_1
                      external_reference: order_123
                      sequence: '1'
                    - operation: refund
                      amount: 250
                      transaction_id: sim_refund_1
                      external_reference: refund_123
                      sequence: '2'
      responses:
        '201':
          description: The durable batch scenario.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TerminalBatchSimulation'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/TerminalNotFound'
        '422':
          $ref: '#/components/responses/InvalidState'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - secretKey:
            - terminals:write
components:
  parameters:
    TerminalId:
      name: id
      in: path
      required: true
      description: Merchant-owned simulated Terminal ID.
      schema:
        type: string
        pattern: ^tmr_[0-9A-Za-z]{14}$
      example: tmr_R7pA3nB9qK2mX5
    IonicAccount:
      name: Ionic-Account
      in: header
      required: false
      description: |
        Merchant ID when an authorized Platform acts for a connected Merchant.
        Omit when authenticating directly as that Merchant.
      schema:
        type: string
        pattern: ^mer_[0-9A-Za-z]{14}$
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: Reuse only when retrying the same route and request body.
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    CreateTerminalBatchScenarioRequest:
      type: object
      additionalProperties: false
      required:
        - profiles
      properties:
        profiles:
          type: array
          minItems: 1
          maxItems: 10
          description: >-
            One to 10 profile updates. Omitted existing profiles remain
            unchanged.
          items:
            $ref: '#/components/schemas/TerminalBatchSimulationProfileInput'
    TerminalBatchSimulation:
      type: object
      additionalProperties: false
      required:
        - id
        - object
        - merchant_id
        - terminal_id
        - livemode
        - profiles
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        object:
          type: string
          enum:
            - terminal.batch_simulation
        merchant_id:
          type: string
          pattern: ^mer_[0-9A-Za-z]{14}$
        terminal_id:
          type: string
          pattern: ^tmr_[0-9A-Za-z]{14}$
        livemode:
          type: boolean
          enum:
            - false
        profiles:
          type: array
          items:
            $ref: '#/components/schemas/TerminalBatchSimulationProfile'
        created_at:
          type: integer
          format: int64
        updated_at:
          type: integer
          format: int64
    TerminalBatchSimulationProfileInput:
      type: object
      additionalProperties: false
      required:
        - reference
        - items
      properties:
        reference:
          type: string
          minLength: 1
          maxLength: 128
          description: Stable test processing-profile reference within this Terminal.
        items:
          type: array
          maxItems: 1000
          description: Up to 1,000 current-batch items for this profile.
          items:
            $ref: '#/components/schemas/TerminalBatchSimulationItemInput'
    TerminalBatchSimulationProfile:
      type: object
      additionalProperties: false
      required:
        - reference
        - items
      properties:
        reference:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/TerminalBatchSimulationItem'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
    TerminalBatchSimulationItemInput:
      type: object
      additionalProperties: false
      required:
        - operation
        - amount
      description: >-
        Set at least one of `transaction_id`, `external_reference`, or
        `sequence`.
      properties:
        operation:
          type: string
          enum:
            - sale
            - refund
            - void
        amount:
          type: integer
          format: int64
          minimum: 0
          description: Amount in the Merchant's smallest currency unit.
        transaction_id:
          type: string
          maxLength: 128
        external_reference:
          type: string
          maxLength: 128
        sequence:
          type: string
          maxLength: 128
        occurred_at:
          type: integer
          format: int64
          description: Optional Unix timestamp for the simulated transaction.
    TerminalBatchSimulationItem:
      type: object
      additionalProperties: false
      required:
        - operation
        - amount
      properties:
        operation:
          type: string
          enum:
            - sale
            - refund
            - void
        amount:
          type: integer
          format: int64
        transaction_id:
          type: string
        external_reference:
          type: string
        sequence:
          type: string
        occurred_at:
          type: integer
          format: int64
  responses:
    BadRequest:
      description: Invalid JSON, field value, resource mode, or scenario combination.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        Inactive Merchant, invalid delegation, or missing `terminals:write`
        permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TerminalNotFound:
      description: >-
        The simulated Terminal was not found in the authenticated Merchant and
        test mode.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InvalidState:
      description: >-
        An unconsumed scenario already exists or the simulated Terminal is not
        ready.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Too many requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: Ionic test secret key
      description: >-
        A test-mode Merchant secret key, or an authorized Platform test key with
        delegation.

````