Campaigns

Manage campaigns

Get campaigns of the account environment

get

Return the list of the campaigns of the account environment

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

Query parameters
_pageintegerOptional

Index of the page

Example: 0
_max_per_pageintegerOptional

Number of items per page

Example: 10
Responses
200

Success

application/json
Responseall of
get
GET /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "current_item_count": 1,
  "current_page": 0,
  "total_count": 1,
  "items_per_page": 10,
  "last_page": 1,
  "items": [
    {
      "id": "text",
      "project_id": "text",
      "name": "text",
      "slug": "text",
      "description": "text",
      "type": "ab",
      "status": "draft",
      "variation_groups": [
        {
          "id": "text",
          "name": "text",
          "variations": [
            {
              "id": "text",
              "name": "text",
              "reference": true,
              "allocation": 1,
              "modifications": {
                "type": "text",
                "value": {}
              }
            }
          ],
          "targeting": {
            "targeting_groups": [
              {
                "targetings": [
                  {
                    "key": "text",
                    "operator": "EQUALS",
                    "value": "text"
                  }
                ]
              }
            ]
          },
          "allocation_config": {
            "start_date": "2025-09-08T13:14:59.370Z",
            "timezone": "text",
            "start_allocation": 1,
            "periodic_steps": {
              "allocation_step": 1,
              "step": 1,
              "step_type": "day"
            },
            "custom_steps": [
              {
                "allocation_step": 1,
                "step": 1,
                "step_type": "day"
              }
            ],
            "rollback_condition": {
              "goal": {
                "type": "transaction",
                "id": "text",
                "label": "text",
                "operator": "contains",
                "value": "text"
              },
              "operator": "GREATER_THAN",
              "value": 1,
              "min_visitors": 1
            }
          }
        }
      ],
      "scheduler": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "stop_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text"
      },
      "created_at": "2025-09-08T13:14:59.370Z",
      "updated_at": "2025-09-08T13:14:59.370Z",
      "primary_goal": {
        "type": "transaction",
        "id": "text",
        "label": "text",
        "operator": "contains",
        "value": "text",
        "metrics": [
          "uniqueConversions"
        ]
      },
      "secondary_goals": [
        {
          "type": "transaction",
          "id": "text",
          "label": "text",
          "operator": "contains",
          "value": "text"
        },
        {
          "metrics": [
            "uniqueConversions"
          ]
        }
      ]
    }
  ]
}

Create a campaign

post

Create a campaign

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

Body
idstringRead-onlyOptional

ID of the campaign

project_idstringRequired

ID of the campaign's project

namestringRequired

Name of the campaign

slugstringOptional

Slug of the campaign

descriptionstringRequired

Description of the campaign

typestring · enumRequired

Type of the campaign

Possible values:
statusstring · enumRead-onlyOptional

Status of the campaign

Possible values:
created_atstring · date-timeRead-onlyOptional

Creation date of campaign

updated_atstring · date-timeRead-onlyOptional

Update date of the campaign

primary_goalall ofOptional
secondary_goalsall of[]Optional

Secondary goals of the campaign

Responses
201

Created

application/json
post
POST /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1080

