# Campaigns

Manage campaigns

## Get campaigns of the account environment

> Return the list of the campaigns of the account environment

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Campaigns","description":"Manage campaigns"}],"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"},"Campaign":{"required":["project_id","name","description","type","variationGroups"],"properties":{"id":{"description":"ID of the campaign","type":"string","readOnly":true},"project_id":{"description":"ID of the campaign's project","type":"string"},"name":{"description":"Name of the campaign","type":"string"},"slug":{"description":"Slug of the campaign","type":"string"},"description":{"description":"Description of the campaign","type":"string"},"type":{"description":"Type of the campaign","type":"string","enum":["ab","perso","deployment","flag","custom","toggle"]},"status":{"description":"Status of the campaign","type":"string","enum":["draft","active","paused","interrupted","hold","deleted"],"readOnly":true},"scheduler":{"$ref":"#/components/schemas/Scheduler"},"created_at":{"description":"Creation date of campaign","type":"string","format":"date-time","readOnly":true},"updated_at":{"description":"Update date of the campaign","type":"string","format":"date-time","readOnly":true},"primary_goal":{"$ref":"#/components/schemas/CampaignGoalVersioner"}},"type":"object"},"Scheduler":{"required":["start_date","timezone"],"properties":{"start_date":{"description":"Scheduler start date with format YYYY-mm-dd H:i:s. Example : 2022-02-01 10:00:00.","type":"string","format":"date-time"},"stop_date":{"description":"Scheduler end date with format YYYY-mm-dd H:i:s. Example : 2022-02-02 10:00:00","type":"string","format":"date-time"},"timezone":{"description":"Scheduler timezone. Example : Europe/Paris.","type":"string"}},"type":"object"},"CampaignGoalVersioner":{"type":"object","allOf":[{"$ref":"#/components/schemas/GoalWithType"},{"properties":{"metrics":{"description":"Metrics to be measured (for event, transaction goal types)","type":"array","items":{"type":"string","enum":["uniqueConversions","averageValue","value"]}}},"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}/campaigns":{"get":{"tags":["Campaigns"],"summary":"Get campaigns of the account environment","description":"Return the list of the campaigns of the account environment","operationId":"95de4e7d4ec4b9b27d2b553fef5c9158","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/Campaign"}}},"type":"object"}]}}}},"404":{"description":"Not Found"}}}}}}
```

## Create a campaign

> Create a campaign

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Campaigns","description":"Manage campaigns"}],"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":{"Campaign":{"required":["project_id","name","description","type","variationGroups"],"properties":{"id":{"description":"ID of the campaign","type":"string","readOnly":true},"project_id":{"description":"ID of the campaign's project","type":"string"},"name":{"description":"Name of the campaign","type":"string"},"slug":{"description":"Slug of the campaign","type":"string"},"description":{"description":"Description of the campaign","type":"string"},"type":{"description":"Type of the campaign","type":"string","enum":["ab","perso","deployment","flag","custom","toggle"]},"status":{"description":"Status of the campaign","type":"string","enum":["draft","active","paused","interrupted","hold","deleted"],"readOnly":true},"scheduler":{"$ref":"#/components/schemas/Scheduler"},"created_at":{"description":"Creation date of campaign","type":"string","format":"date-time","readOnly":true},"updated_at":{"description":"Update date of the campaign","type":"string","format":"date-time","readOnly":true},"primary_goal":{"$ref":"#/components/schemas/CampaignGoalVersioner"}},"type":"object"},"Scheduler":{"required":["start_date","timezone"],"properties":{"start_date":{"description":"Scheduler start date with format YYYY-mm-dd H:i:s. Example : 2022-02-01 10:00:00.","type":"string","format":"date-time"},"stop_date":{"description":"Scheduler end date with format YYYY-mm-dd H:i:s. Example : 2022-02-02 10:00:00","type":"string","format":"date-time"},"timezone":{"description":"Scheduler timezone. Example : Europe/Paris.","type":"string"}},"type":"object"},"CampaignGoalVersioner":{"type":"object","allOf":[{"$ref":"#/components/schemas/GoalWithType"},{"properties":{"metrics":{"description":"Metrics to be measured (for event, transaction goal types)","type":"array","items":{"type":"string","enum":["uniqueConversions","averageValue","value"]}}},"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}/campaigns":{"post":{"tags":["Campaigns"],"summary":"Create a campaign","description":"Create a campaign","operationId":"262164e9902986956d4f008ecc296d9c","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"}],"requestBody":{"description":"Informations of the campaign","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"description":"Validation errors"}}}}}}
```

## Get one campaign

