> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/datamart-segment-and-feed-operations/audience-partitions.md).

# Audience Partitions

Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact.

## GET /audience\_partitions/{id}

> Get an audience partition by id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Partitions","description":"Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/audience_partitions/{id}":{"get":{"tags":["Audience Partitions"],"description":"","summary":"Get an audience partition by id","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudiencePartitionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"getPartition","parameters":[{"name":"id","required":true,"style":"simple","explode":false,"schema":{"type":"integer","format":"int64"},"in":"path"}]}}},"components":{"schemas":{"AudiencePartitionResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"clustering_model_data_file_uri":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false},"part_count":{"type":"integer","format":"int32","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"audience_partition_type":{"$ref":"#/components/schemas/AudiencePartitionType"},"status":{"$ref":"#/components/schemas/AudiencePartitionStatus"},"datamart_id":{"type":"string","readOnly":true}},"required":["archived","audience_partition_type","clustering_model_data_file_uri","datamart_id","id","name","organisation_id","part_count","status"]},"AudiencePartitionType":{"type":"string","enum":["CLUSTERING","RANDOM_SPLIT","TREE_SPLIT"],"readOnly":false},"AudiencePartitionStatus":{"type":"string","enum":["DRAFT","PUBLISHED"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /audience\_partitions/{id}

> Update an audience partition

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Partitions","description":"Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/audience_partitions/{id}":{"put":{"tags":["Audience Partitions"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudiencePartitionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"updatePartition","requestBody":{"description":"The audience partition input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePartitionResource"}}},"required":true},"parameters":[{"in":"path","style":"simple","explode":false,"schema":{"type":"integer","format":"int64"},"name":"id","required":true}],"description":"","summary":"Update an audience partition"}}},"components":{"schemas":{"AudiencePartitionResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"clustering_model_data_file_uri":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false},"part_count":{"type":"integer","format":"int32","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"audience_partition_type":{"$ref":"#/components/schemas/AudiencePartitionType"},"status":{"$ref":"#/components/schemas/AudiencePartitionStatus"},"datamart_id":{"type":"string","readOnly":true}},"required":["archived","audience_partition_type","clustering_model_data_file_uri","datamart_id","id","name","organisation_id","part_count","status"]},"AudiencePartitionType":{"type":"string","enum":["CLUSTERING","RANDOM_SPLIT","TREE_SPLIT"],"readOnly":false},"AudiencePartitionStatus":{"type":"string","enum":["DRAFT","PUBLISHED"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /audience\_partitions/{id}/publish

> Publish an audience partition

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Partitions","description":"Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/audience_partitions/{id}/publish":{"put":{"summary":"Publish an audience partition","tags":["Audience Partitions"],"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudiencePartitionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"publishPartition","parameters":[{"style":"simple","in":"path","explode":false,"schema":{"type":"integer","format":"int64"},"required":true,"name":"id"}]}}},"components":{"schemas":{"AudiencePartitionResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"clustering_model_data_file_uri":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false},"part_count":{"type":"integer","format":"int32","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"audience_partition_type":{"$ref":"#/components/schemas/AudiencePartitionType"},"status":{"$ref":"#/components/schemas/AudiencePartitionStatus"},"datamart_id":{"type":"string","readOnly":true}},"required":["archived","audience_partition_type","clustering_model_data_file_uri","datamart_id","id","name","organisation_id","part_count","status"]},"AudiencePartitionType":{"type":"string","enum":["CLUSTERING","RANDOM_SPLIT","TREE_SPLIT"],"readOnly":false},"AudiencePartitionStatus":{"type":"string","enum":["DRAFT","PUBLISHED"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /audience\_partitions

> Search the audience partitions associated with a given organization id or datamart id and extra optional filters

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Partitions","description":"Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/audience_partitions":{"get":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"first_result":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AudiencePartitionResource"}},"status":{"type":"string","enum":["ok"]},"count":{"type":"integer"},"max_results":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"explode":true,"name":"organisation_id","in":"query","required":false,"schema":{"type":"string"},"style":"form"},{"required":false,"name":"datamart_id","schema":{"type":"string"},"in":"query","explode":true,"style":"form"},{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AudiencePartitionType"}},"style":"form","required":false,"in":"query","name":"type","explode":true},{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AudiencePartitionStatus"}},"required":false,"style":"form","explode":true,"in":"query","name":"status"},{"in":"query","schema":{"type":"string"},"required":false,"name":"keywords","style":"form","explode":true},{"explode":true,"in":"query","required":false,"name":"name","style":"form","schema":{"type":"string"}},{"in":"query","required":false,"name":"first_result","style":"form","schema":{"type":"integer","format":"int32"},"explode":true},{"name":"max_results","in":"query","schema":{"type":"integer","format":"int32"},"explode":true,"style":"form","required":false},{"in":"query","schema":{"type":"boolean"},"name":"archived","required":false,"explode":true,"style":"form"}],"tags":["Audience Partitions"],"summary":"Search the audience partitions associated with a given organization id or datamart id and extra optional filters","operationId":"getPartitions","description":""}}},"components":{"schemas":{"AudiencePartitionResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"clustering_model_data_file_uri":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false},"part_count":{"type":"integer","format":"int32","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"audience_partition_type":{"$ref":"#/components/schemas/AudiencePartitionType"},"status":{"$ref":"#/components/schemas/AudiencePartitionStatus"},"datamart_id":{"type":"string","readOnly":true}},"required":["archived","audience_partition_type","clustering_model_data_file_uri","datamart_id","id","name","organisation_id","part_count","status"]},"AudiencePartitionType":{"type":"string","enum":["CLUSTERING","RANDOM_SPLIT","TREE_SPLIT"],"readOnly":false},"AudiencePartitionStatus":{"type":"string","enum":["DRAFT","PUBLISHED"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /audience\_partitions

> Create an audience partition

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Partitions","description":"Operations related to Audience Partitions for dividing randomly audience data into logical subsets for efficient processing and analysis. Particularly useful for A/B testing by creating mutually exclusive user groups that can be exposed to different campaigns to compare conversion rates and measure incremental impact."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/audience_partitions":{"post":{"requestBody":{"description":"The audience partition input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePartitionResource"}}},"required":true},"tags":["Audience Partitions"],"operationId":"createPartition","summary":"Create an audience partition","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudiencePartitionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"explode":true,"in":"query","schema":{"type":"string"},"required":false,"name":"organisation_id","style":"form"},{"style":"form","in":"query","required":false,"name":"datamart_id","explode":true,"schema":{"type":"string"}}],"description":""}}},"components":{"schemas":{"AudiencePartitionResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"clustering_model_data_file_uri":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false},"part_count":{"type":"integer","format":"int32","default":0,"readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"id":{"type":"string","readOnly":true},"audience_partition_type":{"$ref":"#/components/schemas/AudiencePartitionType"},"status":{"$ref":"#/components/schemas/AudiencePartitionStatus"},"datamart_id":{"type":"string","readOnly":true}},"required":["archived","audience_partition_type","clustering_model_data_file_uri","datamart_id","id","name","organisation_id","part_count","status"]},"AudiencePartitionType":{"type":"string","enum":["CLUSTERING","RANDOM_SPLIT","TREE_SPLIT"],"readOnly":false},"AudiencePartitionStatus":{"type":"string","enum":["DRAFT","PUBLISHED"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# 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.mediarithmics.io/api-reference/datamart-segment-and-feed-operations/audience-partitions.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.
