GET /campaigns
Retrieve campaign information.
Description
This endpoint allows you to retrieve all campaigns information filtered by their warehouse.
HTTP Request
GET https://api.andopen.com/campaigns
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
include | String | No | Comma-separated list of relationships to include |
Available Relationship Tree
The following relationship tree shows all available include paths:
campaigns
├── products
├── variants
├── variant_stock_levels
└── warehouse
Valid Include Paths
Based on the relationship tree above, these are the valid include parameter values:
| Path | Description | Levels |
|---|---|---|
products | Include campaign products | 1 |
products.variants | Include products with their variants | 2 |
products.variants.variant_stock_levels | Include products, variants, and stock levels | 3 |
products.variants.variant_stock_levels.warehouse | Include full inventory hierarchy | 4 |
Example Requests
curl -X GET \
'https://api.andopen.co/campaigns?include=products.variants.variant_stock_levels.warehouse'
Responses
The state field indicates the current status of the campaign and can have one of the following values:
| Value | Description |
|---|---|
available | Campaign is active and available for use |
archived | Campaign has been archived and is no longer active |
🟢 Success Response (200 Success)
{
"data": [
{
"id": "ee57e819-d0d8-44f2-9513-438ae025d2b9",
"type": "campaigns",
"attributes": {
"name": "Engineers birthday automation",
"description": "Automated campaign for gifting to segment Engineers",
"state": "available",
"archived_at": null,
"created_at": "2025-07-01T15:59:48.479Z",
"updated_at": "2025-07-01T15:59:48.479Z"
},
"relationships": {
"products": {
"data": [
{
"type": "products",
"id": "1e9c46b4-e38d-4db5-83c5-94c6ff466694"
},
{
"type": "products",
"id": "1e9c46b4-e38d-4db5-83c5-94c6ff466694"
},
{
"type": "products",
"id": "1e9c46b4-e38d-4db5-83c5-94c6ff466694"
}
]
}
}
},
{
"id": "8fbe59c2-2348-4faa-b4fd-1acfa02683e8",
"type": "campaigns",
"attributes": {
"name": "Engineers onboarding automation",
"description": "Automated campaign for gifting to segment Engineers",
"state": "available",
"archived_at": null,
"created_at": "2025-07-01T15:50:56.634Z",
"updated_at": "2025-07-01T15:50:56.634Z"
},
"relationships": {
"products": {
"data": [
{
"type": "products",
"id": "1cb105f0-863d-4203-9040-a1cebd976b0d"
},
{
"type": "products",
"id": "414f23ba-5086-4c56-b9d3-c647ee6d53eb"
}
]
}
}
}
],
"included": [
{
"id": "1e9c46b4-e38d-4db5-83c5-94c6ff466694",
"type": "products",
"attributes": {
"name": "Nicely Odd Candle",
"enabled": true,
"created_at": "2021-01-15T12:11:00.822Z",
"updated_at": "2025-07-01T18:00:16.953Z"
},
"relationships": {
"variants": {
"data": [
{
"type": "variants",
"id": "e234ed04-3d65-4116-b8d2-8e06b91e3804"
},
{
"type": "variants",
"id": "6f5d7c09-de58-4cde-ba45-4b40d195bb47"
},
{
"type": "variants",
"id": "e27cf6c4-6b0d-44ec-bf8b-8cf8d2e06d76"
}
]
}
}
},
{
"id": "1cb105f0-863d-4203-9040-a1cebd976b0d",
"type": "products",
"attributes": {
"name": "B&W Florist's Pick",
"enabled": true,
"created_at": "2021-08-26T13:17:45.274Z",
"updated_at": "2025-07-02T00:00:07.085Z"
},
"relationships": {
"variants": {
"data": [
{
"type": "variants",
"id": "af1bdf6e-9422-4dc8-975e-826efa76430d"
}
]
}
}
},
{
"id": "414f23ba-5086-4c56-b9d3-c647ee6d53eb",
"type": "products",
"attributes": {
"name": "Welcome to the team",
"enabled": true,
"created_at": "2021-05-28T16:47:28.133Z",
"updated_at": "2025-03-11T08:55:49.146Z"
},
"relationships": {
"variants": {
"data": [
{
"type": "variants",
"id": "9afc95aa-ce00-40ce-9acb-b4a32c5d92f8"
}
]
}
}
},
{
"id": "e234ed04-3d65-4116-b8d2-8e06b91e3804",
"type": "variants",
"attributes": {
"name": "Default Title",
"sku": "AO-HAY01-001",
"enabled": true,
"created_at": "2022-07-28T15:04:31.162Z",
"updated_at": "2023-02-02T12:57:52.685Z"
},
"relationships": {
"variant_stock_levels": {
"data": [
{
"type": "variant_stock_levels",
"id": "66d61ce7-ea1a-490a-aa69-2ebb261f595e"
}
]
}
}
},
{
"id": "6f5d7c09-de58-4cde-ba45-4b40d195bb47",
"type": "variants",
"attributes": {
"name": "Blue",
"sku": "AO-HAY01-001",
"enabled": false,
"created_at": "2021-01-15T12:11:05.788Z",
"updated_at": "2023-05-31T14:08:36.994Z"
},
"relationships": {
"variant_stock_levels": {
"data": [
{
"type": "variant_stock_levels",
"id": "d445bc34-ae57-4afd-a5a5-d5a3d5bad379"
}
]
}
}
},
{
"id": "e27cf6c4-6b0d-44ec-bf8b-8cf8d2e06d76",
"type": "variants",
"attributes": {
"name": "Yellow",
"sku": "AO-HAY02-002",
"enabled": false,
"created_at": "2021-01-15T12:11:01.538Z",
"updated_at": "2025-07-01T18:00:13.821Z"
},
"relationships": {
"variant_stock_levels": {
"data": [
{
"type": "variant_stock_levels",
"id": "5f8ff719-972f-457b-b846-18200620cd0a"
}
]
}
}
},
{
"id": "af1bdf6e-9422-4dc8-975e-826efa76430d",
"type": "variants",
"attributes": {
"name": "Default Title",
"sku": "BW-FLORIST",
"enabled": true,
"created_at": "2021-08-26T13:17:45.872Z",
"updated_at": "2022-10-12T04:17:27.645Z"
},
"relationships": {
"variant_stock_levels": {
"data": [
{
"type": "variant_stock_levels",
"id": "1e8d5b19-8e54-47c1-8f4e-fa316bb65cd3"
}
]
}
}
},
{
"id": "9afc95aa-ce00-40ce-9acb-b4a32c5d92f8",
"type": "variants",
"attributes": {
"name": "Default Title",
"sku": "AO-INV01-001",
"enabled": true,
"created_at": "2021-05-28T16:47:28.877Z",
"updated_at": "2023-09-18T15:56:09.303Z"
},
"relationships": {
"variant_stock_levels": {
"data": [
{
"type": "variant_stock_levels",
"id": "f1069ec5-41cf-4baf-8df0-d9695e6e71fc"
}
]
}
}
},
{
"id": "66d61ce7-ea1a-490a-aa69-2ebb261f595e",
"type": "variant_stock_levels",
"attributes": {
"available": 4,
"created_at": "2022-08-10T00:00:42.827Z",
"updated_at": "2025-02-12T11:55:52.168Z"
},
"relationships": {
"warehouse": {
"data": {
"type": "warehouses",
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c"
}
}
}
},
{
"id": "d445bc34-ae57-4afd-a5a5-d5a3d5bad379",
"type": "variant_stock_levels",
"attributes": {
"available": 4,
"created_at": "2021-09-02T14:21:56.576Z",
"updated_at": "2025-02-12T11:55:49.694Z"
},
"relationships": {
"warehouse": {
"data": {
"type": "warehouses",
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c"
}
}
}
},
{
"id": "5f8ff719-972f-457b-b846-18200620cd0a",
"type": "variant_stock_levels",
"attributes": {
"available": 50,
"created_at": "2021-09-02T14:21:56.970Z",
"updated_at": "2024-09-13T09:20:35.269Z"
},
"relationships": {
"warehouse": {
"data": {
"type": "warehouses",
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c"
}
}
}
},
{
"id": "1e8d5b19-8e54-47c1-8f4e-fa316bb65cd3",
"type": "variant_stock_levels",
"attributes": {
"available": 1000,
"created_at": "2021-09-02T14:46:22.044Z",
"updated_at": "2021-09-02T14:46:22.044Z"
},
"relationships": {
"warehouse": {
"data": {
"type": "warehouses",
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c"
}
}
}
},
{
"id": "f1069ec5-41cf-4baf-8df0-d9695e6e71fc",
"type": "variant_stock_levels",
"attributes": {
"available": 998,
"created_at": "2021-09-02T14:21:56.932Z",
"updated_at": "2024-03-07T16:44:26.917Z"
},
"relationships": {
"warehouse": {
"data": {
"type": "warehouses",
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c"
}
}
}
},
{
"id": "3f7f3b2c-1903-4ddb-ba7d-f5a3041db66c",
"type": "warehouses",
"attributes": {
"name": "Dublin/Ireland",
"enabled": true,
"created_at": "2021-09-02T14:21:26.238Z",
"updated_at": "2024-05-24T09:17:46.843Z"
}
}
],
"links": {
"next": "https://api.andopen.co/campaigns?include=products.variants.variant_stock_levels.warehouse&page[size]=100&page[after]=WyIyMDIzLTEwLTEyVDE0OjI5OjExLjIzNloiLCI5MTgxNjU5MS0wYTlkLTRhMWItYTEyMy1hZWUzNWRhOTQ4YWEiXQ",
"prev": null
},
"jsonapi": {
"version": "1.0"
}
}
Code Examples
- cURL
- Ruby
- JavaScript
- Java
- Python
- PHP
curl -X GET "https://api.andopen.com/campaigns" \
-H 'Content-Type: application/vnd.api+json' \
-H 'AndOpen-API-Version: 2025-09' \
-H "Authorization: Bearer <api_key>
require 'net/http'
require 'json'
uri = URI('https://api.andopen.com/campaigns')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/vnd.api+json'
request['Authorization'] = 'Bearer <api_key>'
request['AndOpen-API-Version'] = '2025-09'
response = http.request(request)
campaigns = JSON.parse(response.body)
fetch('https://api.andopen.com/campaigns', {
method: 'GET',
headers: {
'Content-Type': 'application/vnd.api+json',
'Authorization': 'Bearer <api_key>',
'AndOpen-API-Version': '2025-09'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
URL url = new URL("https://api.andopen.com/campaigns");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-Type", "application/vnd.api+json");
conn.setRequestProperty("Authorization", "Bearer <api_key>");
conn.setRequestProperty("AndOpen-API-Version", "2025-09");
int responseCode = conn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
}
import requests
url = "https://api.andopen.com/campaigns"
headers = {
"Content-Type": "application/vnd.api+json",
"Authorization": "Bearer <api_key>",
"AndOpen-API-Version": "2025-09"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
campaigns = response.json()
print(campaigns)
else:
print(f"Error: {response.status_code} - {response.text}")
<?php
$url = 'https://api.andopen.com/campaigns';
$headers = [
'Content-Type: application/vnd.api+json',
'Authorization: Bearer <api_key>',
'AndOpen-API-Version: 2025-09'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code === 200) {
$campaigns = json_decode($response, true);
print_r($campaigns);
} else {
echo "Error: HTTP " . $http_code . " - " . $response;
}
curl_close($ch);
?>