Introduction
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
All endpoints require an API key that belongs to your account. You can pass the exact same key in whichever channel is most convenient for your client:
-
Custom header (recommended)
ADMAILR-ADS-API-KEY: your-api-key-here -
HTTP Bearer token
Authorization: Bearer your-api-key-here -
Query parameter
GET /api/campaigns?admailr-ads-api-key=your-api-key-here
Example requests in this documentation default to option 1 so that the generated curl, JavaScript, and Postman snippets are explicit about the required header. If you use a different option, the key must still match exactly.
Banners
List banner sizes
requires authentication
Returns the creative dimensions that can be used when uploading banners.
Use the name field from this list for the banner type payload.
List banners for a campaign
requires authentication
Returns the paginated set of creative assets attached to a campaign.
Upload a new banner
requires authentication
Creates a creative for the specified campaign. The image must already match one of the allowed banner sizes.
Show a banner
requires authentication
Update a banner
requires authentication
Send a multipart request if you are replacing the image, otherwise JSON is sufficient.
Delete a banner
requires authentication
Marks the banner as deleted and removes it from the rotation.
Campaign categories
List available categories
requires authentication
Fetches the latest taxonomy directly from the Admailr Behavior API.
Example request:
curl --request GET \
--get "https://api.admailr.com/api/campaigns/categories" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/categories"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"code": 144,
"label": "7-12 Education"
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Campaign lifecycle
Cancel a campaign
requires authentication
Example request:
curl --request PATCH \
"https://api.admailr.com/api/campaigns/107/cancel" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/107/cancel"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Campaign cancelled."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Start a campaign
requires authentication
Performs the lightweight preflight checks before activation. Only newly created campaigns in waiting state are accepted.
Example request:
curl --request PATCH \
"https://api.admailr.com/api/campaigns/107/start" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/107/start"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Start request accepted."
}
Example response (422):
{
"success": false,
"message": "Only newly created campaigns can be started via this endpoint."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Run a campaign
requires authentication
Runs the legacy activation checks (budget, spend, approvals) and queues the campaign for delivery. Only paused campaigns are allowed. Running campaigns quickly fail.
Example request:
curl --request PATCH \
"https://api.admailr.com/api/campaigns/107/run" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/107/run"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Campaign running."
}
Example response (422):
{
"success": false,
"message": "Campaign can only be activated from a paused state."
}
Example response (422):
{
"success": false,
"message": "Insufficient funds."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Pause a campaign
requires authentication
Example request:
curl --request PATCH \
"https://api.admailr.com/api/campaigns/107/pause" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/107/pause"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Campaign paused."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Campaigns
List campaigns
requires authentication
Retrieve a paginated list of campaigns that belong to the authenticated advertiser.
Example request:
curl --request GET \
--get "https://api.admailr.com/api/campaigns?page=1&per_page=50" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns"
);
const params = {
"page": "1",
"per_page": "50",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"id": 17,
"campaign_name": "Spring Retargeting",
"status": "approved",
"category_ids": [
12,
44
]
}
],
"links": {
"first": "https://api.localhost/api/campaigns?page=1",
"last": "https://api.localhost/api/campaigns?page=5",
"prev": null,
"next": "https://api.localhost/api/campaigns?page=2"
},
"meta": {
"current_page": 1,
"per_page": 20,
"total": 100
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create a new campaign
requires authentication
Example request:
curl --request POST \
"https://api.admailr.com/api/campaigns" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"advertiserName\": \"\\\"Acme Media\\\"\",
\"campaignName\": \"\\\"Q1 Retargeting\\\"\",
\"campaignCategories\": [
108,
116
]
}"
const url = new URL(
"https://api.admailr.com/api/campaigns"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"advertiserName": "\"Acme Media\"",
"campaignName": "\"Q1 Retargeting\"",
"campaignCategories": [
108,
116
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Ad Campaign successfully saved.",
"campaign": 123
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Show campaign details
requires authentication
Example request:
curl --request GET \
--get "https://api.admailr.com/api/campaigns/107" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/107"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": {
"id": 123,
"campaign_name": "Q1 Retargeting",
"status": "approved",
"category_ids": [
108,
116
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update a campaign
requires authentication
Example request:
curl --request PUT \
"https://api.admailr.com/api/campaigns/107" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"campaignName\": \"\\\"Holiday Push\\\"\",
\"advertiserName\": \"\\\"Acme Media\\\"\",
\"dateStart\": \"2025-01-01\",
\"dateEnd\": \"2025-02-01\",
\"campaignCategories\": [
108,
116
],
\"campaignCountries\": [
0
],
\"campaignDevices\": [
1,
3
],
\"campaignDemography\": [
{
\"gender\": 1,
\"from\": 25,
\"to\": 34
}
],
\"cpc\": 0.45,
\"spendGoal\": \"\\\"daily\\\"\",
\"dailySpend\": 150,
\"weeklySpend\": 1000
}"
const url = new URL(
"https://api.admailr.com/api/campaigns/107"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"campaignName": "\"Holiday Push\"",
"advertiserName": "\"Acme Media\"",
"dateStart": "2025-01-01",
"dateEnd": "2025-02-01",
"campaignCategories": [
108,
116
],
"campaignCountries": [
0
],
"campaignDevices": [
1,
3
],
"campaignDemography": [
{
"gender": 1,
"from": 25,
"to": 34
}
],
"cpc": 0.45,
"spendGoal": "\"daily\"",
"dailySpend": 150,
"weeklySpend": 1000
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"success": true,
"message": "Campaign updated.",
"campaignData": {
"id": 123,
"status": "approved"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Campaign targeting
List available devices
requires authentication
Returns the device codes and labels supported by the campaignDevices payload field.
Example request:
curl --request GET \
--get "https://api.admailr.com/api/campaigns/devices" \
--header "ADMAILR-ADS-API-KEY: your-api-key-here" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.admailr.com/api/campaigns/devices"
);
const headers = {
"ADMAILR-ADS-API-KEY": "your-api-key-here",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"code": 1,
"label": "Mobile Android"
},
{
"code": 3,
"label": "Tablet Android"
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.