> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CountContacts

# Package: contacts

# Namespace: Contacts

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/count-contacts.md

## Permission Scopes:
Read Contacts: SCOPE.DC-CONTACTS.READ-CONTACTS

## Introduction

Retrieves the number of contacts that match the provided filter and search criteria.

---

## REST API

### Schema

```
 Method: countContacts
 Description: Retrieves the number of contacts that match the provided filter and search criteria.
 URL: https://www.wixapis.com/contacts/v5/contacts/count
 Method: POST
 Method parameters:
   param name: filter | type: filter | description: Filter object.  Example: `{ "filter": { "name.last": "Smith" } }`  
   param name: search | type: search | description: Plain text search for an exact match.  Supported search properties are:  - `name.full` - `email.email` - `phone.phone` - `member_info.email` - `member_info.profile_info.nickname` - `company.name` - `company.job_title`  Max: 100 characters  | validation: maxLength 100
 Return type: CountContactsResponse
  - name: count | type: integer | description: Number of contacts that match the provided filter and search criteria.  


```

### Examples

### Count contacts
Returns the total number of contacts matching a filter.

```curl
curl -X POST \
'https://www.wixapis.com/contacts/v5/contacts/count' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "filter": {
    "email.email": "john.doe@example.com"
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.crm.contactsV5.countContacts(options)
 Description: Retrieves the number of contacts that match the provided filter and search criteria.
 Method parameters:
   param name: options | type: CountContactsOptions  none  
        - name: filter | type: object | description: Filter object.  Example: `{ "filter": { "name.last": "Smith" } }`  
        - name: search | type: string | description: Plain text search for an exact match.  Supported search properties are:  - `name.full` - `email.email` - `phone.phone` - `member_info.email` - `member_info.profile_info.nickname` - `company.name` - `company.job_title`  Max: 100 characters  | validation: maxLength 100
 Return type: PROMISE<CountContactsResponse>
  - name: count | type: integer | description: Number of contacts that match the provided filter and search criteria.  


```

### Examples

### Count contacts
```javascript
import { contactsV5 } from "@wix/crm";

const options = {
  filter: { "email.email": "john.doe@example.com" },
};

async function countContacts() {
  const response = await contactsV5.countContacts(options);
}

/* Promise resolves to:
 * {
 *   "count": 1
 * }
 */

```

### countContacts (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { contactsV5 } from '@wix/crm';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { contactsV5 },
  // Include the auth strategy and host as relevant
});


async function countContacts(options) {
  const response = await myWixClient.contactsV5.countContacts(options);
};
```

---