{
  "project_id": "text",
  "name": "text",
  "slug": "text",
  "description": "text",
  "type": "ab",
  "variation_groups": [
    {
      "name": "text",
      "variations": [
        {
          "name": "text",
          "reference": true,
          "allocation": 1,
          "modifications": {
            "type": "text",
            "value": {}
          }
        }
      ],
      "targeting": {
        "targeting_groups": [
          {
            "targetings": [
              {
                "key": "text",
                "operator": "EQUALS",
                "value": "text"
              }
            ]
          }
        ]
      },
      "allocation_config": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text",
        "start_allocation": 1,
        "periodic_steps": {
          "allocation_step": 1,
          "step": 1,
          "step_type": "day"
        },
        "custom_steps": [
          {
            "allocation_step": 1,
            "step": 1,
            "step_type": "day"
          }
        ],
        "rollback_condition": {
          "goal": {
            "type": "transaction",
            "label": "text",
            "operator": "contains",
            "value": "text"
          },
          "operator": "GREATER_THAN",
          "value": 1,
          "min_visitors": 1
        }
      }
    }
  ],
  "scheduler": {
    "start_date": "2025-09-08T13:14:59.370Z",
    "stop_date": "2025-09-08T13:14:59.370Z",
    "timezone": "text"
  },
  "primary_goal": {
    "type": "transaction",
    "label": "text",
    "operator": "contains",
    "value": "text",
    "metrics": [
      "uniqueConversions"
    ]
  },
  "secondary_goals": [
    {
      "type": "transaction",
      "label": "text",
      "operator": "contains",
      "value": "text"
    },
    {
      "metrics": [
        "uniqueConversions"
      ]
    }
  ]
}
{
  "id": "text",
  "project_id": "text",
  "name": "text",
  "slug": "text",
  "description": "text",
  "type": "ab",
  "status": "draft",
  "variation_groups": [
    {
      "id": "text",
      "name": "text",
      "variations": [
        {
          "id": "text",
          "name": "text",
          "reference": true,
          "allocation": 1,
          "modifications": {
            "type": "text",
            "value": {}
          }
        }
      ],
      "targeting": {
        "targeting_groups": [
          {
            "targetings": [
              {
                "key": "text",
                "operator": "EQUALS",
                "value": "text"
              }
            ]
          }
        ]
      },
      "allocation_config": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text",
        "start_allocation": 1,
        "periodic_steps": {
          "allocation_step": 1,
          "step": 1,
          "step_type": "day"
        },
        "custom_steps": [
          {
            "allocation_step": 1,
            "step": 1,
            "step_type": "day"
          }
        ],
        "rollback_condition": {
          "goal": {
            "type": "transaction",
            "id": "text",
            "label": "text",
            "operator": "contains",
            "value": "text"
          },
          "operator": "GREATER_THAN",
          "value": 1,
          "min_visitors": 1
        }
      }
    }
  ],
  "scheduler": {
    "start_date": "2025-09-08T13:14:59.370Z",
    "stop_date": "2025-09-08T13:14:59.370Z",
    "timezone": "text"
  },
  "created_at": "2025-09-08T13:14:59.370Z",
  "updated_at": "2025-09-08T13:14:59.370Z",
  "primary_goal": {
    "type": "transaction",
    "id": "text",
    "label": "text",
    "operator": "contains",
    "value": "text",
    "metrics": [
      "uniqueConversions"
    ]
  },
  "secondary_goals": [
    {
      "type": "transaction",
      "id": "text",
      "label": "text",
      "operator": "contains",
      "value": "text"
    },
    {
      "metrics": [
        "uniqueConversions"
      ]
    }
  ]
}

Get one campaign

get

Return one campaign by its id

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

campaign_idstringRequired

The ID of the campaign

Responses
200

Success

application/json
get
GET /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id} HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "id": "text",
  "project_id": "text",
  "name": "text",
  "slug": "text",
  "description": "text",
  "type": "ab",
  "status": "draft",
  "variation_groups": [
    {
      "id": "text",
      "name": "text",
      "variations": [
        {
          "id": "text",
          "name": "text",
          "reference": true,
          "allocation": 1,
          "modifications": {
            "type": "text",
            "value": {}
          }
        }
      ],
      "targeting": {
        "targeting_groups": [
          {
            "targetings": [
              {
                "key": "text",
                "operator": "EQUALS",
                "value": "text"
              }
            ]
          }
        ]
      },
      "allocation_config": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text",
        "start_allocation": 1,
        "periodic_steps": {
          "allocation_step": 1,
          "step": 1,
          "step_type": "day"
        },
        "custom_steps": [
          {
            "allocation_step": 1,
            "step": 1,
            "step_type": "day"
          }
        ],
        "rollback_condition": {
          "goal": {
            "type": "transaction",
            "id": "text",
            "label": "text",
            "operator": "contains",
            "value": "text"
          },
          "operator": "GREATER_THAN",
          "value": 1,
          "min_visitors": 1
        }
      }
    }
  ],
  "scheduler": {
    "start_date": "2025-09-08T13:14:59.370Z",
    "stop_date": "2025-09-08T13:14:59.370Z",
    "timezone": "text"
  },
  "created_at": "2025-09-08T13:14:59.370Z",
  "updated_at": "2025-09-08T13:14:59.370Z",
  "primary_goal": {
    "type": "transaction",
    "id": "text",
    "label": "text",
    "operator": "contains",
    "value": "text",
    "metrics": [
      "uniqueConversions"
    ]
  },
  "secondary_goals": [
    {
      "type": "transaction",
      "id": "text",
      "label": "text",
      "operator": "contains",
      "value": "text"
    },
    {
      "metrics": [
        "uniqueConversions"
      ]
    }
  ]
}

Delete a campaign

delete

Delete a campaign by its id.

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

campaign_idstringRequired

The ID of the campaign

Responses
204

Deleted

No content