> Return one campaign by its id

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Campaigns","description":"Manage campaigns"}],"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"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}}},"schemas":{"Campaign":{"required":["project_id","name","description","type","variationGroups"],"properties":{"id":{"description":"ID of the campaign","type":"string","readOnly":true},"project_id":{"description":"ID of the campaign's project","type":"string"},"name":{"description":"Name of the campaign","type":"string"},"slug":{"description":"Slug of the campaign","type":"string"},"description":{"description":"Description of the campaign","type":"string"},"type":{"description":"Type of the campaign","type":"string","enum":["ab","perso","deployment","flag","custom","toggle"]},"status":{"description":"Status of the campaign","type":"string","enum":["draft","active","paused","interrupted","hold","deleted"],"readOnly":true},"scheduler":{"$ref":"#/components/schemas/Scheduler"},"created_at":{"description":"Creation date of campaign","type":"string","format":"date-time","readOnly":true},"updated_at":{"description":"Update date of the campaign","type":"string","format":"date-time","readOnly":true},"primary_goal":{"$ref":"#/components/schemas/CampaignGoalVersioner"}},"type":"object"},"Scheduler":{"required":["start_date","timezone"],"properties":{"start_date":{"description":"Scheduler start date with format YYYY-mm-dd H:i:s. Example : 2022-02-01 10:00:00.","type":"string","format":"date-time"},"stop_date":{"description":"Scheduler end date with format YYYY-mm-dd H:i:s. Example : 2022-02-02 10:00:00","type":"string","format":"date-time"},"timezone":{"description":"Scheduler timezone. Example : Europe/Paris.","type":"string"}},"type":"object"},"CampaignGoalVersioner":{"type":"object","allOf":[{"$ref":"#/components/schemas/GoalWithType"},{"properties":{"metrics":{"description":"Metrics to be measured (for event, transaction goal types)","type":"array","items":{"type":"string","enum":["uniqueConversions","averageValue","value"]}}},"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}/campaigns/{campaign_id}":{"get":{"tags":["Campaigns"],"summary":"Get one campaign","description":"Return one campaign by its id","operationId":"fdfe1f898dc7962ec0681ec7b2c28039","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"404":{"description":"Not Found"}}}}}}
```

## Delete a campaign

> Delete a campaign by its id.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Campaigns","description":"Manage campaigns"}],"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"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}":{"delete":{"tags":["Campaigns"],"summary":"Delete a campaign","description":"Delete a campaign by its id.","operationId":"1a331f011981919d31c616c73856b948","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Not Found"}}}}}}
```

## Update a campaign

> Update campaign 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":"Campaigns","description":"Manage campaigns"}],"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"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}}},"schemas":{"Campaign":{"required":["project_id","name","description","type","variationGroups"],"properties":{"id":{"description":"ID of the campaign","type":"string","readOnly":true},"project_id":{"description":"ID of the campaign's project","type":"string"},"name":{"description":"Name of the campaign","type":"string"},"slug":{"description":"Slug of the campaign","type":"string"},"description":{"description":"Description of the campaign","type":"string"},"type":{"description":"Type of the campaign","type":"string","enum":["ab","perso","deployment","flag","custom","toggle"]},"status":{"description":"Status of the campaign","type":"string","enum":["draft","active","paused","interrupted","hold","deleted"],"readOnly":true},"scheduler":{"$ref":"#/components/schemas/Scheduler"},"created_at":{"description":"Creation date of campaign","type":"string","format":"date-time","readOnly":true},"updated_at":{"description":"Update date of the campaign","type":"string","format":"date-time","readOnly":true},"primary_goal":{"$ref":"#/components/schemas/CampaignGoalVersioner"}},"type":"object"},"Scheduler":{"required":["start_date","timezone"],"properties":{"start_date":{"description":"Scheduler start date with format YYYY-mm-dd H:i:s. Example : 2022-02-01 10:00:00.","type":"string","format":"date-time"},"stop_date":{"description":"Scheduler end date with format YYYY-mm-dd H:i:s. Example : 2022-02-02 10:00:00","type":"string","format":"date-time"},"timezone":{"description":"Scheduler timezone. Example : Europe/Paris.","type":"string"}},"type":"object"},"CampaignGoalVersioner":{"type":"object","allOf":[{"$ref":"#/components/schemas/GoalWithType"},{"properties":{"metrics":{"description":"Metrics to be measured (for event, transaction goal types)","type":"array","items":{"type":"string","enum":["uniqueConversions","averageValue","value"]}}},"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}/campaigns/{campaign_id}":{"patch":{"tags":["Campaigns"],"summary":"Update a campaign","description":"Update campaign informations - You can set only the properies you want to update in the request body.","operationId":"e3e6aaee25528da22b390f4af3c93482","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"}],"requestBody":{"description":"Informations of the campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"description":"Validation errors"}}}}}}
```

## Toggle a campaign state

> Switch the state of the campaign to active/inactive.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Campaigns","description":"Manage campaigns"}],"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"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}}},"schemas":{"Toggler":{"required":["state"],"properties":{"state":{"description":"State of the toggler","type":"string","enum":["draft","active","paused","interrupted","hold","deleted"]}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/toggle":{"patch":{"tags":["Campaigns"],"summary":"Toggle a campaign state","description":"Switch the state of the campaign to active/inactive.","operationId":"adf135160847c38ce9ecc8397f4945b2","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"}],"requestBody":{"description":"Informations of the state","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Toggler"}}}},"responses":{"200":{"description":"Updated"},"404":{"description":"Not Found"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/server-side/remote-control-api/campaigns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
