# countContacts

The number of active contacts visible to you, in one call: the total the Contacts page shows (archived and hidden contacts excluded). Use it for any count-shaped question; never page through findContacts to count. With no arguments it is the total VISIBLE TO THE KEY OWNER, the org-wide total only for an owner holding VIEW_ALL_CONTACTS (applied with or without a filterTree), so never report it as the organization's total unless you know the owner sees every contact. Takes an optional filterTree (saveFilter's DSL), never filterId: a saved filter's count is filterContacts' `total` with its filterId. NEVER save a filter to measure one. A status word ("called", "hot", "dead") can name the org's own tags: searchContactTags for it before you count by an activity or system field alone, and count each reading you find. A count is the answer, 0 included: never re-derive it by paging. Archived contacts are excluded, so 0 means no ACTIVE match. To see how a condition treats empty values, run filterContacts once.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "countContacts", "variables": {...} }`
- Scope: `READ`
- Type: query
- Idempotency: a read; rejects `Idempotency-Key`
- Rate-limited: no

## Variables

- `filterTree`: `JSON` (default `{id: "root", operator: "AND", conditions: [], groups: []}`)

## Response (data, an example)

```json
{
  "contactQuery": {
    "getContactsCount": 0
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "countContacts",
    "variables": {}
  }'
```
