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

# Create a mass payment instruction

Submit mass payment request in async mode. Requires either a sell currency or existing trade ID to create the instruction

Note that within a mass payment instruction it is not possible to use different sell currencies per payment.

> [!WARNING]
>
> Please note that if a trade ID is being passed in the request, the payments in a mass payment instruction must be of the same BUY currency.


## OpenAPI

````yaml /openapi/ebury-api-public.json post /mass-payments
openapi: 3.0.0
info:
  description: |
    Ebury API allows customers:
      to retrieve accounts, balances, beneficiaries, and transactions;
      to get buy/sell estimates and quotes, book trades and retrieve trade history;
      to allocate payments to a trade and beneficiary, and to submit payments in bulk;
      to download documents such as trade receipt, payment instruction and payment receipt;
      to manage the authorised persons on their account.
    The Metadata API allows applications to clarify some parts of the Ebury API
      that are impractical to express schematically.
  termsOfService: https://docs.ebury.io/#terms-of-use
  title: Ebury API
  version: '0.1'
servers:
  - url: https://api.ebury.io
    description: Production
  - url: https://api.ebury.builders
    description: Sandbox
security: []
paths:
  /mass-payments:
    post:
      tags:
        - Mass Payments
      summary: Create a mass payment instruction
      description: >-
        Submit mass payment request in async mode. Requires either a sell
        currency or existing trade ID to create the instruction
      parameters:
        - $ref: '#/components/parameters/ClientId'
        - $ref: '#/components/parameters/Authorization'
        - description: VoP authorization ID to confirm not full-match payment
          in: query
          name: vop_authorization_id
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewMassPayment'
        description: Request Payload
        required: true
      responses:
        '202':
          description: Masspayment request accepted, see response body for status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MassPaymentResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/ClientNotFound'
        '422':
          description: >-
            VoP check failed, provided `vop_authorization_id` is not valid, or
            purpose of payment validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '502':
          $ref: '#/components/responses/IntegrationError'
