> 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-management/audience-segment-metrics.md).

# Audience Segment Metrics

Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.).

## GET /datamarts/{datamart\_id}/audience\_segment\_metrics/{id}

> Get an audience segment metric by id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics/{id}":{"get":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}},"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":[{"required":true,"style":"simple","name":"datamart_id","in":"path","explode":false,"schema":{"type":"string"}},{"explode":false,"in":"path","schema":{"type":"string"},"name":"id","style":"simple","required":true}],"operationId":"getAudienceSegmentMetric","description":"","tags":["Audience Segment Metrics"],"summary":"Get an audience segment metric by id"}}},"components":{"schemas":{"AudienceSegmentMetricResource":{"type":"object","properties":{"creation_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"technical_name":{"$ref":"#/components/schemas/AudienceSegmentMetricTechnicalName"},"datafarm_key":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"icon":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"last_modified_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_published_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"query_id":{"type":"string","readOnly":false},"display_name":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":true}},"required":["creation_date","datafarm_key","datamart_id","display_name","icon","id","last_modified_date","last_published_date","query_id","status","technical_name"]},"AudienceSegmentMetricTechnicalName":{"type":"string","enum":["emails","user_accounts","desktop_cookie_ids","mobile_cookie_ids","mobile_ad_ids"],"readOnly":false},"AudienceSegmentMetricStatus":{"type":"string","enum":["DRAFT","LIVE","ARCHIVED"],"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 /datamarts/{datamart\_id}/audience\_segment\_metrics/{id}

> Update an audience segment metric

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics/{id}":{"put":{"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}},"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"}},"summary":"Update an audience segment metric","tags":["Audience Segment Metrics"],"operationId":"updateAudienceSegmentMetric","parameters":[{"in":"path","explode":false,"required":true,"name":"datamart_id","style":"simple","schema":{"type":"string"}},{"explode":false,"schema":{"type":"string"},"style":"simple","in":"path","required":true,"name":"id"}],"requestBody":{"description":"The audience segment metric to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}}},"required":true}}}},"components":{"schemas":{"AudienceSegmentMetricResource":{"type":"object","properties":{"creation_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"technical_name":{"$ref":"#/components/schemas/AudienceSegmentMetricTechnicalName"},"datafarm_key":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"icon":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"last_modified_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_published_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"query_id":{"type":"string","readOnly":false},"display_name":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":true}},"required":["creation_date","datafarm_key","datamart_id","display_name","icon","id","last_modified_date","last_published_date","query_id","status","technical_name"]},"AudienceSegmentMetricTechnicalName":{"type":"string","enum":["emails","user_accounts","desktop_cookie_ids","mobile_cookie_ids","mobile_ad_ids"],"readOnly":false},"AudienceSegmentMetricStatus":{"type":"string","enum":["DRAFT","LIVE","ARCHIVED"],"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"}}}}}}}
```

## DELETE /datamarts/{datamart\_id}/audience\_segment\_metrics/{id}

> Delete an audience segment metric

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics/{id}":{"delete":{"summary":"Delete an audience segment metric","operationId":"deleteAudienceSegmentMetric","description":"","responses":{"200":{"$ref":"#/components/responses/simple"},"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"}},"tags":["Audience Segment Metrics"],"parameters":[{"explode":false,"style":"simple","in":"path","name":"datamart_id","required":true,"schema":{"type":"string"}},{"schema":{"type":"string"},"name":"id","in":"path","explode":false,"required":true,"style":"simple"}]}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"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"]}}}}
```

## GET /datamarts/{datamart\_id}/audience\_segment\_metrics

