API Reference / Proxy sessions
Count proxy sessions per filter option
Returns, for each requested facet field (health, assigned, enabled, country), how many sessions carry each value under the same SessionFilter as ListSessions, with the field's own filter left out. Drives a pool's endpoint filter flyout.
/ proxies. v1. Proxies/ GetSessionFacetCountsRequest body
application/jsonRequired
Request for the per value counts of up to 8 session facet fields under the same filter as ListSessions, so a pool's endpoint filter flyout shows how many endpoints each option would select.
fields?array<string>The facet fields to count, at most 8.
Value in"SESSION_"SESSION_"SESSION_"SESSION_"SESSION_
filter?SessionFilterThe same filter as ListSessions. Each facet is counted with every other field applied but not its own.
Show attributes
assigned?booleanTrue selects only sessions with at least one live account assignment, false only sessions with none. Unset includes both.
cities?array<string>Exit cities to include, as the English city names the sessions report in health.exit_city, OR within the field. The empty string selects sessions whose city is not known. Empty includes sessions in every city.
countries?array<string>Exit countries to include, as upper-case ISO 3166-1 alpha-2 codes, OR within the field. A session's country is health.exit_country when observed, otherwise the provider's country. Empty includes sessions in every country and sessions whose country is not known.
enabled?booleanTrue selects only enabled sessions, false only disabled sessions. Unset includes sessions regardless of enabled state.
healths?array<string>Health states to include. Empty includes sessions in every state.
Value in"SESSION_"SESSION_"SESSION_
poolId?stringOptional pool id to limit results to a single pool. Unset includes sessions across all pools.
Format"byte" base64
query?stringLiteral case-insensitive substring of the session's host, slot number or an assigned account name. Absent or empty matches every session.
Response body
application/json
Success
facets?array<SessionFacetCounts>One entry per requested field, in request order.
Show attributes
counts?FacetFieldCountsThe values ordered by count descending then value, at most 50, with truncated set when more exist.
Show attributes
truncated?booleanTrue 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?stringNumber of rows carrying the value under the facet's predicate. Returned as a JSON string to preserve integer precision.
Format"int64"
value?stringThe 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?stringThe facet field these counts are for.
Value in"SESSION_"SESSION_"SESSION_"SESSION_"SESSION_
application/json
The request was malformed, such as a missing required field or an unparseable cursor. The request cannot be carried out in the current system state.
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.
application/json
The service is temporarily unavailable. Retry with backoff.
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/proxies.v1.Proxies/GetSessionFacetCounts" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filter": {
"poolId": "AY+MISIifMyN3T09PT09PQ=="
},
"fields": [
"SESSION_FACET_FIELD_HEALTH"
]
}'const res = await fetch("https://api.goldmine.to/proxies.v1.Proxies/GetSessionFacetCounts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"filter": {
"poolId": "AY+MISIifMyN3T09PT09PQ=="
},
"fields": [
"SESSION_FACET_FIELD_HEALTH"
]
}),
});
const data = await res.json();body := strings.NewReader(`{
"filter": {
"poolId": "AY+MISIifMyN3T09PT09PQ=="
},
"fields": [
"SESSION_FACET_FIELD_HEALTH"
]
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/proxies.v1.Proxies/GetSessionFacetCounts", 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/proxies.v1.Proxies/GetSessionFacetCounts",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"filter": {
"poolId": "AY+MISIifMyN3T09PT09PQ=="
},
"fields": [
"SESSION_FACET_FIELD_HEALTH"
]
},
)
data = res.json(){
"facets": [
{
"field": "SESSION_FACET_FIELD_HEALTH",
"counts": {
"values": [
{
"value": "SESSION_HEALTH_STATE_HEALTHY",
"count": "16"
},
{
"value": "SESSION_HEALTH_STATE_UNHEALTHY",
"count": "2"
}
],
"truncated": false
}
}
]
}{
"code": "failed_precondition",
"message": "The request cannot be carried out in the current system state."
}{
"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."
}{
"code": "unavailable",
"message": "The service is temporarily unavailable. Retry with backoff."
}