Audience count API – Cordial Knowledge Base

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.

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 and use it for authorization.

Methods, parameters, and examples

POST/v2/audiencecount

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

* 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 page.

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