API Reference / Contracts
Count the copies of items the workspace holds
For each named item, the copies the workspace holds now across every float window: items in its Steam inventories plus items bought and still arriving, each counted once, which is the count a contract's max owned per item limit is held to.
/ contracts. v1. Contracts/ GetOwnedItemCountsRequest body
application/jsonRequired
Request for the copies the caller's workspace holds of each named item.
marketHashNames?array<string>The items to count, from 1 to 100 distinct market hash names.
Response body
application/json
Success
items?array<OwnedItemCount>One entry per requested item, in request order.
Show attributes
marketHashName?stringThe item's market hash name.
ownedCount?integerCopies held across every float window: items in the workspace's Steam inventories plus items bought and still arriving, each counted once.
Format"int32"
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
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/GetOwnedItemCounts" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"marketHashNames": [
"AK-47 | Redline (Field-Tested)",
"AWP | Asiimov (Field-Tested)"
]
}'const res = await fetch("https://api.goldmine.to/contracts.v1.Contracts/GetOwnedItemCounts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"marketHashNames": [
"AK-47 | Redline (Field-Tested)",
"AWP | Asiimov (Field-Tested)"
]
}),
});
const data = await res.json();body := strings.NewReader(`{
"marketHashNames": [
"AK-47 | Redline (Field-Tested)",
"AWP | Asiimov (Field-Tested)"
]
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/contracts.v1.Contracts/GetOwnedItemCounts", 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/GetOwnedItemCounts",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"marketHashNames": [
"AK-47 | Redline (Field-Tested)",
"AWP | Asiimov (Field-Tested)"
]
},
)
data = res.json(){
"items": [
{
"marketHashName": "AK-47 | Redline (Field-Tested)",
"ownedCount": 2
},
{
"marketHashName": "AWP | Asiimov (Field-Tested)",
"ownedCount": 0
}
]
}{
"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": "internal",
"message": "An internal server error occurred."
}