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

# Run an agent over a batch

> Process up to 100 documents in a single call.



## OpenAPI

````yaml openapi.json POST /api/v1/agents/{slug}/batch
openapi: 3.1.0
info:
  title: equate API
  version: 1.0.0
  description: >-
    The public equate Agent API. Send a supplier invoice (as text, a
    base64-encoded file, or a URL) to a published agent and receive structured,
    travel-aware extraction — optionally matched against your booking data.
    Authenticated with a workspace API key.
  contact:
    name: equate support
    email: support@equatetravel.ai
servers:
  - url: https://equatetravel.ai
    description: >-
      Production. Replace with your equate workspace domain if you use a custom
      one.
  - url: http://localhost:3000
    description: Local development
security:
  - apiKey: []
tags:
  - name: Agents
    description: >-
      Invoke a published agent to read a document, say what it is, match it to a
      booking and set off its actions.
  - name: Invoices
    description: >-
      Push invoice documents into the workspace's pipelines, and fetch the
      documents held for an invoice.
paths:
  /api/v1/agents/{slug}/batch:
    post:
      tags:
        - Agents
      summary: Run an agent over a batch
      description: >-
        Process up to 100 documents in a single call. Items are run sequentially
        and independently, so one bad item never fails the whole batch. Each
        item may carry its own `reference` (echoed back). Every item is a run of
        its own: it has its own `outcome`, and sets off the agent's actions for
        that outcome.
      operationId: runAgentBatch
      parameters:
        - name: slug
          in: path
          required: true
          description: The agent's URL-safe slug.
          schema:
            type: string
            pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
            example: cruise-invoices
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchRequest'
            examples:
              mixed:
                summary: Mixed inputs
                value:
                  items:
                    - content: 'Supplier: Riviera Travel ...'
                      reference: row-1
                    - fileUrl: https://example.com/inv-2.pdf
                      reference: row-2
      responses:
        '200':
          description: The batch was processed. Inspect each item's `ok` flag.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResponse'
        '400':
          description: >-
            The batch body failed validation (empty, over 100 items, or a
            malformed item).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing, malformed, unknown or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '413':
          description: One of the items' base64 files exceeds the per-call size limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: >-
            The batch would breach the agent's throttle (one quota unit per
            item). A `Retry-After` header gives the cool-off in seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    BatchRequest:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          minItems: 1
          maxItems: 100
          items:
            $ref: '#/components/schemas/RunRequest'
          description: Between 1 and 100 run requests.
    BatchResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            agent:
              type: string
            version:
              type: integer
            total:
              type: integer
              description: Number of items processed.
            succeeded:
              type: integer
            failed:
              type: integer
            results:
              type: array
              items:
                $ref: '#/components/schemas/BatchItemResult'
    ApiError:
      type: object
      description: Every error response uses this envelope.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - UNAUTHORIZED
                - VALIDATION_ERROR
                - SUBSCRIPTION_REQUIRED
                - FEATURE_NOT_AVAILABLE
                - NOT_FOUND
                - AGENT_DISABLED
                - NOT_PUBLISHED
                - PAYLOAD_TOO_LARGE
                - UNSUPPORTED_MEDIA_TYPE
                - FETCH_FAILED
                - INGEST_FAILED
                - RATE_LIMITED
                - RUN_FAILED
                - INTERNAL_ERROR
              description: A stable, machine-readable error code.
            message:
              type: string
              description: A human-readable explanation.
            details:
              type: object
              additionalProperties: true
              description: >-
                Present for `VALIDATION_ERROR`: a flattened list of field
                issues.
          required:
            - code
            - message
        runId:
          type:
            - string
            - 'null'
          description: 'Present on `RUN_FAILED`: the id of the recorded (failed) run.'
    RunRequest:
      type: object
      description: >-
        A single agent invocation. Supply the document via exactly one of
        `content`, `fileBase64` or `fileUrl`.
      anyOf:
        - required:
            - content
        - required:
            - fileBase64
        - required:
            - fileUrl
      properties:
        content:
          type: string
          maxLength: 200000
          description: Inline document text to extract from.
        fileBase64:
          type: string
          description: >-
            A base64-encoded file (PDF, CSV or plain text). Decoded size must
            stay under ~10.5 MB.
        fileUrl:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            A publicly reachable http(s) URL the server fetches the document
            from.
        fileName:
          type: string
          maxLength: 500
          description: Optional original filename, used as a hint.
        fileType:
          type: string
          maxLength: 120
          description: Optional MIME type for `fileBase64`, e.g. `application/pdf`.
        reference:
          type: string
          maxLength: 200
          description: Your own correlation id, echoed back unchanged in the result.
        modelTier:
          type: string
          enum:
            - smart
            - fast
          description: >-
            Which built-in model preset reads the document: `smart` favours
            accuracy, `fast` favours latency. An agent stores no tier of its
            own, so omitting this means `smart`. It only applies while no
            extraction models have been set up for the platform; once they have,
            they always run and this is ignored.
    BatchItemResult:
      type: object
      properties:
        ok:
          type: boolean
          description: Whether this item ran successfully.
        runId:
          type:
            - string
            - 'null'
        reference:
          type:
            - string
            - 'null'
          description: The `reference` you supplied for this item, if any.
        result:
          $ref: '#/components/schemas/RunResult'
          description: Present when `ok` is true.
        error:
          type: string
          description: Failure reason. Present when `ok` is false.
    RunResult:
      type: object
      description: >-
        What the agent answers. `document`, `outcome` and `actions` are always
        present. `seenBefore` is present on every answer from an agent that
        keeps records. `data` and `match` are shaped by the agent's published
        output config and are each included only when the agent is configured to
        return them. Operator-defined static fields are merged at the top level
        and can never replace one of the named keys.
      additionalProperties: true
      required:
        - document
        - outcome
        - actions
      properties:
        reference:
          type: string
          description: Echoed back from the request when supplied.
        document:
          $ref: '#/components/schemas/RunDocument'
        outcome:
          type: string
          enum:
            - AUTO_MATCHED
            - NEEDS_REVIEW
            - NO_MATCH
            - EXTRACTED
            - OUT_OF_SCOPE
            - NOT_HANDLED
          description: >-
            How the run ended. `AUTO_MATCHED`: matched to a booking with every
            field in force agreeing. `NEEDS_REVIEW`: a likely booking was found
            but someone should check it. `NO_MATCH`: no booking was found.
            `EXTRACTED`: the agent has no booking data connected, so the
            document was only read. `OUT_OF_SCOPE`: the document's supplier is
            not one the agent takes, so it was read and not matched.
            `NOT_HANDLED`: the document is not an invoice and no enabled
            document handler covers its type, so it was read and not matched.
        actions:
          type: array
          description: >-
            The agent's actions this outcome set off, in running order. Empty
            when the outcome has none. `AUTO_MATCHED` and `NEEDS_REVIEW` set off
            the actions added under their own name, `NO_MATCH` sets off the
            actions added under No match, and the other outcomes set off none.
          items:
            $ref: '#/components/schemas/RunAction'
        seenBefore:
          description: >-
            Only from an agent set to keep records. `null` when the invoice is
            not on record. Otherwise equate already has an invoice with the same
            supplier and reference, from an earlier call to an agent that keeps
            records or from a pipeline that delivered it. A flag, never a hold:
            the document is still read, matched and answered.
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/RunSeenBefore'
        data:
          $ref: '#/components/schemas/ExtractedInvoiceData'
          description: >-
            The extracted invoice fields. Filtered to the agent's selected
            fields when configured.
        match:
          $ref: '#/components/schemas/MatchResult'
          description: >-
            The booking match outcome. Present whenever the agent has booking
            data connected and match output is enabled, including when the
            document was not matched (`OUT_OF_SCOPE`, `NOT_HANDLED`): `reason`
            then says why.
        files:
          type: array
          description: >-
            The document itself. Present only when the agent's response is set
            to return the document, which is off by default. Returned inline, or
            as a link when the agent keeps files and the call is recorded (not
            in test mode).
          items:
            $ref: '#/components/schemas/RunFile'
    RunDocument:
      type: object
      description: >-
        What the document is. With document handling switched off on the agent,
        or not included in the plan, every document is read as an invoice.
      required:
        - type
        - isInvoice
      properties:
        type:
          type: string
          description: >-
            `invoice`, the name of a document type (for example `Flight
            Update`), or `other` for a document that is not an invoice and could
            not be named.
          example: invoice
        isInvoice:
          type: boolean
        fields:
          type: object
          additionalProperties: true
          description: >-
            The document type's own columns, keyed by column, for example an
            ATOL certificate's number. Present only on a document a handler took
            whose type has columns.
    RunAction:
      type: object
      description: One action the run's outcome set off.
      required:
        - actionId
        - name
        - type
        - status
      properties:
        actionId:
          type: string
          format: uuid
        name:
          type: string
          description: The action's name, or its type when it has none.
        type:
          type: string
          enum:
            - EXPORT_JSON
            - EXPORT_XML
            - WEBHOOK
            - EMAIL
            - FTP_UPLOAD
            - GOOGLE_SHEETS_APPEND
        status:
          type: string
          enum:
            - QUEUED
            - SKIPPED_TEST_MODE
          description: >-
            `QUEUED`: handed over for delivery, which happens after this
            response. `SKIPPED_TEST_MODE`: the agent, or the document handler
            that took the document, is in test mode, so it was not run.
    RunSeenBefore:
      type: object
      description: >-
        The invoice on record for the same supplier and reference, compared with
        this one.
      required:
        - kind
        - moneyChanged
        - changedFields
        - receivedAt
        - handledBy
      properties:
        kind:
          type: string
          enum:
            - duplicate
            - changed
          description: >-
            `duplicate`: every field reads the same. `changed`: something
            differs.
        moneyChanged:
          type: boolean
          description: The total, commission or VAT differs from the earlier invoice.
        changedFields:
          type: array
          items:
            type: string
          description: The fields that differ. Empty for a duplicate.
          example:
            - commission
        receivedAt:
          type: string
          format: date-time
          description: When the earlier invoice arrived.
        handledBy:
          type: string
          enum:
            - agent
            - pipeline
          description: >-
            Whether an agent answered the earlier invoice or a pipeline
            processed it.
    ExtractedInvoiceData:
      type: object
      description: >-
        Travel-aware extraction. Every scalar field is a string or null;
        passenger and flight lists are arrays. Which fields are populated
        depends on the trip type (cruise, ski, flights, trains, hotel, package,
        …).
      additionalProperties: true
      properties:
        supplier:
          type:
            - string
            - 'null'
        reference:
          type:
            - string
            - 'null'
        invoiceDate:
          type:
            - string
            - 'null'
        invoiceCurrency:
          type:
            - string
            - 'null'
        totalCost:
          type:
            - string
            - 'null'
        vat:
          type:
            - string
            - 'null'
        resortTax:
          type:
            - string
            - 'null'
        commission:
          type:
            - string
            - 'null'
        onboardSpendingPerPerson:
          type:
            - string
            - 'null'
        drinksPackageCostPerPerson:
          type:
            - string
            - 'null'
        shipName:
          type:
            - string
            - 'null'
        tourName:
          type:
            - string
            - 'null'
        cruiseEmbarkation:
          type:
            - string
            - 'null'
        cruiseDisembarkation:
          type:
            - string
            - 'null'
        cruiseDuration:
          type:
            - string
            - 'null'
        cabinName:
          type:
            - string
            - 'null'
        cabinNumber:
          type:
            - string
            - 'null'
        cabinCategory:
          type:
            - string
            - 'null'
        bedType:
          type:
            - string
            - 'null'
        boardBasis:
          type:
            - string
            - 'null'
        diningRequest:
          type:
            - string
            - 'null'
        passengers:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Passenger'
        numberOfPassengers:
          type:
            - string
            - 'null'
        leadName:
          type:
            - string
            - 'null'
        flights:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Flight'
        trains:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Train'
        transfers:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Transfer'
        holidayStartDate:
          type:
            - string
            - 'null'
        holidayEndDate:
          type:
            - string
            - 'null'
        holidayDuration:
          type:
            - string
            - 'null'
        includesCarHire:
          type:
            - boolean
            - 'null'
        includesCarParking:
          type:
            - boolean
            - 'null'
        resort:
          type:
            - string
            - 'null'
        accommodation:
          type:
            - string
            - 'null'
        includesTransfer:
          type:
            - boolean
            - 'null'
        eventPackages:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/EventPackage'
        skiArea:
          type:
            - string
            - 'null'
        skiExtras:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/SkiExtra'
        skiCarriages:
          type:
            - integer
            - 'null'
    MatchResult:
      type: object
      description: >-
        The outcome of matching the document against the agent's own booking
        data sources. The agent looks only in the sources connected to it.
      properties:
        matched:
          type: boolean
        decision:
          type: string
          enum:
            - auto
            - review
            - none
          description: >-
            `auto` = confident auto-match, `review` = suggested match needs a
            human, `none` = no match.
        confidence:
          type:
            - number
            - 'null'
          description: Match confidence between 0 and 1.
        bookingReference:
          type:
            - string
            - 'null'
        bookingId:
          type:
            - string
            - 'null'
          description: >-
            The matched booking's own ID (its `bookingId` in your booking data),
            or null when there is no match or the booking data doesn't carry
            one.
        reason:
          type:
            - string
            - 'null'
        fields:
          type: array
          description: >-
            Field-by-field comparison between the invoice and the matched
            booking. Each entry has `field` (the public field name, e.g.
            `totalCost`), `tier`, `status` (`match`, `mismatch` or `missing`),
            `invoice`, `booking`, `normalisedInvoice`, `normalisedBooking` and
            `note`.
          items:
            type: object
            additionalProperties: true
    RunFile:
      type: object
      description: >-
        A file returned with the result, either as a time-limited link (`url`
        and `expiresAt`) or inline (`contentBase64`), by the agent's setting.
      required:
        - role
        - fileName
        - contentType
        - sizeBytes
      properties:
        role:
          type: string
          enum:
            - original
          description: '`original`: the document the call sent.'
        fileName:
          type: string
          example: invoice.pdf
        contentType:
          type: string
          example: application/pdf
        sizeBytes:
          type: integer
          example: 48213
        url:
          type: string
          format: uri
          description: >-
            A link the file can be downloaded from, with no further
            authentication, until `expiresAt`.
        expiresAt:
          type: string
          format: date-time
          description: When `url` stops working.
        contentBase64:
          type: string
          description: The file's bytes, base64 encoded.
    Passenger:
      type: object
      properties:
        title:
          type:
            - string
            - 'null'
        firstName:
          type:
            - string
            - 'null'
        middleName:
          type:
            - string
            - 'null'
        lastName:
          type:
            - string
            - 'null'
        fullName:
          type:
            - string
            - 'null'
    Flight:
      type: object
      properties:
        flightNumber:
          type:
            - string
            - 'null'
        outboundAirport:
          type:
            - string
            - 'null'
        outboundDepartureDateTime:
          type:
            - string
            - 'null'
        inboundAirport:
          type:
            - string
            - 'null'
        inboundArrivalDateTime:
          type:
            - string
            - 'null'
    Train:
      type: object
      properties:
        departureStation:
          type:
            - string
            - 'null'
        departureTime:
          type:
            - string
            - 'null'
        arrivalStation:
          type:
            - string
            - 'null'
        arrivalTime:
          type:
            - string
            - 'null'
        ticketType:
          type:
            - string
            - 'null'
    Transfer:
      type: object
      properties:
        transferFrom:
          type:
            - string
            - 'null'
        transferTo:
          type:
            - string
            - 'null'
        transferType:
          type:
            - string
            - 'null'
        vehicleType:
          type:
            - string
            - 'null'
        numberOfPassengers:
          type:
            - number
            - 'null'
    EventPackage:
      type: object
      properties:
        hotelName:
          type:
            - string
            - 'null'
        roomType:
          type:
            - string
            - 'null'
        mealDetail:
          type:
            - string
            - 'null'
        arrivalDate:
          type:
            - string
            - 'null'
        departureDate:
          type:
            - string
            - 'null'
        nights:
          type:
            - number
            - 'null'
        noOfGuestsAdults:
          type:
            - number
            - 'null'
        noOfGuestsChildren:
          type:
            - number
            - 'null'
        ticketDescription:
          type:
            - string
            - 'null'
        durationDays:
          type:
            - number
            - 'null'
        validFor:
          type:
            - string
            - 'null'
        carParkingIncluded:
          type:
            - boolean
            - 'null'
        pricing:
          type:
            - number
            - 'null'
        currency:
          type:
            - string
            - 'null'
    SkiExtra:
      type: object
      properties:
        item:
          type:
            - string
            - 'null'
        quantity:
          type:
            - number
            - 'null'
        price:
          type:
            - number
            - 'null'
        name:
          type:
            - string
            - 'null'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A workspace API key, sent as `Authorization: Bearer ip_live_…`. Create
        and revoke keys in the equate dashboard under Settings → API keys
        (workspace admins only). The full key is shown once at creation — store
        it securely.

````

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