> 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/goals.md).

# Goals

Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:

* Via **tracking pixels** (for one-time conversions on confirmation pages)
* Via **OTQL query rules** (for complex, recurring conversion logic)

Goals are associated with attribution models for campaign attribution.

Relevant documentation:

* [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)

## GET /goals/{id}

> Get goal

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Goals","description":"Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:\n- Via **tracking pixels** (for one-time conversions on confirmation pages)\n- Via **OTQL query rules** (for complex, recurring conversion logic)\n\nGoals are associated with attribution models for campaign attribution.\n\nRelevant documentation:\n- [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/goals/{id}":{"get":{"summary":"Get goal","tags":["Goals"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/GoalResource"}},"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":[{"in":"path","style":"simple","required":true,"schema":{"type":"integer","format":"int64"},"explode":false,"name":"id"}],"operationId":"getGoal","description":""}}},"components":{"schemas":{"GoalResource":{"type":"object","properties":{"new_query_id":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"technical_name":{"type":"string","readOnly":false},"goal_value_currency":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"query_id":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/GoalStatus"},"datamart_id":{"type":"string","readOnly":false},"default_goal_value":{"type":"number","format":"float","default":0,"readOnly":false},"name":{"type":"string","readOnly":false}},"required":["archived","datamart_id","id","organisation_id","status"]},"GoalStatus":{"type":"string","enum":["PAUSED","ACTIVE"],"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 /goals/{id}

> Update goal

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Goals","description":"Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:\n- Via **tracking pixels** (for one-time conversions on confirmation pages)\n- Via **OTQL query rules** (for complex, recurring conversion logic)\n\nGoals are associated with attribution models for campaign attribution.\n\nRelevant documentation:\n- [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/goals/{id}":{"put":{"requestBody":{"description":"The goal to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalResource"}}},"required":true},"summary":"Update goal","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/GoalResource"}},"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"}},"tags":["Goals"],"operationId":"updateGoal","parameters":[{"name":"id","in":"path","style":"simple","required":true,"explode":false,"schema":{"type":"integer","format":"int64"}}]}}},"components":{"schemas":{"GoalResource":{"type":"object","properties":{"new_query_id":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"technical_name":{"type":"string","readOnly":false},"goal_value_currency":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"query_id":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/GoalStatus"},"datamart_id":{"type":"string","readOnly":false},"default_goal_value":{"type":"number","format":"float","default":0,"readOnly":false},"name":{"type":"string","readOnly":false}},"required":["archived","datamart_id","id","organisation_id","status"]},"GoalStatus":{"type":"string","enum":["PAUSED","ACTIVE"],"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 /goals/{id}

> Delete a goal

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Goals","description":"Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:\n- Via **tracking pixels** (for one-time conversions on confirmation pages)\n- Via **OTQL query rules** (for complex, recurring conversion logic)\n\nGoals are associated with attribution models for campaign attribution.\n\nRelevant documentation:\n- [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/goals/{id}":{"delete":{"parameters":[{"in":"path","style":"simple","explode":false,"required":true,"schema":{"type":"integer","format":"int64"},"name":"id"}],"summary":"Delete a goal","tags":["Goals"],"description":"","operationId":"deleteGoal","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"}}}}},"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 /goals

> Search every goal for an organisation

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Goals","description":"Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:\n- Via **tracking pixels** (for one-time conversions on confirmation pages)\n- Via **OTQL query rules** (for complex, recurring conversion logic)\n\nGoals are associated with attribution models for campaign attribution.\n\nRelevant documentation:\n- [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/goals":{"get":{"tags":["Goals"],"description":"","operationId":"list","parameters":[{"style":"form","in":"query","name":"organisation_id","description":"The organisation id to search into","schema":{"type":"integer","format":"int64"},"required":true,"explode":true},{"schema":{"type":"integer","format":"int64"},"style":"form","in":"query","name":"datamart_id","description":"The Datamart id to search into","required":false,"explode":true},{"style":"form","explode":true,"in":"query","description":"The keywords to match with goal name","name":"keywords","required":false,"schema":{"type":"string"}},{"style":"form","schema":{"type":"boolean"},"name":"archived","in":"query","explode":true,"description":"Whether to filter with archived or not","required":false},{"schema":{"type":"array","items":{"type":"string"}},"explode":true,"name":"order_by","style":"form","description":"Fields used to order the result","required":false,"in":"query"},{"description":"Label id","explode":true,"name":"label_id","in":"query","schema":{"type":"array","items":{"type":"integer","format":"int64"}},"required":false,"style":"form"},{"required":false,"name":"first_result","style":"form","in":"query","description":"Offset from which the search must be performed","explode":true,"schema":{"type":"integer","format":"int32"}},{"description":"Number of maximum items that shall be return by this search","explode":true,"name":"max_results","required":false,"in":"query","schema":{"type":"integer","format":"int32"},"style":"form"},{"in":"query","name":"status","description":"Goal's status ACTIVE or PAUSED","explode":true,"schema":{"$ref":"#/components/schemas/GoalStatus"},"required":false,"style":"form"}],"summary":"Search every goal for an organisation","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"count":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/GoalResource"}},"first_result":{"type":"integer"},"total":{"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"}}}}},"components":{"schemas":{"GoalStatus":{"type":"string","enum":["PAUSED","ACTIVE"],"readOnly":false},"GoalResource":{"type":"object","properties":{"new_query_id":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"technical_name":{"type":"string","readOnly":false},"goal_value_currency":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"query_id":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/GoalStatus"},"datamart_id":{"type":"string","readOnly":false},"default_goal_value":{"type":"number","format":"float","default":0,"readOnly":false},"name":{"type":"string","readOnly":false}},"required":["archived","datamart_id","id","organisation_id","status"]},"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 /goals

> Creates a new goal feed for the specified organisation

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Goals","description":"Operations related to **Goals**, the conversion events and objectives tracked for campaign optimization and measurement. Goals can be triggered:\n- Via **tracking pixels** (for one-time conversions on confirmation pages)\n- Via **OTQL query rules** (for complex, recurring conversion logic)\n\nGoals are associated with attribution models for campaign attribution.\n\nRelevant documentation:\n- [Conversions tracking](https://developer.mediarithmics.io/data-ingestion/real-time-user-tracking/conversions)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/goals":{"post":{"description":"","operationId":"createGoal","requestBody":{"description":"Data of the goal to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalResource"}}},"required":true},"parameters":[{"description":"The organisation to create the new goal into","style":"form","schema":{"type":"integer","format":"int64"},"in":"query","required":true,"explode":true,"name":"organisation_id"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/GoalResource"}},"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":"Creates a new goal feed for the specified organisation","tags":["Goals"]}}},"components":{"schemas":{"GoalResource":{"type":"object","properties":{"new_query_id":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"technical_name":{"type":"string","readOnly":false},"goal_value_currency":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"query_id":{"type":"string","readOnly":false},"status":{"$ref":"#/components/schemas/GoalStatus"},"datamart_id":{"type":"string","readOnly":false},"default_goal_value":{"type":"number","format":"float","default":0,"readOnly":false},"name":{"type":"string","readOnly":false}},"required":["archived","datamart_id","id","organisation_id","status"]},"GoalStatus":{"type":"string","enum":["PAUSED","ACTIVE"],"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-management/goals.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.
