# How can we help?

## Overview

The audience count API gives you real-time information about audiences you create using the [Audience Builder in the UI](https://support.cordial.com/hc/en-us/articles/115005532168).

**API set name: audiencecount**

## Authentication

Cordial's core APIs use https Basic Authentication (BA). From within the Cordial platform, you can [generate an encoded API key for your account](https://support.cordial.com/hc/en-us/articles/115005365087) and use it for authorization.

- [Learn more about Cordial API authentication here](https://support.cordial.com/hc/en-us/articles/203885498).

## Methods, parameters, and examples

- [POST/v2/audiencecount](https://support.cordial.com/hc/en-us/articles/32870819845773-Audience-count-API#postAccountLists)

## POST/v2/audiencecount

| Method | URL Path |
| --- | --- |
| POST | /v2/audiencecount |
| Provides a real-time count of a specific audience using an audience ID. |

- [Parameters](https://support.cordial.com/hc/en-us/articles/32870819845773-Audience-count-API#zp-1-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/32870819845773-Audience-count-API#zp-1-1)
- [Example request URL](https://support.cordial.com/hc/en-us/articles/32870819845773-Audience-count-API#zp-1-2)
- [Example JSON response](https://support.cordial.com/hc/en-us/articles/32870819845773-Audience-count-API#zp-1-3)

\* Required

| Parameter | Type | Description | Example |
| --- | --- | --- | --- |
| \* `id` | string | Unique ID for an existing audience. | `"id":"67631c6b4d8e4167a106af71"` |

The following will get the real-time count of an audience with the ID `"67631c6b4d8e4167a106af71"`.

```
{
  "and":[{saved_audience:{"id":"67631c6b4d8e4167a106af71"}}]
}
```

The following URL in conjunction with the JSON will perform the POST.

```
https://<path>/v2/audiencecount
```

A successful POST request will return the real-time count for the specified audience. The example below shows an audience with 200,000 contacts.

```
{
  "count": 200000
}
```

## Error responses

The Cordial API will return an error object with an `errorKey` and `message` if there is a problem with an API call. Listed below are errors specific to the audience count API endpoint, along with suggested modifications. If you receive an error from this API endpoint that's not listed in this table, it's likely recorded on the [Global API error responses](https://support.cordial.com/hc/en-us/articles/4402427843597-Global-API-Error-Responses) page.

| `errorKey` | Message | Modifications |
| --- | --- | --- |
| `INALID_AUDIENCE_RULES` | Audience criteria is not specified. | Make sure the audience `id` is correct.
