> For the complete documentation index, see [llms.txt](https://docs.edgetag.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgetag.io/features/audience-api/api-responses.md). Agents can also search and read this documentation through its [MCP server](https://docs.edgetag.io/~gitbook/mcp).

# API Responses

#### API Responses

**Success (200)**

```
{
"success": true
}
```

**Validation Error — Malformed Body (400)**\
Returned when the request body is not valid form data:

```
Malformed request body, must be form data (<error details>)
```

**Validation Error — Corrupted Payload (400)**

```
{
"success": false,
"errors": [
"Payload is corrupted or missing. Please send JSON string. <error>"
]
}
```

**Validation Error — Empty Users (400)**

```
No users in the segment. Segment cannot be created.
```

**Provider Errors (400, sync mode only)**

```
{
"success": false,
"errors": [ "" ]
}
```

#### Batching & Large Audiences

For large audiences that exceed practical request size limits, the API supports splitting users across multiple requests using the batch metadata:

* Split your user list into chunks (e.g., 10,000 users per batch)
* Generate a unique sessionId for the entire upload
* Send each chunk as a separate API call with incrementing sequence numbers
* Set totalBatches and totalUsers consistently across all requests&#x20;

{% hint style="info" %}
Example: To upload 25,000 users in 3 batches, each request would share the same sessionId , have totalBatches: 3 , totalUsers: 25000 , and individual sequence values of 1, 2, and 3.
{% endhint %}

```bat
POST /audience?disablePrefix=false&sync=true
Content-Type: multipart/form-data; boundary=----FormBoundary
------FormBoundary
Content-Disposition: form-data; name="name"
High Value Customers Q1
------FormBoundary
Content-Disposition: form-data; name="type"
custom
------FormBoundary
Content-Disposition: form-data; name="batch"
{"sessionId":1708531200,"sequence":1,"totalBatches":3,"totalUsers":25000,"pullDate":"2026-01-01"}
------FormBoundary
Content-Disposition: form-data; name="users"
[{"edgeTagId":"et_abc123","email":"jane@example.com","phone":"+1415555","firstName": "john","lastName": "doe","country": "US","postalCode": "90202","purchase":[..]},.....................]
------FormBoundary--
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.edgetag.io/features/audience-api/api-responses.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
