POST
/
v1
/
allocations
Create Portfolio Allocations
curl --request POST \
  --url https://api.prime.coinbase.com/v1/allocations \
  --header 'Content-Type: application/json' \
  --data '{
  "allocation_id": "<string>",
  "source_portfolio_id": "<string>",
  "product_id": "<string>",
  "order_ids": [
    "<string>"
  ],
  "allocation_legs": [
    {
      "allocation_leg_id": "<string>",
      "destination_portfolio_id": "<string>",
      "amount": "<string>"
    }
  ],
  "size_type": "BASE",
  "remainder_destination_portfolio": "<string>"
}'
{
  "body": {
    "success": true,
    "allocation_id": "<string>",
    "failure_reason": "<string>"
  }
}
Use the Prime SDK or CLI to test this endpoint by following the quickstart guide and running with the following examples
AllocationsService allocationsService = PrimeServiceFactory.createAllocationsService(client);

String allocationId = UUID.randomUUID().toString();
String allocationLegId = UUID.randomUUID().toString();

AllocationLeg allocationLeg = new AllocationLeg.Builder()
        .allocationLegId(allocationLegId)
        .amount("100")
        .destinationPortfolioId("DESTINATION_PORTFOLIO_ID_HERE")
        .build();

CreateAllocationRequest request = new CreateAllocationRequest.Builder()
        .sourcePortfolioId("SOURCE_PORTFOLIO_ID_HERE")
        .allocationId(allocationId)
        .allocationLegs(new AllocationLeg[]{allocationLeg})
        .productId("ETH-USD")
        .build();

CreateAllocationResponse response = allocationsService.createAllocation(request);
For more information, please visit the Prime Java SDK.

Body

application/json
allocation_id
string

The ID of the allocation

source_portfolio_id
string

The source portfolio id for the allocation

product_id
string

The product for the allocation

order_ids
string[]

The list of order ids in the allocation

allocation_legs
object[]

The list of allocation_legs for the allocation

size_type
enum<string>
Available options:
BASE,
QUOTE,
PERCENT
remainder_destination_portfolio
string

The portfolio where to allocate the remainder of the size

Response

200 - application/json

A successful response.

body
object