API Reference / API keys
Count workspace API keys
Returns the number of API keys in the workspace. Drives the API keys page's count badge without loading and counting every key.
/ accounts. v1. Accounts/ CountAPIKeysRequest body
application/jsonRequired
Request for the number of API keys the caller can see in their workspace: their own keys, or every key for a platform administrator.
filter?APIKeyFilterOptional narrowing by free text, the same filter ListAPIKeys takes, so the count always matches the list it badges. Absent counts every key the caller can see.
Show attributes
query?stringFree text matched case-insensitively as a substring of the key's name or of any of its policy names, so "trading" finds a key with the trading policy. Absent or blank applies no search.
Response body
application/json
Success
count?integerNumber of API keys visible to the caller in the workspace.
Format"int32"
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/accounts.v1.Accounts/CountAPIKeys" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'const res = await fetch("https://api.goldmine.to/accounts.v1.Accounts/CountAPIKeys", {
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/accounts.v1.Accounts/CountAPIKeys", 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/accounts.v1.Accounts/CountAPIKeys",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={},
)
data = res.json(){
"count": 3
}{
"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."
}