Skip to content

API Reference / Contracts

Count contracts per status in a workspace

Returns the number of contracts in each status for the workspace, optionally filtered by type. Drives the list page status-tab counts (All, Active, Draft) without loading every contract.

POST/contracts.v1.Contracts/CountContracts

Request body

application/jsonRequired

Request for the number of contracts in each status in the caller's workspace, using the same filter as ListContracts.

filter?ContractFilter

The same filters as ListContracts, so status counts match the filtered list.

Show attributes
accountGroupIds?array<string>

Only contracts assigned to one of these account groups, OR within the field. Empty does not restrict. A contract with no account group never matches a non-empty set.

createdBefore?string

Only contracts created before this time. Absent sets no upper bound.

Format"date-time"

createdFrom?string

Only contracts created at or after this time. Absent sets no lower bound.

Format"date-time"

evaluated?boolean

True requires a recorded successful evaluation. False requires no recorded successful evaluation. Omitted includes both.

evaluatedBefore?string

Only contracts last evaluated before this time. Contracts never evaluated do not match. Absent sets no upper bound.

Format"date-time"

evaluatedFrom?string

Only contracts last evaluated at or after this time. Contracts never evaluated do not match. Absent sets no lower bound.

Format"date-time"

problems?array<string>

Only contracts in at least one of these health conditions, OR within the field, by the same derivation that fills Contract.problems. Empty does not restrict.

Value in"CONTRACT_PROBLEM_TARGETS_OUTDATED""CONTRACT_PROBLEM_HOLDINGS_UNCONFIRMED""CONTRACT_PROBLEM_EVALUATION_FAILED""CONTRACT_PROBLEM_UNPRICED_ITEMS"

profitFrom?string

Start of the window for the realised profit sort, not a condition on which contracts match. Unset counts every sale. Read only by a list sorted by realised profit, and bound to its cursor.

Format"date-time"

query?string

Case-insensitive literal substring, not a regular expression or wildcard pattern, matched against the contract name or against the market_hash_name of any item in the contract's current intents (the items its latest evaluation targets, which already resolve weapon, paint, category, collection and referenced filter sets). A draft has no intents, so it matches by name only. Absent or empty matches every contract.

snapshotMaximum?string

Only contracts whose latest snapshot number is at most this. Absent sets no upper bound.

Format"int64"

snapshotMinimum?string

Only contracts whose latest snapshot number is at least this. Absent sets no lower bound.

Format"int64"

types?array<string>

Contract types to include, OR within the field. Empty includes every type.

Value in"CONTRACT_TYPE_BUYING""CONTRACT_TYPE_SELLING"

updatedBefore?string

Only contracts a user last edited before this time. Absent sets no upper bound.

Format"date-time"

updatedFrom?string

Only contracts a user last edited at or after this time. Absent sets no lower bound.

Format"date-time"

Response body

application/json

Success

counts?array<ContractStatusCount>

Count of contracts in each status, scoped to the workspace and the filter. A status with no contracts may be omitted.

Show attributes
count?integer

Number of contracts in this status.

Format"int32"

status?string

The contract status this count is for.

Value in"CONTRACT_STATUS_DRAFT""CONTRACT_STATUS_BUILDING""CONTRACT_STATUS_ACTIVE"

curl -X POST "https://api.goldmine.to/contracts.v1.Contracts/CountContracts" \
  -H "Authorization: Bearer $CSTRADER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "types": [
        "CONTRACT_TYPE_BUYING"
      ]
    }
  }'
{}