All pages
Powered by GitBook
1 of 1

Loading...

Create

API Description

Request structure

Route

The Audience API exposes a POST endpoint that allows to create an audience:

/audiences/create

Headers and authentication

See .

Post data

The body of the request must contain a valid JSON payload describing the operations to be executed on the audience.

Here is a how a complete JSON payload looks like:

Responses

Success

If the POST to the API endpoint is successful you will receive an HTTP 202 confirmation and a token.

Once you get your token, you can use it to of this update with the API.

Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at if you need further support.

Overview → Using Project APIs
check the indexing state
support@batch.com
{
  "name": "AUDIENCE_NAME",
  "display_name": "The audience description",
  "type": "custom_ids"
}
{
  "indexing_token": "a0082dc6860938a26280bd3ba927303b"
}

Create

post

Create an audience.

Authorizations
AuthorizationstringRequired

API Key Authentication

Authentication is required in order to interact with Batch's APIs.

Batch implements authentication using API Keys, that we call the "REST API Key". You can find it on your dashboard.

Please make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would easily be extractable.

How to authenticate

In order to authenticate your requests, add your REST API Key in the Authorization header and prefix it by Bearer. Example: Authorization: Bearer bcd38d9rfb38ra28.

Header parameters
X-Batch-ProjectstringRequired

The unique project key, identifying a project on the Batch platform

Example: project_0664hxvwffvbpn278gxdyhsadddqgna6
Body
namestring · max: 255Required

The audience name value must be a string that only contains letters (a-z, A-Z), numbers (0-9) or the following characters : _, -. Audience names can be up to 255 characters long. They are case sensitive.

typestring · enumRequiredPossible values:
display_namestringOptional
Responses
202

If the POST to the API endpoint is successful you will receive an HTTP 202 confirmation and an indexing token. Once you get your indexing token, you can use it to check the indexing state with the view action.

application/json
400

The request is malformed

application/json
401

The Rest API Key is not valid for this project

application/json
429

Too Many Requests

application/json
500

Unexpected error

application/json
503

Batch's services are under maintenance. Please try again later

application/json
post
/audiences/create
{
  "indexing_token": "text"
}
POST /2.8/audiences/create HTTP/1.1
Host: api.batch.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-Batch-Project: text
Content-Type: application/json
Accept: */*
Content-Length: 86

{
  "name": "AUDIENCE_NAME",
  "display_name": "The audience description",
  "type": "custom_ids"
}