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.
/ contracts. v1. Contracts/ CountContractsRequest body
application/jsonRequired
Request for the number of contracts in each status in the caller's workspace, using the same filter as ListContracts.
filter?ContractFilterThe 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?stringOnly contracts created before this time. Absent sets no upper bound.
Format"date-time"
createdFrom?stringOnly contracts created at or after this time. Absent sets no lower bound.
Format"date-time"
evaluated?booleanTrue requires a recorded successful evaluation. False requires no recorded successful evaluation. Omitted includes both.
evaluatedBefore?stringOnly contracts last evaluated before this time. Contracts never evaluated do not match. Absent sets no upper bound.
Format"date-time"
evaluatedFrom?stringOnly 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_"CONTRACT_"CONTRACT_"CONTRACT_
profitFrom?stringStart 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?stringCase-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?stringOnly contracts whose latest snapshot number is at most this. Absent sets no upper bound.
Format"int64"
snapshotMinimum?stringOnly 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_"CONTRACT_
updatedBefore?stringOnly contracts a user last edited before this time. Absent sets no upper bound.
Format"date-time"
updatedFrom?stringOnly 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?integerNumber of contracts in this status.
Format"int32"
status?stringThe contract status this count is for.
Value in"CONTRACT_"CONTRACT_"CONTRACT_
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/CountContracts" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filter": {
"types": [
"CONTRACT_TYPE_BUYING"
]
}
}'const res = await fetch("https://api.goldmine.to/contracts.v1.Contracts/CountContracts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"filter": {
"types": [
"CONTRACT_TYPE_BUYING"
]
}
}),
});
const data = await res.json();body := strings.NewReader(`{
"filter": {
"types": [
"CONTRACT_TYPE_BUYING"
]
}
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/contracts.v1.Contracts/CountContracts", 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/CountContracts",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"filter": {
"types": [
"CONTRACT_TYPE_BUYING"
]
}
},
)
data = res.json(){}{
"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."
}curl -X POST "https://api.goldmine.to/contracts.v1.Contracts/CountContracts" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'const res = await fetch("https://api.goldmine.to/contracts.v1.Contracts/CountContracts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const data = await res.json();body := strings.NewReader(`{}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/contracts.v1.Contracts/CountContracts", 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/CountContracts",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={},
)
data = res.json(){
"counts": [
{
"status": "CONTRACT_STATUS_ACTIVE",
"count": 12
},
{
"status": "CONTRACT_STATUS_DRAFT",
"count": 3
}
]
}{
"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."
}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_SELLING"
]
}
}'const res = await fetch("https://api.goldmine.to/contracts.v1.Contracts/CountContracts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"filter": {
"types": [
"CONTRACT_TYPE_SELLING"
]
}
}),
});
const data = await res.json();body := strings.NewReader(`{
"filter": {
"types": [
"CONTRACT_TYPE_SELLING"
]
}
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/contracts.v1.Contracts/CountContracts", 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/CountContracts",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"filter": {
"types": [
"CONTRACT_TYPE_SELLING"
]
}
},
)
data = res.json(){
"counts": [
{
"status": "CONTRACT_STATUS_ACTIVE",
"count": 7
},
{
"status": "CONTRACT_STATUS_BUILDING",
"count": 1
},
{
"status": "CONTRACT_STATUS_DRAFT",
"count": 4
}
]
}{
"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."
}