components:
  parameters:
    ClientId:
      description: The identifier of a client.
      in: query
      name: client_id
      required: true
      schema:
        type: string
    Authorization:
      description: The access token.
      in: header
      name: Authorization
      required: true
      schema:
        type: string
  schemas:
    NewMassPayment:
      required:
        - auto_commit
        - payment_instructions
      type: object
      properties:
        external_reference_id:
          description: >-
            The external reference: unique ID supplied by customer which can be
            used later to filter.
          type: string
          default: ''
        auto_commit:
          description: >-
            If true, send successful instructions for payment. If false, hold
            until customer hits commit endpoint.
          type: boolean
        sell_currency:
          description: If `trade_id` omitted, `sell_currency` must be supplied.
          type: string
          pattern: ^[A-Z]{3}$
        trade_id:
          description: >-
            Trade ID to book payments against. If customer wants the trade to be
            auto booked then this parameter should not be supplied.
          type: string
        payment_instructions:
          description: Array of multiple payment instruction given by the customer.
          type: array
          items:
            $ref: '#/components/schemas/NewMultiPaymentItem'
    MassPaymentResponse:
      properties:
        mass_payment_id:
          description: The UUID of the MassPayment just created
          type: string
          format: uuid
        external_reference_id:
          description: The external reference for the MassPayment, if supplied
          type: string
        mass_payment_status:
          $ref: '#/components/schemas/EnumMassPaymentStatus'
    ErrorMessage:
      description: An error message.
      properties:
        code:
          type: string
          description: The code for the error.
        details:
          description: Error details
          type: string
        message:
          type: string
          description: A short description of the cause of the error.
      required:
        - code
        - message
        - details
      type: object
    NewMultiPaymentItem:
      description: >-
        A payment instruction. Identify the beneficiary either with `account_id`
        and `beneficiary_id` of an existing beneficiary, or with the full bank
        details (`account_number`, `bank_address`, `bank_code`, `bank_country`,
        `bank_name`, `beneficiary_country`, `beneficiary_name`, `iban`,
        `swift_code`, plus `beneficiary_address` when structured address fields
        are not used). The two options are mutually exclusive. Exactly one of
        `payment_reference` or `reference` (deprecated) must be supplied.
      required:
        - direction
        - payment_amount
        - payment_currency
        - reason_for_trade
        - trade_type
        - value_date
      properties:
        account_id:
          description: >-
            The ID of an existing beneficiary bank account. Required together
            with `beneficiary_id` when bank details are not supplied
          type: string
          pattern: .*[0-9].*
        beneficiary_id:
          description: >-
            The ID of an existing beneficiary. Required together with
            `account_id` when bank details are not supplied
          type: string
          minLength: 1
        account_number:
          description: Destination account number
          type: string
          nullable: true
        bank_address:
          description: Destination bank address
          type: string
          nullable: true
        bank_code:
          description: Destination bank code
          type: string
          nullable: true
        bank_country:
          description: Destination bank country
          type: string
          minLength: 1
        bank_name:
          description: Destination bank name
          type: string
          nullable: true
        beneficiary_address:
          description: Address of beneficiary
          type: string
          nullable: true
        beneficiary_name:
          description: Name of beneficiary
          type: string
          minLength: 1
          nullable: true
        beneficiary_country:
          description: Country of beneficiary
          type: string
          nullable: true
        direction:
          description: Type of payment, 'buy' or 'sell'
          type: string
          enum:
            - buy
            - sell
        iban:
          description: IBAN of the destination account
          type: string
          nullable: true
        payment_currency:
          description: Destination currency
          type: string
          minLength: 1
        payment_amount:
          description: Amount to be paid
          type: number
          format: float
          minimum: 0
        reason_for_trade:
          description: Reason for trade
          type: string
          nullable: true
        payment_reference:
          description: Reference of payment
          type: string
          nullable: true
        swift_code:
          description: SWIFT code of destination bank
          type: string
          nullable: true
        trade_type:
          description: Type of trade. 'spot' is the only supported value at the moment
          type: string
          enum:
            - spot
        value_date:
          description: Date when the transaction will be performed
          type: string
          nullable: true
        beneficiary_reference:
          description: Reference of beneficiary
          type: string
          nullable: true
        purpose_of_payment:
          description: Text describing the purpose of the payment
          type: string
          nullable: true
        reference:
          description: Payment reference. Deprecated, use `payment_reference`
          type: string
          nullable: true
          deprecated: true
        inn:
          description: The INN of the bank account
          type: string
          pattern: ^[0-9]{10}([0-9]{2})?$
          nullable: true
        vo:
          description: The VO of the bank account
          type: string
          nullable: true
        kio:
          description: The KIO of the bank account
          type: string
          nullable: true
        russian_central_bank_account:
          description: Russian central bank account
          type: string
          nullable: true
        external_reference_id:
          description: >-
            External reference for this payment instruction. Maximum 128
            characters
          type: string
          maxLength: 128
          pattern: ^[\sa-zA-Z0-9,\.:'\+\(\)\?\-/]*$
          nullable: true
        beneficiary_street_name:
          description: Street name of the beneficiary address
          type: string
          maxLength: 70
          nullable: true
        beneficiary_building_number:
          description: Building number of the beneficiary address
          type: string
          maxLength: 16
          nullable: true
        beneficiary_floor:
          description: Floor of the beneficiary address
          type: string
          maxLength: 70
          nullable: true
        beneficiary_apartment_office_number:
          description: Apartment or office number of the beneficiary address
          type: string
          maxLength: 70
          nullable: true
        beneficiary_city:
          description: City of the beneficiary address
          type: string
          maxLength: 35
          nullable: true
        beneficiary_state_region:
          description: State or region of the beneficiary address
          type: string
          maxLength: 35
          nullable: true
        beneficiary_post_code:
          description: Post code of the beneficiary address
          type: string
          maxLength: 16
          nullable: true
      type: object
    EnumMassPaymentStatus:
      description: This is an enumeration of the status of a MassPayment
      enum:
        - Queued for processing
        - Processing
        - Processed
        - Queued for creating
        - Creating
        - Created
        - Cancelled
        - Failed
      type: string
  responses:
    ValidationError:
      description: >-
        Formatting, parameter or schema validation error. See error message for
        further details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    Unauthorized:
      description: Access denied due to authentication failure.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    Forbidden:
      description: >-
        Could not complete action due to data constraints. Refer to error
        message for additional details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    ClientNotFound:
      description: Client identifier not found.
    IntegrationError:
      description: Internal integration error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'

````