> ## 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 Activity by Activity ID

> Retrieve an activity by its activity ID

Use the Prime SDK or CLI to test this endpoint by following the [quickstart](/prime/introduction/quickstart) guide and running with the following examples

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    ActivitiesService activitiesService = PrimeServiceFactory.createActivitiesService(client);
    GetActivityByActivityIdRequest request = new GetActivityByActivityIdRequest("portfolio_id", "activity_id");
    GetActivityByActivityIdResponse response = activitiesService.getActivityByActivityId(request);
    ```

    For more information, please visit the [Prime Java SDK](https://github.com/coinbase-samples/prime-sdk-java).
  </Tab>

  <Tab title=".NET">
    ```csharp wrap theme={null}
    var activitiesService = new ActivitiesService(client);

    var request = new GetActivityByActivityIdRequest("portfolio_id", "activity_id");

    var response = activitiesService.GetActivityByActivityId(request);
    ```

    For more information, please visit the [Prime .NET SDK](https://github.com/coinbase-samples/prime-sdk-dotnet).
  </Tab>

  <Tab title="Go">
    ```go wrap theme={null}
    activitiesService := activities.NewActivitiesService(client)

    request := &activities.GetActivityRequest{
        PortfolioId: "portfolio-id",
        Id:          "activity-id",
    }

    response, err := activitiesService.GetActivity(context.Background(), request)
    ```

    For more information, please visit the [Prime Go SDK](https://github.com/coinbase-samples/prime-sdk-go).
  </Tab>

  <Tab title="Python">
    ```python wrap theme={null}
    prime_client = PrimeClient(credentials)

    request = GetActivityRequest(
        portfolio_id="portfolio-id",
        activity_id="activity-id",
    )

    response = prime_client.get_activity(request)ty(request)
    ```

    For more information, please visit the [Prime Python SDK](https://github.com/coinbase-samples/prime-sdk-py).
  </Tab>

  <Tab title="CLI">
    ```bash wrap theme={null}
    primectl get-activity --help
    ```

    For more information, please visit the [Prime CLI](https://github.com/coinbase-samples/prime-cli).
  </Tab>

  <Tab title="TS/JS">
    ```typescript wrap theme={null}
    const activitiesService = new ActivitiesService(client);

    activitiesService.getPortfolioActivity({
        portfolioId: 'PORTFOLIO_ID_HERE',
        activityId: 'ACTIVITY_ID_HERE'
    }).then(async (response) => {
        console.log('Activity: ', response);
    })
    ```

    For more information, please visit the [Prime TS SDK](https://github.com/coinbase-samples/prime-sdk-ts).
  </Tab>
</Tabs>


## OpenAPI

````yaml GET /v1/portfolios/{portfolio_id}/activities/{activity_id}
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}/activities/{activity_id}:
    get:
      tags:
        - Activities
      summary: Get Portfolio Activity by Activity ID
      description: Retrieve an activity by its activity ID
      operationId: PrimeRESTAPI_GetPortfolioActivity
      parameters:
        - name: portfolio_id
          in: path
          description: Portfolio to retrieve activity for.
          required: true
          schema:
            type: string
        - name: activity_id
          in: path
          description: Id of the activity to retrieve
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_rest_api.GetPortfolioActivityResponse
components:
  schemas:
    coinbase.public_rest_api.GetPortfolioActivityResponse:
      required:
        - activity
      type: object
      properties:
        activity:
          $ref: '#/components/schemas/coinbase.public_rest_api.Activity'
    coinbase.public_rest_api.Activity:
      type: object
      properties:
        id:
          type: string
          description: A unique id for the account activity
        reference_id:
          type: string
          description: >-
            A reference for orders and transactions, n/a for other category
            types
        category:
          $ref: '#/components/schemas/coinbase.public_rest_api.ActivityCategory'
        type:
          $ref: '#/components/schemas/coinbase.public_rest_api.ActivityType'
        secondary_type:
          $ref: '#/components/schemas/coinbase.public_rest_api.ActivitySecondaryType'
        status:
          $ref: '#/components/schemas/coinbase.public_rest_api.ActivityStatus'
        created_by:
          type: string
          description: Id of user who created the activity
        title:
          type: string
          description: Title of the activity
        description:
          type: string
          description: Description detail of the activity
        user_actions:
          type: array
          description: Actions related to the Activity
          items:
            $ref: '#/components/schemas/coinbase.public_rest_api.UserAction'
        transactions_metadata:
          $ref: >-
            #/components/schemas/coinbase.public_rest_api.ActivityMetadataTransactions
        account_metadata:
          $ref: >-
            #/components/schemas/coinbase.public_rest_api.ActivityMetadataAccount
        orders_metadata:
          $ref: '#/components/schemas/coinbase.public_rest_api.ActivityMetadataOrders'
        symbols:
          type: array
          description: List of currencies included in an activity
          items:
            type: string
        created_at:
          type: string
          description: Time activity was created at
        updated_at:
          type: string
          description: Time for latest status update of account activity
        hierarchy_type:
          $ref: '#/components/schemas/coinbase.public_rest_api.HierarchyType'
    coinbase.public_rest_api.ActivityCategory:
      type: string
      default: OTHER_ACTIVITY_CATEGORY
      enum:
        - OTHER_ACTIVITY_CATEGORY
        - ACTIVITY_CATEGORY_ORDER
        - ACTIVITY_CATEGORY_TRANSACTION
        - ACTIVITY_CATEGORY_ACCOUNT
        - ACTIVITY_CATEGORY_ALLOCATION
        - ACTIVITY_CATEGORY_LENDING
    coinbase.public_rest_api.ActivityType:
      type: string
      default: OTHER_ACTIVITY_TYPE
      enum:
        - OTHER_ACTIVITY_TYPE
        - ACTIVITY_TYPE_LIMIT_ORDER
        - ACTIVITY_TYPE_MARKET_ORDER
        - ACTIVITY_TYPE_TWAP_ORDER
        - ACTIVITY_TYPE_BLOCK_TRADE
        - ACTIVITY_TYPE_VWAP_ORDER
        - ACTIVITY_TYPE_STOP_LIMIT_ORDER
        - ACTIVITY_TYPE_DEPOSIT
        - ACTIVITY_TYPE_WITHDRAWAL
        - ACTIVITY_TYPE_INTERNAL_TRANSFER
        - ACTIVITY_TYPE_CREATE_WALLET
        - ACTIVITY_TYPE_REMOVE_WALLET
        - ACTIVITY_TYPE_UPDATE_WALLET
        - ACTIVITY_TYPE_CAST_VOTE
        - ACTIVITY_TYPE_ENABLE_VOTING
        - ACTIVITY_TYPE_STAKE
        - ACTIVITY_TYPE_UNSTAKE
        - ACTIVITY_TYPE_CHANGE_VALIDATOR
        - ACTIVITY_TYPE_RESTAKE
        - ACTIVITY_TYPE_ADDRESS_BOOK
        - ACTIVITY_TYPE_TEAM_MEMBERS
        - ACTIVITY_TYPE_BILLING
        - ACTIVITY_TYPE_SECURITY
        - ACTIVITY_TYPE_API
        - ACTIVITY_TYPE_SETTINGS
        - ACTIVITY_TYPE_SMART_CONTRACT
        - ACTIVITY_TYPE_ALLOCATION_IN
        - ACTIVITY_TYPE_ALLOCATION_OUT
        - ACTIVITY_TYPE_ALLOCATION_IN_REVERSAL
        - ACTIVITY_TYPE_ALLOCATION_OUT_REVERSAL
        - ACTIVITY_TYPE_CONVERSION
        - ACTIVITY_TYPE_PRINCIPAL_OUT
        - ACTIVITY_TYPE_PRINCIPAL_IN
        - ACTIVITY_TYPE_COLLATERAL_OUT
        - ACTIVITY_TYPE_COLLATERAL_IN
        - ACTIVITY_TYPE_INTEREST_OUT
        - ACTIVITY_TYPE_INTEREST_IN
        - ACTIVITY_TYPE_WEB3_MESSAGE
        - ACTIVITY_TYPE_WEB3_TRANSACTION
        - ACTIVITY_TYPE_WEB3_DEVICE_RECOVERY
        - ACTIVITY_TYPE_WEB3_RECREATE_BACKUP
        - ACTIVITY_TYPE_WEB3_ONBOARDING
    coinbase.public_rest_api.ActivitySecondaryType:
      title: |-
        - ACTIVITY_SECONDARY_TYPE_BUY: Order secondary types
         - ACTIVITY_SECONDARY_TYPE_INTERNAL_TRANSFER: Transaction secondary types
         - ACTIVITY_SECONDARY_TYPE_WEB3_SIGNER: Onchain secondary types
      type: string
      default: NO_SECONDARY_TYPE
      enum:
        - NO_SECONDARY_TYPE
        - ACTIVITY_SECONDARY_TYPE_BUY
        - ACTIVITY_SECONDARY_TYPE_SELL
        - ACTIVITY_SECONDARY_TYPE_INTERNAL_TRANSFER
        - ACTIVITY_SECONDARY_TYPE_SWEEP_TRANSFER_TYPE
        - ACTIVITY_SECONDARY_TYPE_WEB3_SIGNER
        - ACTIVITY_SECONDARY_TYPE_WEB3_WALLET
    coinbase.public_rest_api.ActivityStatus:
      type: string
      default: OTHER_ACTIVITY_STATUS
      enum:
        - OTHER_ACTIVITY_STATUS
        - ACTIVITY_STATUS_CANCELLED
        - ACTIVITY_STATUS_PROCESSING
        - ACTIVITY_STATUS_COMPLETED
        - ACTIVITY_STATUS_EXPIRED
        - ACTIVITY_STATUS_REJECTED
        - ACTIVITY_STATUS_FAILED
    coinbase.public_rest_api.UserAction:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/coinbase.public_rest_api.Action'
        user_id:
          type: string
          description: Id of the user who executed the action
        timestamp:
          type: string
          description: Time the action was taken
    coinbase.public_rest_api.ActivityMetadataTransactions:
      type: object
      properties:
        consensus:
          $ref: >-
            #/components/schemas/coinbase.public_rest_api.ActivityMetadataConsensus
    coinbase.public_rest_api.ActivityMetadataAccount:
      type: object
      properties:
        consensus:
          $ref: >-
            #/components/schemas/coinbase.public_rest_api.ActivityMetadataConsensus
    coinbase.public_rest_api.ActivityMetadataOrders:
      type: object
    coinbase.public_rest_api.HierarchyType:
      title: >-
        HierarchyType are the enums for various hierarchies within Prime, ex
        Entity, Organization, Portfolio
      type: string
      default: HIERARCHY_TYPE_UNSPECIFIED
      enum:
        - HIERARCHY_TYPE_UNSPECIFIED
        - HIERARCHY_TYPE_PORTFOLIO
        - HIERARCHY_TYPE_ENTITY
    coinbase.public_rest_api.Action:
      title: Action is the available user action types
      type: string
      default: OTHER_ACTION
      enum:
        - OTHER_ACTION
        - ACTION_APPROVE
        - ACTION_REJECT
        - ACTION_INITIATE
        - ACTION_CANCEL
    coinbase.public_rest_api.ActivityMetadataConsensus:
      type: object
      properties:
        approval_deadline:
          type: string
          description: Deadline for approval of an activity
        has_passed_consensus:
          type: boolean
          description: If activity has passed consensus threshold

````