MENU navbar-image

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:

  1. Custom header (recommended)

    ADMAILR-ADS-API-KEY: your-api-key-here
  2. HTTP Bearer token

    Authorization: Bearer your-api-key-here
  3. 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.

Example request:
curl --request GET \
    --get "https://api.admailr.com/api/campaigns/banner-sizes" \
    --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/banner-sizes"
);

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": [
        {
            "name": "300x250 (Medium Rectangle)"
        }
    ]
}
 

Request      

GET api/campaigns/banner-sizes

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

List banners for a campaign

requires authentication

Returns the paginated set of creative assets attached to a campaign.

Example request:
curl --request GET \
    --get "https://api.admailr.com/api/campaigns/107/banners?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/107/banners"
);

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": 42,
            "type": "300x250",
            "redirect_link": "https://landing.example.com",
            "status": 1
        }
    ],
    "links": {
        "first": "https://api.localhost/api/campaigns/123/banners?page=1",
        "last": "https://api.localhost/api/campaigns/123/banners?page=5",
        "prev": null,
        "next": "https://api.localhost/api/campaigns/123/banners?page=2"
    },
    "meta": {
        "current_page": 1,
        "per_page": 20,
        "total": 75
    }
}
 

Request      

GET api/campaigns/{campaign_id}/banners

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

Query Parameters

page   integer  optional    

The page to return. Example: 1

per_page   integer  optional    

Number of banners per page (defaults to 20). Example: 50

Upload a new banner

requires authentication

Creates a creative for the specified campaign. The image must already match one of the allowed banner sizes.

Example request:
curl --request POST \
    "https://api.admailr.com/api/campaigns/107/banners" \
    --header "ADMAILR-ADS-API-KEY: your-api-key-here" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "type="300x250""\
    --form "redirect_link="https://landing.example.com""\
    --form "image=@/tmp/phpLtIrl1" 
const url = new URL(
    "https://api.admailr.com/api/campaigns/107/banners"
);

const headers = {
    "ADMAILR-ADS-API-KEY": "your-api-key-here",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('type', '"300x250"');
body.append('redirect_link', '"https://landing.example.com"');
body.append('image', document.querySelector('input[name="image"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 77,
        "type": "300x250",
        "redirect_link": "https://landing.example.com",
        "status": 1
    }
}
 

Request      

POST api/campaigns/{campaign_id}/banners

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: multipart/form-data

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

Body Parameters

image   file     

Banner image file (jpg, png, or gif). Example: /tmp/phpLtIrl1

type   string     

Banner size name as defined in the platform (eg. "300x250"). Fetch the allowed list via GET /api/campaigns/banner-sizes. Example: "300x250"

redirect_link   string     

HTTPS click-through URL. Example: "https://landing.example.com"

Show a banner

requires authentication

Example request:
curl --request GET \
    --get "https://api.admailr.com/api/campaigns/107/banners/2115067" \
    --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/banners/2115067"
);

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": 77,
        "type": "300x250",
        "redirect_link": "https://landing.example.com",
        "status": 1
    }
}
 

Request      

GET api/campaigns/{campaign_id}/banners/{id}

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

id   integer     

The ID of the banner. Example: 2115067

Update a banner

requires authentication

Send a multipart request if you are replacing the image, otherwise JSON is sufficient.

Example request:
curl --request PUT \
    "https://api.admailr.com/api/campaigns/107/banners/2115067" \
    --header "ADMAILR-ADS-API-KEY: your-api-key-here" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "type="728x90""\
    --form "redirect_link="https://landing.example.com/new""\
    --form "status=1"\
    --form "image=@/tmp/phpcI6n7C" 
const url = new URL(
    "https://api.admailr.com/api/campaigns/107/banners/2115067"
);