> Search for audience segment metrics

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics":{"get":{"tags":["Audience Segment Metrics"],"operationId":"findAudienceSegmentMetrics","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"count":{"type":"integer"},"first_result":{"type":"integer"},"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}},"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":false,"required":true,"name":"datamart_id","in":"path","schema":{"type":"string"},"style":"simple"},{"in":"query","explode":true,"schema":{"type":"integer","format":"int32"},"required":false,"name":"first_result","style":"form","description":"Offset from which the search must be performed"},{"required":false,"explode":true,"in":"query","description":"Maximum number of items that may be returned by the query","schema":{"type":"integer","format":"int32"},"style":"form","name":"max_results"},{"in":"query","required":false,"name":"query_id","description":"The id of the query that will be performed on the audience segment in the job","style":"form","schema":{"type":"string"},"explode":true},{"schema":{"type":"string"},"description":"Metric's backend technical name","style":"form","required":false,"explode":true,"in":"query","name":"technical_name"},{"in":"query","style":"form","name":"display_name","required":false,"explode":true,"schema":{"type":"string"},"description":"Metric's frontend display name"},{"schema":{"type":"string"},"required":false,"description":"Metric's frontend icon","style":"form","explode":true,"in":"query","name":"icon"},{"name":"status","required":false,"style":"form","description":"Metric's status DRAFT, LIVE or ARCHIVED","explode":true,"schema":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"in":"query"}],"description":"","summary":"Search for audience segment metrics"}}},"components":{"schemas":{"AudienceSegmentMetricResource":{"type":"object","properties":{"creation_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"technical_name":{"$ref":"#/components/schemas/AudienceSegmentMetricTechnicalName"},"datafarm_key":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"icon":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"last_modified_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_published_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"query_id":{"type":"string","readOnly":false},"display_name":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":true}},"required":["creation_date","datafarm_key","datamart_id","display_name","icon","id","last_modified_date","last_published_date","query_id","status","technical_name"]},"AudienceSegmentMetricTechnicalName":{"type":"string","enum":["emails","user_accounts","desktop_cookie_ids","mobile_cookie_ids","mobile_ad_ids"],"readOnly":false},"AudienceSegmentMetricStatus":{"type":"string","enum":["DRAFT","LIVE","ARCHIVED"],"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 /datamarts/{datamart\_id}/audience\_segment\_metrics

> Create an audience segment metric resource

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics":{"post":{"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}},"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"}},"summary":"Create an audience segment metric resource","tags":["Audience Segment Metrics"],"parameters":[{"schema":{"type":"string"},"style":"simple","explode":false,"name":"datamart_id","required":true,"in":"path"}],"operationId":"createAudienceSegment","requestBody":{"description":"The audience segment metric to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}}},"required":true}}}},"components":{"schemas":{"AudienceSegmentMetricResource":{"type":"object","properties":{"creation_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"technical_name":{"$ref":"#/components/schemas/AudienceSegmentMetricTechnicalName"},"datafarm_key":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"icon":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"last_modified_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_published_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"query_id":{"type":"string","readOnly":false},"display_name":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":true}},"required":["creation_date","datafarm_key","datamart_id","display_name","icon","id","last_modified_date","last_published_date","query_id","status","technical_name"]},"AudienceSegmentMetricTechnicalName":{"type":"string","enum":["emails","user_accounts","desktop_cookie_ids","mobile_cookie_ids","mobile_ad_ids"],"readOnly":false},"AudienceSegmentMetricStatus":{"type":"string","enum":["DRAFT","LIVE","ARCHIVED"],"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 /datamarts/{datamart\_id}/audience\_segment\_metrics/{id}/action

> Perform action on AudienceSegmentMetric

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Audience Segment Metrics","description":"Operations related to Audience Segment Metrics that define custom measurements on each segment (number of emails, number of User Accounts, etc.)."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/audience_segment_metrics/{id}/action":{"post":{"tags":["Audience Segment Metrics"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/AudienceSegmentMetricResource"}},"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"}},"summary":"Perform action on AudienceSegmentMetric","requestBody":{"description":"The action to perform","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MakeAudienceSegmentMetricActionResource"}}},"required":true},"operationId":"performAudienceSegmentMetricAction","parameters":[{"explode":false,"in":"path","name":"datamart_id","style":"simple","required":true,"schema":{"type":"string"}},{"name":"id","required":true,"in":"path","style":"simple","explode":false,"schema":{"type":"string"}}],"description":""}}},"components":{"schemas":{"AudienceSegmentMetricResource":{"type":"object","properties":{"creation_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"technical_name":{"$ref":"#/components/schemas/AudienceSegmentMetricTechnicalName"},"datafarm_key":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"icon":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/AudienceSegmentMetricStatus"},"last_modified_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_published_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"query_id":{"type":"string","readOnly":false},"display_name":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":true}},"required":["creation_date","datafarm_key","datamart_id","display_name","icon","id","last_modified_date","last_published_date","query_id","status","technical_name"]},"AudienceSegmentMetricTechnicalName":{"type":"string","enum":["emails","user_accounts","desktop_cookie_ids","mobile_cookie_ids","mobile_ad_ids"],"readOnly":false},"AudienceSegmentMetricStatus":{"type":"string","enum":["DRAFT","LIVE","ARCHIVED"],"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"]},"MakeAudienceSegmentMetricActionResource":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/AudienceSegmentMetricAction"}},"required":["action"]},"AudienceSegmentMetricAction":{"type":"string","enum":["PUBLISH"],"readOnly":false}},"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-management/audience-segment-metrics.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.
