Skip to main content
POST
/
accounts
/
{account_id}
/
audiences
JavaScript
import Surge from '@surgeapi/node';

const client = new Surge({
  apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});

const audience = await client.audiences.create('acct_01j9a43avnfqzbjfch6pygv1td', {
  name: 'The Family',
});

console.log(audience.id);
{
  "id": "aud_01j9dy8mdzfn3r0e8x1tbdrdrf",
  "name": "The Family"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

account_id
string
required

The account for which the audience should be created.

Example:

"acct_01j9a43avnfqzbjfch6pygv1td"

Body

application/json

Params for creating an audience

name
string
required

The audience name.

Maximum string length: 255

Response

Created audience

A group of contacts used for targeting messages.

id
string
required

Unique identifier for the object.

name
string
required

A name to identify this Audience. This name will only be visible within Surge.

Maximum string length: 255