Skip to content

API Reference / Purchases

Count purchases per filter option

Returns, for each requested facet field (strategy, account, contract, marketplace), how many purchases carry each value under the same PurchaseFilter and status selection as ListPurchases, with the field's own filter left out. Drives the purchases filter flyout.

POST/contracts.v1.Contracts/GetPurchaseFacetCounts

Request body

application/jsonRequired

Request for the per value counts of up to 8 purchase facet fields under the same filter and status selection as ListPurchases, so a filter flyout shows how many purchases each option would select.

fields?array<string>

The facet fields to count, at most 8.

Value in"PURCHASE_FACET_FIELD_STRATEGY""PURCHASE_FACET_FIELD_ACCOUNT_NAME""PURCHASE_FACET_FIELD_CONTRACT""PURCHASE_FACET_FIELD_MARKETPLACE""PURCHASE_FACET_FIELD_FAILURE_REASON"

filter?PurchaseFilter

The same filter as ListPurchases. Each facet is counted with every other field applied but not its own, so choosing one account still shows the counts of the other accounts.

Show attributes
accountName?string

Exact Steam account name that executed the buy. Absent includes every account.

contractIds?array<string>

Only purchases attributed to one of these contracts. Empty includes every contract.

coveringSellingContractIds?array<string>

Only purchases whose bought item is held (arriving, in the inventory or listed) and covered now by one of these selling contracts, resolved as GetCoveringSellingContract resolves it, OR within the field. Empty includes every purchase. At most 200 ids.

createdBefore?string

Only purchases attributed before this time. Absent sets no upper bound.

Format"date-time"

createdFrom?string

Only purchases attributed at or after this time. The attribution time is used because purchased_at is unset while a purchase is pending. Absent sets no lower bound.

Format"date-time"

deliveryStatuses?array<string>

Customer-facing delivery states, OR within the field. Empty includes every state.

Value in"PURCHASE_DELIVERY_STATUS_PENDING""PURCHASE_DELIVERY_STATUS_DELIVERED""PURCHASE_DELIVERY_STATUS_FAILED"

failureReasons?array<string>

Only failed or rolled back purchases with one of these failure reasons, OR within the field, the same values as the FAILURE_REASON facet. Empty includes every purchase.

Value in"PURCHASE_FAILURE_REASON_LISTING_UNAVAILABLE""PURCHASE_FAILURE_REASON_INSUFFICIENT_BALANCE""PURCHASE_FAILURE_REASON_ACCOUNT_UNAVAILABLE""PURCHASE_FAILURE_REASON_MARKETPLACE_REJECTED""PURCHASE_FAILURE_REASON_TRADE_NOT_COMPLETED""PURCHASE_FAILURE_REASON_TRADE_REVERSED"

flags?array<string>

Review flags, OR within the field: a purchase matches when it carries any of the named flags. Empty does not restrict.

Value in"PURCHASE_FLAG_OVER_MAX_PRICE""PURCHASE_FLAG_WRONG_FLOAT""PURCHASE_FLAG_NOT_DELIVERED"

hasCoveringSellingContract?boolean

True selects only purchases whose bought item is held and covered by a selling contract now. False selects only purchases whose bought item is held and covered by none. A purchase with no held item never matches either value. Omitted includes every purchase.

marketHashNames?array<string>

Exact market_hash_name set, OR within the field, for an item's own purchases. Empty includes every item.

marketplaces?array<string>

Marketplace slugs the purchase was bought on (for example csfloat, market-csgo, dmarket), OR within the field, the same values as the MARKETPLACE facet. Empty includes every marketplace. At most 20 values.

maxPriceNowKind?string

Only purchases whose bought item is still held (arriving, in the inventory or listed) and whose contract targets the item now, compared by the contract's current maximum price for the item against the price paid. A purchase whose contract no longer targets the item never matches. Omitted includes every purchase.

Value in"PURCHASE_MAX_PRICE_NOW_BELOW_PAID""PURCHASE_MAX_PRICE_NOW_AT_OR_ABOVE_PAID"

needsReview?boolean

True selects only purchases carrying any flag (over max price, wrong float or not delivered), the same set as every PurchaseFlag together. False selects only purchases with none of those flags. Omitted includes both.

paintSeeds?array<integer>

Exact paint seeds (pattern indexes, 0 to 1000), OR within the field. A purchase with no known seed never matches. Empty includes every purchase. At most 200 seeds.

query?string

Case-insensitive literal substring of the item's market_hash_name, not a regular expression or wildcard pattern. Absent or empty matches every purchase.

strategies?array<string>

Buying mechanisms, OR within the field. Empty includes every strategy.

Value in"PURCHASE_STRATEGY_LISTING""PURCHASE_STRATEGY_BUY_ORDER""PURCHASE_STRATEGY_AUCTION""PURCHASE_STRATEGY_OFFER"

statuses?array<string>

The list's lifecycle status selection, so the flyout reflects the open tab. Empty includes every status.

Value in"PURCHASE_STATUS_PENDING""PURCHASE_STATUS_COMPLETED""PURCHASE_STATUS_FAILED""PURCHASE_STATUS_TRADES_PENDING""PURCHASE_STATUS_TRADED""PURCHASE_STATUS_ROLLED_BACK"

Response body

application/json

Success

facets?array<PurchaseFacetCounts>

One entry per requested field, in request order.

Show attributes
counts?FacetFieldCounts

The values ordered by count descending then value, at most 50, with truncated set when more exist.

Show attributes
truncated?boolean

True when the field has more than 50 values, so the list shows only the 50 most common.

values?array<FacetValueCount>

The values and their counts, ordered by count descending then by value, at most 50.

Show attributes
count?string

Number of rows carrying the value under the facet's predicate. Returned as a JSON string to preserve integer precision.

Format"int64"

value?string

The value as the list rows carry it: an enum name, a base64 id or an account name, so a client maps it to a label exactly as it maps a row.

field?string

The facet field these counts are for.

Value in"PURCHASE_FACET_FIELD_STRATEGY""PURCHASE_FACET_FIELD_ACCOUNT_NAME""PURCHASE_FACET_FIELD_CONTRACT""PURCHASE_FACET_FIELD_MARKETPLACE""PURCHASE_FACET_FIELD_FAILURE_REASON"

curl -X POST "https://api.goldmine.to/contracts.v1.Contracts/GetPurchaseFacetCounts" \
  -H "Authorization: Bearer $CSTRADER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "statuses": [
      "PURCHASE_STATUS_PENDING"
    ],
    "fields": [
      "PURCHASE_FACET_FIELD_ACCOUNT_NAME",
      "PURCHASE_FACET_FIELD_STRATEGY"
    ]
  }'
{
  "facets": [
    {
      "field": "PURCHASE_FACET_FIELD_ACCOUNT_NAME",
      "counts": {
        "values": [
          {
            "value": "trader_steam_01",
            "count": "7"
          }
        ],
        "truncated": false
      }
    },
    {
      "field": "PURCHASE_FACET_FIELD_STRATEGY",
      "counts": {
        "values": [
          {
            "value": "PURCHASE_STRATEGY_LISTING",
            "count": "7"
          }
        ],
        "truncated": false
      }
    }
  ]
}