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

# Get Portfolio Allocations

> List historical allocations for a given portfolio.



## OpenAPI

````yaml GET  /v1/portfolios/{portfolio_id}/allocations
openapi: 3.0.1
info:
  title: REST API
  description: >-
    The Coinbase Prime REST API provides programmatic access to trading,
    custody, staking, market data, and account management functionality.
  version: '0.1'
servers:
  - url: https://api.prime.coinbase.com/
security: []
tags:
  - name: PrimeRESTAPI
paths:
  /v1/portfolios/{portfolio_id}/allocations:
    get:
      tags:
        - Allocations
      summary: List Portfolio Allocations
      description: List historical allocations for a given portfolio.
      operationId: PrimeRESTAPI_GetPortfolioAllocations
      parameters:
        - name: portfolio_id
          in: path
          description: Portfolio to retrieve allocations for.
          required: true
          schema:
            type: string
        - name: product_ids
          in: query
          description: List of products by which to filter the response.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: order_side
          in: query
          description: |-
            An order side to filter allocations on.

             - UNKNOWN_ORDER_SIDE: nil value
             - BUY: Buy order
             - SELL: Sell order
          schema:
            type: string
            enum:
              - BUY
              - SELL
        - name: start_date
          in: query
          description: A start date for the allocations to be queried from.
          required: true
          schema:
            type: string
            format: date-time
        - name: end_date
          in: query
          description: An end date for the orders to be queried from.
          schema:
            type: string
            format: date-time
        - name: cursor
          in: query
          description: Id to retrieve additional results strictly after
          schema:
            type: string
        - name: limit
          in: query
          description: Number of items to retrieve
          schema:
            type: integer
            format: int32
        - name: sort_direction
          in: query
          description: 'Sorting order: DESC or ASC'
          schema:
            type: string
            default: DESC
            enum:
              - DESC
              - ASC
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_rest_api.GetPortfolioAllocationsResponse
components:
  schemas:
    coinbase.public_rest_api.GetPortfolioAllocationsResponse:
      type: object
      properties:
        allocations:
          type: array
          description: List of allocations.
          items:
            $ref: '#/components/schemas/coinbase.public_rest_api.Allocation'
        pagination:
          $ref: '#/components/schemas/coinbase.public_rest_api.PaginatedResponse'
    coinbase.public_rest_api.Allocation:
      type: object
      properties:
        root_id:
          type: string
          description: The ID that ties together an allocation and all of its legs.
        reversal_id:
          type: string
          description: >-
            The ID of the allocation if this allocation is a reversal. In this
            case, the root_id would be the original allocation ID.
        allocation_completed_at:
          type: string
          description: Time the final leg of the root allocation was completed.
          format: date-time
        user_id:
          type: string
          description: The ID of the user that created the allocation.
        product_id:
          type: string
          description: The ID of the product of the orders allocated.
        side:
          $ref: '#/components/schemas/coinbase.public_rest_api.OrderSide'
        avg_price:
          type: string
          description: Price the allocation was done at.
        base_quantity:
          type: string
          description: Amount allocated in base asset units.
        quote_value:
          type: string
          description: Amount allocated in quote asset units.
        fees_allocated:
          type: string
          description: Fees from original trade execution allocated in quote asset units.
        status:
          $ref: '#/components/schemas/coinbase.public_rest_api.AllocationStatus'
        source:
          type: string
          description: Portfolio ID of the source portfolio.
        order_ids:
          title: slice
          type: array
          description: >-
            All order IDs that were aggregated to calculate the avg_price,
            quantity to allocate in each leg. Each order_id should tie back to
            the single allocation root_id.
          items:
            type: string
        destinations:
          type: array
          description: >-
            Array of objects, each containing the leg ID, destination portfolio
            ID and amount in chosen units allocated to each portfolio: [{leg_id,
            portfolio_id, allocation_base, allocation_quote}, {leg_id,
            portfolio_id, allocation_base, allocation_quote}...]
          items:
            $ref: '#/components/schemas/coinbase.public_rest_api.DestinationAlloc'
        netting_id:
          type: string
          description: >-
            The netting ID of the allocation, not empty if the allocation was
            submitted as part of a net allocation
    coinbase.public_rest_api.PaginatedResponse:
      required:
        - has_next
        - next_cursor
        - sort_direction
      type: object
      properties:
        next_cursor:
          type: string
          description: Cursor to navigate to next page
        sort_direction:
          $ref: '#/components/schemas/coinbase.public_rest_api.SortDirection'
        has_next:
          type: boolean
          description: >-
            A boolean value indicating whether there are more items to paginate
            through
    coinbase.public_rest_api.OrderSide:
      title: Order side
      type: string
      description: |-
        - UNKNOWN_ORDER_SIDE: nil value
         - BUY: Buy order
         - SELL: Sell order
      enum:
        - BUY
        - SELL
    coinbase.public_rest_api.AllocationStatus:
      type: string
      default: ALLOCATION_STATUS_UNSPECIFIED
      enum:
        - ALLOCATION_STATUS_UNSPECIFIED
        - ALLOCATION_STATUS_ALLOCATION_PENDING
        - ALLOCATION_STATUS_ALLOCATION_ACCEPTED
        - ALLOCATION_STATUS_ALLOCATION_ALLOCATED
        - ALLOCATION_STATUS_ALLOCATION_REJECTED
    coinbase.public_rest_api.DestinationAlloc:
      type: object
      properties:
        leg_id:
          type: string
          description: The ID unique to each leg of an allocation.
        portfolio_id:
          type: string
          description: Portfolio ID of the source portfolio.
        allocation_base:
          type: string
          description: Amount allocated in base asset units.
        allocation_quote:
          type: string
          description: Amount allocated in quote asset units.
        fees_allocated_leg:
          type: string
          description: >-
            Pro rata fees for each leg. Adding up the fees for each leg will sum
            up to equal the total allocation level fees.
    coinbase.public_rest_api.SortDirection:
      type: string
      default: DESC
      enum:
        - DESC
        - ASC

````