Goldmine
Profit and Loss

Get aggregate profit and loss for a workspace

POST
/contracts.v1.Contracts/GetPnLSummary

Returns the workspace's aggregate profit and loss, including total buy cost, sell revenue, realized and unrealized figures, and item counts. Optionally scoped to one contract and a time range.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/contracts.v1.Contracts/GetPnLSummary" \  -H "Content-Type: application/json" \  -d '{    "workspaceId": "AAECAwQFBgcICQoLDA0ODw==",    "startTime": "2026-01-01T00:00:00Z",    "endTime": "2026-06-30T23:59:59Z"  }'
{
  "summary": {
    "totalBuyCostCents": "1250000",
    "totalSellRevenueCents": "1480000",
    "realizedPnlCents": "230000",
    "unrealizedCostCents": "420000",
    "totalPurchases": "312",
    "itemsInInventory": "95",
    "itemsSold": "217"
  }
}
{
  "code": "invalid_argument",
  "message": "The request was malformed, such as a missing required field or an unparseable cursor."
}
{
  "code": "unauthenticated",
  "message": "The request lacks a valid API key in the Authorization header."
}
{
  "code": "permission_denied",
  "message": "The API key is not allowed to perform this action on this workspace."
}
{
  "code": "resource_exhausted",
  "message": "The request was rate limited. Slow down and retry later."
}
{
  "code": "internal",
  "message": "An internal server error occurred."
}