Advertiser Ad Spend API

How to give your Advertiser access to the Ad Spend API.

Updated over a week ago

If you have an Advertiser that wants to see the cost of all campaigns that they are running with you then you can connect them to the Ad Spend API also referred to as the Cost API This is usually a request from advertisers that would like to see the daily cost for each conversion and publisher on a campaign.

Ad Spend API

The API allows the Swaarm advertiser tracking solutions or MMPs to query data on behalf of their advertisers from clients of Swaarm. The following fields are available.

  • Advertiser id - the id of the advertiser in the Swaarm system

  • Publisher ID - The source ID of the Swaarm Network

  • Advertiser name - the name of the advertiser in the Swaarm system Campaigns - a list of campaigns that belong to the advertisers

  • Campaign / Campaign id - the id of the campaign in swaarm

  • Campaign / Campaign name - the name of the campaign

  • Campaign / Campaign appId - the id of the app belonging to the campaign

  • Campaign / Stats - a list of campaign stats according to the start and end date in the initial request

  • Campaign / Stats / Conversions - number of paid events for this campaign Campaign / Stats / Clicks - number of clicks for this campaign

  • Campaign / Stats / Cost - the cost of this campaign for the advertiser in cents in USD

Request

The request can be made to https://INSERT_DOMAIN_HERE/costapi/advertisers using

the GET method.

The following params can be added to the query string:

  • start - the start date of the campaign in UTC time under the following format:

    • &start=YYYY-MM-DDTHH:MM:SS 1776-07-04T00:00:00

  • end - the end date of the campaign in UTC time under the following format:

    • &end=YYYY-MM-DDTHH:MM:SS 1776-07-04T00:00:00

  • advertisers - a list of access keys for the advertisers that should be retrieved.

    • The keys should be separated by a comma. E.g. x1, x2, x3

  • granularity - the time granularity of the stats data.

    • Can be one of HOUR/DAY/WEEK/MONTH/ YEAR

  • breakdown - The publisher source ID

    • E.g 197

Example Request

The following request retrieves the data for one advertiser from the 4th of June to the 6th of June:

https://api.buster.swaarm-clients.com/costapi/advertisers?advertisers=d77f9a35c736e7db7e23a28cc0feafe5&start=2022-07-04T00:00:00&end=2022-07-06T00:00:00&granularity=day&breakdown=publisher

Example Response

{
"advertisers": [
{
"id": "4",
"name": "Test Advertiser",
"campaigns": [
{
"id": "10",
"name": "Test Offer",
"stats": [
{
"clicks": 8,
"conversions": 0,
"cost": 0,
"end": "2021-07-16T00:00:00",
“publisherId”: "197",
"start": "2021-07-15T00:00:00"
},
{
"clicks": 4,
"conversions": 4,
"cost": 40000,
"end": "2021-07-17T00:00:00",
“publisherId”: "197",
"start": "2021-07-16T00:00:00"
}
]
},
{
"appId": "284882215",
"id": "3343",
"name": "Test Other offer",
"stats":[
{
"clicks":0,
"conversions":0,
"cost":0,
"end":"2021-07-16T00:00:00",
“publisherId”: "197",
"start":"2021-07-15T00:00:00"
},
{
"clicks":0,
"conversions":0,
"cost":0,
"end":"2021-07-17T00:00:00",
“publisherId”: "197",
"start":"2021-07-16T00:00:00"
}
]
}
]
}
]
}

Did this answer your question?