Surge

Create audience

POST
/accounts/{account_id}/audiences

Creates a new audience.

Authorization

authorization
AuthorizationBearer <token>

In: header

Path Parameters

account_id*string

The account for which the audience should be created.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

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"
}
{
  "error": {
    "message": "The requested resource could not be found.",
    "type": "not_found"
  }
}