delete
DELETE /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id} HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Accept: */*

No content

Update a campaign

patch

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

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

campaign_idstringRequired

The ID of the campaign

Body
idstringRead-onlyOptional

ID of the campaign

project_idstringRequired

ID of the campaign's project

namestringRequired

Name of the campaign

slugstringOptional

Slug of the campaign

descriptionstringRequired

Description of the campaign

typestring · enumRequired

Type of the campaign

Possible values:
statusstring · enumRead-onlyOptional

Status of the campaign

Possible values:
created_atstring · date-timeRead-onlyOptional

Creation date of campaign

updated_atstring · date-timeRead-onlyOptional

Update date of the campaign

primary_goalall ofOptional
secondary_goalsall of[]Optional

Secondary goals of the campaign

Responses
200

Updated

application/json
patch
PATCH /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id} HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1080

{
  "project_id": "text",
  "name": "text",
  "slug": "text",
  "description": "text",
  "type": "ab",
  "variation_groups": [
    {
      "name": "text",
      "variations": [
        {
          "name": "text",
          "reference": true,
          "allocation": 1,
          "modifications": {
            "type": "text",
            "value": {}
          }
        }
      ],
      "targeting": {
        "targeting_groups": [
          {
            "targetings": [
              {
                "key": "text",
                "operator": "EQUALS",
                "value": "text"
              }
            ]
          }
        ]
      },
      "allocation_config": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text",
        "start_allocation": 1,
        "periodic_steps": {
          "allocation_step": 1,
          "step": 1,
          "step_type": "day"
        },
        "custom_steps": [
          {
            "allocation_step": 1,
            "step": 1,
            "step_type": "day"
          }
        ],
        "rollback_condition": {
          "goal": {
            "type": "transaction",
            "label": "text",
            "operator": "contains",
            "value": "text"
          },
          "operator": "GREATER_THAN",
          "value": 1,
          "min_visitors": 1
        }
      }
    }
  ],
  "scheduler": {
    "start_date": "2025-09-08T13:14:59.370Z",
    "stop_date": "2025-09-08T13:14:59.370Z",
    "timezone": "text"
  },
  "primary_goal": {
    "type": "transaction",
    "label": "text",
    "operator": "contains",
    "value": "text",
    "metrics": [
      "uniqueConversions"
    ]
  },
  "secondary_goals": [
    {
      "type": "transaction",
      "label": "text",
      "operator": "contains",
      "value": "text"
    },
    {
      "metrics": [
        "uniqueConversions"
      ]
    }
  ]
}
{
  "id": "text",
  "project_id": "text",
  "name": "text",
  "slug": "text",
  "description": "text",
  "type": "ab",
  "status": "draft",
  "variation_groups": [
    {
      "id": "text",
      "name": "text",
      "variations": [
        {
          "id": "text",
          "name": "text",
          "reference": true,
          "allocation": 1,
          "modifications": {
            "type": "text",
            "value": {}
          }
        }
      ],
      "targeting": {
        "targeting_groups": [
          {
            "targetings": [
              {
                "key": "text",
                "operator": "EQUALS",
                "value": "text"
              }
            ]
          }
        ]
      },
      "allocation_config": {
        "start_date": "2025-09-08T13:14:59.370Z",
        "timezone": "text",
        "start_allocation": 1,
        "periodic_steps": {
          "allocation_step": 1,
          "step": 1,
          "step_type": "day"
        },
        "custom_steps": [
          {
            "allocation_step": 1,
            "step": 1,
            "step_type": "day"
          }
        ],
        "rollback_condition": {
          "goal": {
            "type": "transaction",
            "id": "text",
            "label": "text",
            "operator": "contains",
            "value": "text"
          },
          "operator": "GREATER_THAN",
          "value": 1,
          "min_visitors": 1
        }
      }
    }
  ],
  "scheduler": {
    "start_date": "2025-09-08T13:14:59.370Z",
    "stop_date": "2025-09-08T13:14:59.370Z",
    "timezone": "text"
  },
  "created_at": "2025-09-08T13:14:59.370Z",
  "updated_at": "2025-09-08T13:14:59.370Z",
  "primary_goal": {
    "type": "transaction",
    "id": "text",
    "label": "text",
    "operator": "contains",
    "value": "text",
    "metrics": [
      "uniqueConversions"
    ]
  },
  "secondary_goals": [
    {
      "type": "transaction",
      "id": "text",
      "label": "text",
      "operator": "contains",
      "value": "text"
    },
    {
      "metrics": [
        "uniqueConversions"
      ]
    }
  ]
}

Toggle a campaign state

patch

Switch the state of the campaign to active/inactive.

Authorizations
Path parameters
account_idstringRequired

The ID of the account

account_environment_idstringRequired

The ID of the environment

campaign_idstringRequired

The ID of the campaign

Body
statestring · enumRequired

State of the toggler

Possible values:
Responses
200

Updated

No content

patch
PATCH /v1/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/toggle HTTP/1.1
Host: api.flagship.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "state": "draft"
}

No content

Was this helpful?