const headers = {
    "ADMAILR-ADS-API-KEY": "your-api-key-here",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('type', '"728x90"');
body.append('redirect_link', '"https://landing.example.com/new"');
body.append('status', '1');
body.append('image', document.querySelector('input[name="image"]').files[0]);

fetch(url, {
    method: "PUT",
    headers,
    body,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 77,
        "type": "728x90",
        "redirect_link": "https://landing.example.com/new",
        "status": 1
    }
}
 

Request      

PUT api/campaigns/{campaign_id}/banners/{id}

PATCH api/campaigns/{campaign_id}/banners/{id}

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: multipart/form-data

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

id   integer     

The ID of the banner. Example: 2115067

Body Parameters

image   file  optional    

The replacement creative (jpg, png, or gif). Example: /tmp/phpcI6n7C

type   string  optional    

Banner size name (must exist in platform, see GET /api/campaigns/banner-sizes). Example: "728x90"

redirect_link   string  optional    

HTTPS click URL. Example: "https://landing.example.com/new"

status   integer  optional    

Enable/disable flag (1 = active, 0 = disabled). Example: 1

Delete a banner

requires authentication

Marks the banner as deleted and removes it from the rotation.

Example request:
curl --request DELETE \
    "https://api.admailr.com/api/campaigns/107/banners/2115067" \
    --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/banners/2115067"
);

const headers = {
    "ADMAILR-ADS-API-KEY": "your-api-key-here",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Banner deleted."
}
 

Request      

DELETE api/campaigns/{campaign_id}/banners/{id}

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

id   integer     

The ID of the banner. Example: 2115067

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"
        }
    ]
}
 

Request      

GET api/campaigns/categories

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

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."
}
 

Request      

PATCH api/campaigns/{campaign_id}/cancel

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

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."
}
 

Request      

PATCH api/campaigns/{campaign_id}/start

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

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."
}
 

Request      

PATCH api/campaigns/{campaign_id}/run

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

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."
}
 

Request      

PATCH api/campaigns/{campaign_id}/pause

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

campaign_id   integer     

The ID of the campaign. Example: 107

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
    }
}
 

Request      

GET api/campaigns

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

The page number to return. Example: 1

per_page   integer  optional    

Number of items per page (defaults to 20). Example: 50

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
}
 

Request      

POST api/campaigns

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

advertiserName   string     

The advertiser/company name that will own the campaign. Example: "Acme Media"

campaignName   string     

The public campaign title. Example: "Q1 Retargeting"

campaignCategories   string[]     

codes of categories to target returned by GET api/campaigns/categories.

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
        ]
    }
}
 

Request      

GET api/campaigns/{id}

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the campaign. Example: 107

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"
    }
}
 

Request      

PUT api/campaigns/{id}

PATCH api/campaigns/{id}

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the campaign. Example: 107

Body Parameters

campaignName   string  optional    

The new campaign name. Example: "Holiday Push"

advertiserName   string  optional    

The advertiser display name. Example: "Acme Media"

dateStart   string  optional    

ISO or Y-m-d start date. Must be a valid date. Example: 2025-01-01

dateEnd   string  optional    

End date (must be after start). Must be a valid date. Must be a date after or equal to dateStart. Example: 2025-02-01

campaignCategories   string[]  optional    

The updated category codes returned by GET api/campaigns/categories.

campaignCountries   string[]  optional    

Limit delivery to these country IDs (0 = all, 224 = US).

campaignDevices   string[]  optional    

Device codes returned by GET api/campaigns/devices (1 = Mobile Android, 3 = Tablet Android).

campaignDemography   string[]  optional    

Array (or JSON string) of demographic rows; every item must include integer keys gender (0 = Not Specified, 1 = Male, 2 = Female), from, and to. Send an empty array or null to remove all saved demography rows for this campaign.

cpc   number  optional    

Cost-per-click bid in USD (minimum 0.01). Example: 0.45

spendGoal   string  optional    

Limit type, either "daily" or "weekly". Example: "daily"

dailySpend   number  optional    

Minimum $10 daily spend limit. Example: 150

weeklySpend   number  optional    

Minimum $100 weekly spend limit. Example: 1000

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"
        }
    ]
}
 

Request      

GET api/campaigns/devices

Headers

ADMAILR-ADS-API-KEY        

Example: your-api-key-here

Content-Type        

Example: application/json

Accept        

Example: application/json