API Reference / Memberships
Count memberships by status in the caller's own workspace
Returns the number of memberships in each status in the caller's own active workspace, optionally narrowed to a single user. There is no workspace_id request field. The result always means the caller's own workspace. Drives status-tab counts (Invited, Accepted) without loading every membership.
/ accounts. v1. Accounts/ CountMembershipsRequest body
application/jsonRequired
Request for the number of memberships in each status in the caller's workspace.
filter?MembershipFilterThe same filter as ListMemberships.
Show attributes
query?stringOptional case-insensitive literal substring of the member's display name or email, matched server side. Absent or empty matches every membership.
userId?stringOptional filter: only memberships for this user.
Format"byte" base64
Response body
application/json
Success
counts?array<MembershipStatusCount>Count of memberships in each status, scoped to the requested filters. A status with no memberships may be omitted.
Show attributes
count?integerNumber of memberships in this status.
Format"int32"
status?stringThe membership status this count is for.
Value in"MEMBERSHIP_"MEMBERSHIP_
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/accounts.v1.Accounts/CountMemberships" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'const res = await fetch("https://api.goldmine.to/accounts.v1.Accounts/CountMemberships", {
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/CountMemberships", 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/CountMemberships",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={},
)
data = res.json(){
"counts": [
{
"status": "MEMBERSHIP_STATUS_INVITED",
"count": 2
},
{
"status": "MEMBERSHIP_STATUS_ACCEPTED",
"count": 8
}
]
}{
"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/accounts.v1.Accounts/CountMemberships" \
-H "Authorization: Bearer $CSTRADER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filter": {
"userId": "EjRWeBI0VniQEjRWeBI0Vg=="
}
}'const res = await fetch("https://api.goldmine.to/accounts.v1.Accounts/CountMemberships", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CSTRADER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"filter": {
"userId": "EjRWeBI0VniQEjRWeBI0Vg=="
}
}),
});
const data = await res.json();body := strings.NewReader(`{
"filter": {
"userId": "EjRWeBI0VniQEjRWeBI0Vg=="
}
}`)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.goldmine.to/accounts.v1.Accounts/CountMemberships", 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/CountMemberships",
headers={"Authorization": f"Bearer {os.environ['CSTRADER_API_KEY']}"},
json={
"filter": {
"userId": "EjRWeBI0VniQEjRWeBI0Vg=="
}
},
)
data = res.json(){
"counts": [
{
"status": "MEMBERSHIP_STATUS_ACCEPTED",
"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."
}