Activity Log

The Activity Log API provides a comprehensive audit trail of all portfolio activities. Track orders, corporate actions, margin activity, and more with detailed filtering and statistics.

Overview

The Activity Log system records all significant events in your portfolios, providing transparency and helping you track performance, compliance, and trading history. Activities are immutable once created and include detailed metadata for comprehensive record-keeping.

API Endpoints Overview

EndpointMethodDescription
/v1/activity-log/portfolio/:portfolioId
GETGet activity log for a specific portfolio
/v1/activity-log/account/:accountId
GETGet activity log for all portfolios in an account
/v1/activity-log/portfolio/:portfolioId/stats
GETGet activity statistics for a portfolio

Get Portfolio Activity Log

Retrieve activity log entries for a specific portfolio with optional filtering.

Path Parameters

NameTypeDescription
portfolioId
StringThe portfolio ID (UUID)

Query Parameters

NameTypeDescription
page
NumberPage number (default: 1)
limit
NumberResults per page (default: 20)
activityType
StringFilter by specific activity type
category
StringFilter by activity category
startDate
DateFilter activities after this date (ISO 8601)
endDate
DateFilter activities before this date (ISO 8601)

Request

GET
/v1/activity-log/portfolio/:portfolioId
curl -X GET "https://api.paperinvest.io/v1/activity-log/portfolio/8b72f1a5-c2e4-48d9-b5a3-1c7e5d3f9e8a?page=1&limit=10&category=TRADING" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response

200 OK
{
  "activities": [
    {
      "activityId": "123e4567-e89b-12d3-a456-426614174000",
      "portfolioId": "8b72f1a5-c2e4-48d9-b5a3-1c7e5d3f9e8a",
      "accountId": "550e8400-e29b-41d4-a716-446655440000",
      "activityType": "ORDER_FILLED",
      "category": "TRADING",
      "impact": "NEGATIVE",
      "title": "Buy Order Filled - AAPL",
      "description": "Market order filled for 100 shares of AAPL at $175.25",
      "symbol": "AAPL",
      "amount": -17525.00,
      "quantity": 100,
      "price": 175.25,
      "relatedOrderId": "456e7890-e89b-12d3-a456-426614174111",
      "createdAt": "2025-01-15T10:32:15.000Z"
    },
    {
      "activityId": "234e5678-e89b-12d3-a456-426614174001",
      "portfolioId": "8b72f1a5-c2e4-48d9-b5a3-1c7e5d3f9e8a",
      "accountId": "550e8400-e29b-41d4-a716-446655440000",
      "activityType": "DIVIDEND_RECEIVED",
      "category": "CORPORATE_ACTION",
      "impact": "POSITIVE",
      "title": "Dividend Received - MSFT",
      "description": "Quarterly dividend payment of $0.75 per share",
      "symbol": "MSFT",
      "amount": 37.50,
      "quantity": 50,
      "price": 0.75,
      "createdAt": "2025-01-10T09:00:00.000Z"
    }
  ],
  "total": 156,
  "page": 1,
  "limit": 10,
  "totalPages": 16
}

Get Account Activity Log

Retrieve activity log entries for all portfolios within an account.

Path Parameters

NameTypeDescription
accountId
StringThe account ID (UUID)

Query Parameters

Same as portfolio endpoint (page, limit, activityType, category).

Request

GET
/v1/activity-log/account/:accountId
curl -X GET "https://api.paperinvest.io/v1/activity-log/account/550e8400-e29b-41d4-a716-446655440000?activityType=CASH_DEPOSIT" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Get Portfolio Activity Statistics

Get aggregated statistics about portfolio activities.

Path Parameters

NameTypeDescription
portfolioId
StringThe portfolio ID (UUID)

Request

GET
/v1/activity-log/portfolio/:portfolioId/stats
curl -X GET https://api.paperinvest.io/v1/activity-log/portfolio/8b72f1a5-c2e4-48d9-b5a3-1c7e5d3f9e8a/stats \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response

200 OK
{
  "totalActivities": 342,
  "activitiesByCategory": {
    "TRADING": 215,
    "CORPORATE_ACTION": 45,
    "PORTFOLIO": 28,
    "MARGIN": 12,
    "JOURNAL": 35,
    "FEES": 7
  },
  "activitiesByImpact": {
    "POSITIVE": 125,
    "NEGATIVE": 189,
    "NEUTRAL": 20,
    "INFORMATIONAL": 8
  },
  "recentActivityCount": 23
}

Activity Types

The system tracks various types of activities across different categories:

Portfolio Management

Activity TypeDescriptionImpact
PORTFOLIO_CREATED
New portfolio createdINFORMATIONAL
PORTFOLIO_RESET
Portfolio reset to initial stateNEUTRAL
CASH_DEPOSIT
Cash deposited to portfolioPOSITIVE
CASH_WITHDRAWAL
Cash withdrawn from portfolioNEGATIVE

Trading Activities

Activity TypeDescriptionImpact
ORDER_PLACED
New order placedINFORMATIONAL
ORDER_FILLED
Order executed successfullyPOSITIVE/NEGATIVE
ORDER_CANCELLED
Order cancelledNEUTRAL
ORDER_REJECTED
Order rejected by systemNEUTRAL
DAY_TRADE_COMPLETED
Day trade round trip completedPOSITIVE/NEGATIVE

Corporate Actions

Activity TypeDescriptionImpact
DIVIDEND_RECEIVED
Cash dividend paymentPOSITIVE
DIVIDEND_REINVESTED
Dividend reinvested in sharesNEUTRAL
STOCK_SPLIT
Stock split executedNEUTRAL
REVERSE_SPLIT
Reverse stock splitNEUTRAL
SPINOFF
Company spinoff shares receivedPOSITIVE
MERGER
Merger or acquisitionNEUTRAL

Margin Activities

Activity TypeDescriptionImpact
MARGIN_LOAN_CREATED
Margin loan initiatedNEGATIVE
MARGIN_INTEREST_ACCRUED
Interest charged on marginNEGATIVE
MARGIN_LOAN_REPAID
Margin loan repaymentPOSITIVE
MARGIN_CALL_TRIGGERED
Margin call alertINFORMATIONAL

Activity Categories

Activities are automatically grouped into categories for easier filtering:

CategoryDescription
PORTFOLIO
Portfolio management activities
TRADING
Order and trade activities
CORPORATE_ACTION
Dividends, splits, and other corporate events
MARGIN
Margin trading activities
JOURNAL
Cash and security transfers
FEES
Commissions and regulatory fees
SUBSCRIPTION
Subscription changes

Activity Impact Types

Each activity has an impact indicator:

ImpactDescription
POSITIVE
Increases portfolio value (e.g., dividends, deposits)
NEGATIVE
Decreases portfolio value (e.g., withdrawals, fees)
NEUTRAL
No direct value change (e.g., stock splits)
INFORMATIONAL
Status updates only (e.g., order placed)

Error Handling

Not Found

404 Not Found
{
  "statusCode": 404,
  "message": "Portfolio not found",
  "error": "Not Found"
}

Unauthorized

401 Unauthorized
{
  "statusCode": 401,
  "message": "You are not authorized to view this portfolio",
  "error": "Unauthorized"
}

See Also