To use Adcash API services you need to login in the API services with your website username and password by making a call to the following URL: E.g. 
curl —X POST -c cookies.txt —d "login=testaccount&password=testaccountpassword1234" 
Upon successful login, you will receive in JSON encoded output an authentication token, which you can use to call Adcash API services. This token is also stored in a cookie and the cookie must be passed on the following API requests. E.g. {"token":"6333531373034343433623663646836383165693937383167373264323334663"} 

Please note that a token is valid for up to 30 minutes.

Using Token to call Adcash API services 
Get publisher statistics

To get the statistics through the Adcash API services you need to call the following URL with a valid authentication token and passing parameter call with a value of Adcash API service name for extracting publisher statistics - get_publisher_detailed_statistics.
It is also important to pass the cookie file, in which the token from the authentication is stored.
curl -X POST -b cookies.txt —d "token=TOKEN&call=get_publisher_detailed_statistics&start_date=2018-08-02&end_date=2018-08-015" 

List of available parameters for "get_publisher_detailed_statistics” call: 

Parameter nameExample valueDescription
token6333531373034343433623663646 8363831656939373831673732643 23334663Valid authentication token obtained after a successful call to API login service.
callget_publisher_detailed_statistics Name of the API service you would like to call.
start_date2018-01-01Date in the following format: YYYY-MM-DD
end_date2018-02-01Date in the following format: YYYY-MM-DD
groupingOne-dimensional grouping: grouping=date

Multidimensional grouping: grouping[]=site&grouping[]=zone
Fields to group the statistics by. Possible values: site, zone, date, country, month, sub1, sub2 

Allows to group results by several dimensions.
filtersfilters[sites]=843893Allows you to filter statistics by several criteria
List of available filters:
Filter nameExample valueDescription
sites843893ID of a specific site
zones12345ID of a specific zone
countriesFICountry code
sub1abccer2SubID variable that you have sent in &sub1= parameter to the endpoint
sub218ergegeSubID variable that you have sent in &sub2= parameter to the endpoint

You can add several filters and use several values in each filter separated by a comma in your request. 


curl -X POST -b cookies.txt —d “...&filters[sites]=31792&filters[countries]=FR,DE&...” 

Upon a successful request, you will receive the statistics data in a JSON encoded output. 

{"rows":[{"site":"31792","impressions":1722,"fallback":0,"clicks":44,"earnings":0,"leads":0,"ecpm":0,"ctr":2.5551684088269},{"site":"112399","impressions":480,"fallback":0,"clicks":11,"earnings":0,"leads":0,"ecpm":0,"ctr":2.2916 666666667}],"totals":{"impressions":2202,"clicks":55,"leads":0,"earnings":0, "fallback":0,"ecpm":0,"ctr":2.4977293369664,"updated_at":"2014-08-12 16:28:24"}}