# Allocate trade

Divide a trade into post-trade allocations among multiple legal entities of the same organization. Available to broker users and sales dealer users. Customer organizations can be configured to allocate trades.

You must ensure that the allocated amounts equal the original trade amount.

Endpoint: POST /v2/trades/allocations
Version: 1.0.1
Security: SSO_TOKEN

## Security:

  - `SSO_TOKEN` (unknown)
    apiKey in header SSO_TOKEN

## Request fields (application/json):

  - `id` (string, required)
    ID of the verified trade to divide into allocations.

  - `allocations` (array, required)

  - `allocations.referenceId` (string, required)
    Your reference ID for the allocation. Must be unique in the scope of the allocate request. Not validated for global uniqueness.

  - `allocations.allocationAmount` (number, required)
    Size of the allocation.

  - `allocations.side` (string, required)
    The direction of the allocation from the perspective of the `customerAccount` (case sensitive):
* BUY
* SELL

  - `allocations.customerAccount` (string, required)
    The customer account of the allocation.

  - `allocations.note` (string)
    Any notes on the allocation. These notes are sent via STP if the trade is eligible for STP (stp=true).

## Request examples:

  - `Allocate a trade` (unknown)
    Divide a trade amongst multiple organizations.

## Response 200:

  - `200` (unknown)
    Original trade ID and allocation IDs.

## Response 200 fields (application/json):

  - `originalTradeId` (string)
    ID of the original trade that was amended.

  - `trades` (array)

  - `trades.referenceId` (string)
    Your reference ID for the allocation.

  - `trades.tradeId` (string)
    ID of the allocation.

## Response 400:

  - `400` (unknown)
    * `invalid_id`: trade ID not present in the system or a trade in a state that cannot be allocated.
* `invalid_note`: empty, null, or longer than the max length.
* `invalid_referenceId`: empty, null, or outside min/max length.
* `invalid_allocationAmount`: empty, invalid, or total allocated amounts don't equal the original trade amount.
* `invalid_customerAccount`: empty or not found in the system.
* `invalid_side`: empty or not `BUY` or `SELL`.
* `malformed_request`: request or properties not formatted correctly (for example, amount properties contain other than numeric values).

## Response 401:

  - `401` (unknown)
    Unauthorized.

