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

# Create transactions in bulk

> Queues several transactions in one request. Each follows the same rules as a single
transaction, except that `externalId` is optional: when it's left out, Affelios builds one
from the transaction date, `externalCustomerId` and `externalProductId`. Send your own IDs if a
customer can have more than one transaction for the same product on the same day.
            
Every transaction is validated before any are queued. If one fails validation, none are queued.



## OpenAPI

````yaml https://platform.affelios.com/swagger/v1/swagger.json post /api/v1/transaction/bulk
openapi: 3.0.4
info:
  title: Affelios Platform API
  description: >-
    Send customers and transactions to Affelios, and read your affiliate
    program's data. Authenticate every request with an API key in the X-Api-Key
    header. Create keys in the dashboard under Settings > API keys.
  version: v1
servers:
  - url: https://platform.affelios.com
security:
  - ApiKey: []
tags:
  - name: Affiliates
    description: >-
      Affiliate accounts in your program, their collaborators and their
      commission plan assignments.
  - name: Customers
    description: >-
      Customers referred by affiliates. Create a customer with the click key
      from the landing page to credit the affiliate who referred them.
  - name: Mcp Connection
  - name: Testimonials
    description: Affiliate testimonials and the published list shown on public pages.
  - name: Transactions
    description: >-
      Customer activity such as deposits, revenue and wagering. Commission is
      calculated from transactions.
paths:
  /api/v1/transaction/bulk:
    post:
      tags:
        - Transactions
      summary: Create transactions in bulk
      description: >-
        Queues several transactions in one request. Each follows the same rules
        as a single

        transaction, except that `externalId` is optional: when it's left out,
        Affelios builds one

        from the transaction date, `externalCustomerId` and `externalProductId`.
        Send your own IDs if a

        customer can have more than one transaction for the same product on the
        same day.
                    
        Every transaction is validated before any are queued. If one fails
        validation, none are queued.
      operationId: TransactionBulkPost
      requestBody:
        description: The transactions to create.
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/TransactionBody'
      responses:
        '202':
          description: The transactions were queued for processing.
        '400':
          description: >-
            The list is empty, or a transaction failed validation. The response
            body gives the first error.
        '401':
          description: The X-Api-Key header is missing or the key is not valid.
        '403':
          description: The API key is valid but does not have permission for this endpoint.
components:
  schemas:
    TransactionBody:
      type: object
      properties:
        externalId:
          type: string
          description: >-
            Your unique ID for the transaction. Required for a single `Sale`;
            optional in bulk requests.
          nullable: true
        type:
          type: string
          description: >-
            One of `Sale`, `Adjustment`, `Payout` or `SubAffiliate`. Use `Sale`
            for customer activity and `Adjustment` to change an affiliate's
            commission directly.
          nullable: true
        affiliateId:
          type: string
          description: The Affelios ID of the affiliate. Used by `Adjustment` transactions.
          nullable: true
        clickKey:
          type: string
          description: >-
            The click key the customer arrived with. Use this or
            `externalCustomerId` to identify the customer.
          nullable: true
        externalCustomerId:
          type: string
          description: >-
            Your ID for the customer, as sent when you created them. Use this or
            `clickKey`.
          nullable: true
        externalBrandId:
          type: string
          description: The External ID of the brand, as set on the brand in Affelios.
          nullable: true
        externalProductId:
          type: string
          description: The External ID of the product, if the transaction belongs to one.
          nullable: true
        transactionDate:
          type: string
          description: When the activity happened, in UTC.
          format: date-time
        country:
          type: string
          description: The customer's country name.
          nullable: true
        country_code:
          type: string
          description: The customer's country as an ISO country code, for example `GB`.
          nullable: true
        depositAmount:
          type: number
          description: Amount deposited.
          format: double
        grossRevenue:
          type: number
          description: >-
            Gross revenue, such as gross gaming revenue or the sale value. Can
            be negative.
          format: double
        wageredAmount:
          type: number
          description: Amount wagered (turnover).
          format: double
        revShareCommission:
          type: number
          description: Revenue share commission to add or remove. `Adjustment` only.
          format: double
        cpaCommission:
          type: number
          description: CPA commission to add or remove. `Adjustment` only.
          format: double
        fixedCommission:
          type: number
          description: Fixed commission to add or remove. `Adjustment` only.
          format: double
        category:
          type: string
          description: A category for your own reporting.
          nullable: true
        label:
          type: string
          description: A label for your own reporting.
          nullable: true
        note:
          type: string
          description: A note, for example the reason for an adjustment.
          nullable: true
        operatorId:
          type: string
          description: >-
            Not needed when you authenticate with an API key: your program is
            taken from the key.
          nullable: true
      additionalProperties: false
      description: A customer transaction, or an adjustment to an affiliate's commission.
  securitySchemes:
    ApiKey:
      type: apiKey
      description: >-
        Your Affelios API key. Create one in the dashboard under Settings > API
        keys.
      name: X-Api-Key
      in: header

````

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