> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/server-side/remote-control-api/goals.md).

# Goals

Goals

## Get goals of the account environment

> Return the list of the goals of the account environment

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Goals","description":"Goals"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"_page":{"name":"_page","in":"query","description":"Index of the page","schema":{"type":"integer"}},"_max_per_page":{"name":"_max_per_page","in":"query","description":"Number of items per page","schema":{"type":"integer"}}},"schemas":{"ItemCollection":{"properties":{"current_item_count":{"description":"Returns the number of items in the current page","type":"integer","format":"int"},"current_page":{"description":"Returns the number of the current page","type":"integer","format":"int","default":0},"total_count":{"description":"Returns the number of total items","type":"integer","format":"int"},"items_per_page":{"title":"Items per page","description":"Returns the number of items per page","type":"integer","format":"int","default":10},"last_page":{"title":"Last page","description":"Returns the index of the page","type":"integer","format":"int"}},"type":"object"},"GoalWithType":{"allOf":[{"$ref":"#/components/schemas/GoalType"},{"$ref":"#/components/schemas/Goal"}]},"GoalType":{"properties":{"type":{"description":"Type of the goal","type":"string","enum":["transaction","event","pageview","screenview"]}},"type":"object"},"Goal":{"required":["label"],"properties":{"id":{"description":"ID of the goal","type":"string","readOnly":true},"label":{"description":"Label of the goal","type":"string"},"operator":{"description":"Operator of the goal (for pageview, screenview types)","type":"string","enum":["contains","ignoringParameters","exact","regexp"]},"value":{"description":"Value of the goal (for pageview, screenview types)","type":"string"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/goals":{"get":{"tags":["Goals"],"summary":"Get goals of the account environment","description":"Return the list of the goals of the account environment","operationId":"d38adaab9d1304e9c95820489139ff64","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/_page"},{"$ref":"#/components/parameters/_max_per_page"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ItemCollection"},{"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/GoalWithType"}}},"type":"object"}]}}}},"404":{"description":"Not Found"}}}}}}
```

## Create a goal

> Create a goal

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Goals","description":"Goals"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}}},"schemas":{"GoalWithType":{"allOf":[{"$ref":"#/components/schemas/GoalType"},{"$ref":"#/components/schemas/Goal"}]},"GoalType":{"properties":{"type":{"description":"Type of the goal","type":"string","enum":["transaction","event","pageview","screenview"]}},"type":"object"},"Goal":{"required":["label"],"properties":{"id":{"description":"ID of the goal","type":"string","readOnly":true},"label":{"description":"Label of the goal","type":"string"},"operator":{"description":"Operator of the goal (for pageview, screenview types)","type":"string","enum":["contains","ignoringParameters","exact","regexp"]},"value":{"description":"Value of the goal (for pageview, screenview types)","type":"string"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/goals":{"post":{"tags":["Goals"],"summary":"Create a goal","description":"Create a goal","operationId":"3b7f536ce89b1910497e73ebd2fd941f","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"}],"requestBody":{"description":"Informations of the goal","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalWithType"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalWithType"}}}},"400":{"description":"Validation errors"}}}}}}
```

## Get one goal

> Return one goal by its id

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Goals","description":"Goals"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"goal_id":{"name":"goal_id","in":"path","description":"The ID of the goal","required":true,"schema":{"type":"string"}}},"schemas":{"GoalWithType":{"allOf":[{"$ref":"#/components/schemas/GoalType"},{"$ref":"#/components/schemas/Goal"}]},"GoalType":{"properties":{"type":{"description":"Type of the goal","type":"string","enum":["transaction","event","pageview","screenview"]}},"type":"object"},"Goal":{"required":["label"],"properties":{"id":{"description":"ID of the goal","type":"string","readOnly":true},"label":{"description":"Label of the goal","type":"string"},"operator":{"description":"Operator of the goal (for pageview, screenview types)","type":"string","enum":["contains","ignoringParameters","exact","regexp"]},"value":{"description":"Value of the goal (for pageview, screenview types)","type":"string"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/goals/{goal_id}":{"get":{"tags":["Goals"],"summary":"Get one goal","description":"Return one goal by its id","operationId":"c9f10c3487c1d66d7d679609c9b32ad5","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/goal_id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalWithType"}}}},"404":{"description":"Not Found"}}}}}}
```

## Delete a goal

> Delete a goal by its id.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Goals","description":"Goals"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"goal_id":{"name":"goal_id","in":"path","description":"The ID of the goal","required":true,"schema":{"type":"string"}}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/goals/{goal_id}":{"delete":{"tags":["Goals"],"summary":"Delete a goal","description":"Delete a goal by its id.","operationId":"a5e50aa5cfe5a0ce7be4ad0075da1be3","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/goal_id"}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Not Found"},"409":{"description":"Conflict - Impossible to delete a goal linked to multiple campaigns"}}}}}}
```

## Update a goal

> Update goal informations - You can set only the properies you want to update in the request body.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Goals","description":"Goals"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"goal_id":{"name":"goal_id","in":"path","description":"The ID of the goal","required":true,"schema":{"type":"string"}}},"schemas":{"Goal":{"required":["label"],"properties":{"id":{"description":"ID of the goal","type":"string","readOnly":true},"label":{"description":"Label of the goal","type":"string"},"operator":{"description":"Operator of the goal (for pageview, screenview types)","type":"string","enum":["contains","ignoringParameters","exact","regexp"]},"value":{"description":"Value of the goal (for pageview, screenview types)","type":"string"}},"type":"object"},"GoalWithType":{"allOf":[{"$ref":"#/components/schemas/GoalType"},{"$ref":"#/components/schemas/Goal"}]},"GoalType":{"properties":{"type":{"description":"Type of the goal","type":"string","enum":["transaction","event","pageview","screenview"]}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/goals/{goal_id}":{"patch":{"tags":["Goals"],"summary":"Update a goal","description":"Update goal informations - You can set only the properies you want to update in the request body.","operationId":"4a2cc8b82898811874e71db0334d16db","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/goal_id"}],"requestBody":{"description":"Informations of the goal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Goal"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoalWithType"}}}},"400":{"description":"Validation errors"}}}}}}
```


---

# 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.abtasty.com/server-side/remote-control-api/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.
