API Reference / Profit
Get aggregate profit for a workspace
Returns the workspace's aggregate profit, including total buy cost, sell revenue, realised and unrealised figures, and item counts. Optionally scoped to one contract and a time range.
/ contracts. v1. Contracts/ GetPnLSummaryRequest body
application/jsonRequired
Request for the caller's workspace profit, optionally for one contract and for sales completed within a time range.
accountNames?array<string>Optional filter: only items held on, or sold or lost from, one of these Steam accounts. Narrows every component. At most 200.
buyingContractIds?array<string>Optional filter: only items one of these contracts bought, unlike contract_id, which also credits a contract's sales of items another contract bought. Narrows every component. At most 200.
contractId?stringOptional filter: scope the summary to one contract's realised and unrealised figures instead of the whole workspace.
Format"byte" base64
endTime?stringOptional end of the time range that filters the realised components on sale completion time. The unrealised and lifetime buy components ignore this range.
Format"date-time"
marketHashNames?array<string>Optional filter: only items with one of these exact names. Narrows every component. At most 200.
query?stringOptional filter: only items whose name contains this text, ignoring case. Narrows every component.
sellingContractIds?array<string>Optional filter: only items whose selling contract is one of these. Narrows every component. At most 200.
sellingMarketplaces?array<string>Optional filter: only items sold or lost on one of these markets, so the unrealised components are zero under it. At most 20.
startTime?stringOptional start of the time range that filters the realised components (sell revenue, realised profit, and sold-item counts) on sale completion time. The unrealised and lifetime buy components ignore this range.
Format"date-time"
Response body
application/json
Success
summary?PnLSummaryThe requested aggregate profit summary.
Show attributes
averageHoldingDuration?stringAverage time from acquiring an item to selling it, over the items sold in the period. Unset when no item sold in the period has an acquired time.
itemsInInventory?stringNumber of items in scope that are still held and not yet sold.
Format"int64"
itemsLost?stringItems lost in scope: they left the account and no money came for them. Never counted in items_sold.
Format"int64"
itemsSold?stringNumber of items in scope that have sold.
Format"int64"
lossItemCount?stringNumber of items sold in the period for less than they cost.
Format"int64"
lostCostCents?stringThe buy cost of the items lost in scope, in cents. Realized_pnl_cents already subtracts it.
Format"int64"
lostCostMicros?stringlost_cost_cents in millionths of a dollar, from the exact buy prices.
Format"int64"
realizedPnlCents?stringRealised profit in scope, in cents: total_sell_revenue_cents minus the buy cost of those same sold items, minus the cost of the items lost (lost_cost_cents).
Format"int64"
realizedPnlMicros?stringrealized_pnl_cents in millionths of a dollar: total_sell_revenue_cents times 10,000 minus the exact buy cost of those sold items and of the items lost. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.
Format"int64"
totalBuyCostCents?stringLifetime buy cost in scope, in cents: the sum of listing_price_cents over every purchase, held and sold alike, for the workspace or for the one contract the request scoped to.
Format"int64"
totalBuyCostMicros?stringtotal_buy_cost_cents in millionths of a dollar, summed from the exact buy prices. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.
Format"int64"
totalPurchases?stringLifetime count of purchases in scope, held and sold alike.
Format"int64"
totalSellRevenueCents?stringRealised sell revenue in scope, in cents: the sum of sell_price_cents over every sold item counted in this summary.
Format"int64"
unrealizedCostCents?stringUnrealised cost in scope, in cents: the buy cost basis of items still held and not yet sold.
Format"int64"
unrealizedCostMicros?stringunrealized_cost_cents in millionths of a dollar, summed from the exact buy prices. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.
Format"int64"
application/json
The request was malformed, such as a missing required field or an unparseable cursor.
codestringThe Connect error code, such as "not_found".
details?array<object>Optional machine-readable error details.
messagestringA human-readable description of the error.
application/json
The request lacks a valid API key in the Authorization header.
codestringThe Connect error code, such as "not_found".
details?array<object>Optional machine-readable error details.
messagestringA human-readable description of the error.
application/json
The API key is not allowed to perform this action on this workspace.
codestringThe Connect error code, such as "not_found".
details?array<object>Optional machine-readable error details.
messagestringA human-readable description of the error.
application/json
The request was rate limited. Slow down and retry later.
codestringThe Connect error code, such as "not_found".
details?array<object>Optional machine-readable error details.
messagestringA human-readable description of the error.
application/json
An internal server error occurred.
codestringThe Connect error code, such as "not_found".
details?array<object>Optional machine-readable error details.
messagestringA human-readable description of the error.
curl -X POST "https://api.goldmine.to/contracts.v1.Contracts/GetPnLSummary" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"startTime": "2026-01-01T00:00:00Z",
"endTime": "2026-06-30T23:59:59Z"
}'const res = await fetch("https://api.goldmine.to/contracts.v1.Contracts/GetPnLSummary", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"startTime": "2026-01-01T00:00:00Z",
"endTime": "2026-06-30T23:59:59Z"
}),
});
const data = await res.json();body := strings.NewReader(`{
"startTime": "2026-01-01T00:00:00Z",
"endTime": "2026-06-30T23:59:59Z"
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/contracts.v1.Contracts/GetPnLSummary", body)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("CSTRADER_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)import os, requests
res = requests.post(
"https://api.goldmine.to/contracts.v1.Contracts/GetPnLSummary",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"startTime": "2026-01-01T00:00:00Z",
"endTime": "2026-06-30T23:59:59Z"
},
)
data = res.json(){
"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."
}