{"_id":"577fb48a9607d0190081af36","parentDoc":null,"version":{"_id":"574ff4bd3fa1870e00889ba9","project":"574ff4bd3fa1870e00889ba6","__v":21,"createdAt":"2016-06-02T08:56:29.492Z","releaseDate":"2016-06-02T08:56:29.492Z","categories":["574ff4bd3fa1870e00889baa","577278ecdceb570e003a9001","577279865617b117009e643f","577279985617b117009e6440","577279bc8c48e00e00503504","5774fe18605b770e0037be8a","577ce3ad87acf617003c4187","577f8476a77c700e006a6c52","57b486ae0d2b640e00e9d3f5","57b722133d3e620e004ec74b","57bd95f00fe3a00e003e2cc5","57c8349359cd4b0e00b888ef","57c8349b5754fa1700b12242","57cedb0bad483e0e00890239","57cedbe807d7ea0e00e438cc","57d82967156ef72b007ffcd8","58ee353ad1ee2f0f0034a13d","596623221738df00298622a5","59a51730192dba000fc9ca38","59a8129f1e7b26000fa0fb1a","5a0322bf044b6f001c236e36"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0"},"__v":13,"category":{"_id":"5774fe18605b770e0037be8a","__v":0,"project":"574ff4bd3fa1870e00889ba6","version":"574ff4bd3fa1870e00889ba9","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-06-30T11:10:16.206Z","from_sync":false,"order":1,"slug":"api-documentation","title":"API Documentation"},"project":"574ff4bd3fa1870e00889ba6","user":"5770dd042659e20e00c90a98","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-08T14:11:22.889Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","examples":{"codes":[]},"method":"get","auth":"required","params":[],"url":""},"isReference":true,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"API Access\"\n}\n[/block]\n##Getting an API key\nApp-specific API key:\n* Click Apps\n* Click Integration of the specific app you want\n* Reporting API token is the Reporting API key\nAccount-wide API key:\n* In the account menu, click Reporting API Key\n\n##API overview\nIt's a HTTP API, which tries to follow a RESTful design pattern. The results you get back will be in the JSON format.\n\n##Mandatory API call parameter\nEither account_auth_token or app_auth_token: \nWith the first one you can query for all apps under one account, with the latter only for that very app the token is for. Please note that the tokens will be different from each other, so you can't use one for another.\n* start_date: the format is dd/mm/yyyy and it needs to url encoded of course, so for example: 25%2F11%2F2013\n* end_date: The same that applies to start_date applies here as well\n* app_id: Since we try hard to be RESTful, this is encoded as part of the URL. Just have a look at the example below, it's the {app_id} in apps/{app_id}/...\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples\"\n}\n[/block]\n##Example API call by app-specific API key\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl http://dashboard.pubnative.net/api/v1/apps/{app_id}/reports?app_auth_token=YOURAPPTOKEN&start_date=25%2F11%2F2013&end_date=28%2F11%2F2013\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n\nThe result will be in JSON format and will look like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"reports\\\":[{\\\"date\\\":\\\"25/11/2013\\\",\\\"impressions\\\":95,\\\"clicks\\\":14,\\\"conversions\\\":1,\\\"revenues\\\":2.65,\\\"ctr\\\":14.74,\\\"cr\\\":7.14,\\\"end_to_end_cr\\\":1.05,\\\"ecpm\\\":27.89}]}\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n##Example API call for breakdown by country using an app-specific API key\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl https://dashboard.pubnative.net/api/v1/apps/{app_id}/reports/by_country?app_auth_token=YOURAPPTOKEN&start_date=25%2F11%2F2013&end_date=28%2F11%2F2013\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThe result will be in JSON format and will look like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{  \\n   \\\"reports\\\":[  \\n      {  \\n         \\\"date\\\":\\\"25/04/2014\\\",\\n         \\\"impressions\\\":1,\\n         \\\"clicks\\\":0,\\n         \\\"conversions\\\":0,\\n         \\\"revenues\\\":0.0,\\n         \\\"ctr\\\":0.0,\\n         \\\"cr\\\":0.0,\\n         \\\"end_to_end_cr\\\":0.0,\\n         \\\"ecpm\\\":0.0,\\n         \\\"country_code\\\":\\\"GP\\\"\\n      },\\n      {  \\n         \\\"date\\\":\\\"25/04/2014\\\",\\n         \\\"impressions\\\":8,\\n         \\\"clicks\\\":0,\\n         \\\"conversions\\\":0,\\n         \\\"revenues\\\":0.0,\\n         \\\"ctr\\\":0.0,\\n         \\\"cr\\\":0.0,\\n         \\\"end_to_end_cr\\\":0.0,\\n         \\\"ecpm\\\":0.0,\\n         \\\"country_code\\\":\\\"CF\\\"\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Account wide reports \n\nThis reporting endpoint can be used to get data of across the whole account - \n\nSample Request\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://dashboard.pubnative.net/api/reports?account_auth_token=YOURAPPTOKENYOURAPPTOKEN&start_date=07/11/2016&end_date=08/11/2016\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nSample Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"reports\\\": [\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 276115,\\n\\\"ecpm\\\": 0.43,\\n\\\"clicks\\\": 2551,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.92,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 118.49,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 175201,\\n\\\"ecpm\\\": \\\"0.48\\\",\\n\\\"clicks\\\": 222,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"iOS - We Heart It\\\",\\n\\\"ctr\\\": 0.13,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 84.81,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": \\\"0.04\\\",\\n\\\"impressions\\\": 242171,\\n\\\"ecpm\\\": 0.48,\\n\\\"clicks\\\": 2261,\\n\\\"conversions\\\": 1,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.93,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": \\\"115.2\\\",\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 142820,\\n\\\"ecpm\\\": 0.45,\\n\\\"clicks\\\": 173,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"iOS - We Heart It\\\",\\n\\\"ctr\\\": 0.12,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": 64.49,\\n\\\"end_to_end_cr\\\": 0\\n}\\n],\\n\\\"count_before_filtering\\\": 4\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Account wide reports per zone \n\nSample requests\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://dashboard.pubnative.net/api/reports?account_auth_token=AUTHTOKEN&start_date=07/11/2016&end_date=08/11/2016&group_by[]=zone_id\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nSample Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"reports\\\": [\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 251966,\\n\\\"ecpm\\\": \\\"0.42\\\",\\n\\\"zone_id\\\": \\\"1\\\",\\n\\\"clicks\\\": 1233,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.49,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 105.83,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 175201,\\n\\\"ecpm\\\": \\\"0.48\\\",\\n\\\"zone_id\\\": \\\"1\\\",\\n\\\"clicks\\\": 222,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"iOS - We Heart It\\\",\\n\\\"ctr\\\": 0.13,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 84.81,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 8479,\\n\\\"ecpm\\\": 0.47,\\n\\\"zone_id\\\": \\\"2\\\",\\n\\\"clicks\\\": 78,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.92,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 4,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 15670,\\n\\\"ecpm\\\": 0.55,\\n\\\"zone_id\\\": \\\"3\\\",\\n\\\"clicks\\\": 1240,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 7.91,\\n\\\"date\\\": \\\"07/11/2016\\\",\\n\\\"revenues\\\": 8.67,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": \\\"0.09\\\",\\n\\\"impressions\\\": 220943,\\n\\\"ecpm\\\": 0.47,\\n\\\"zone_id\\\": \\\"1\\\",\\n\\\"clicks\\\": 1110,\\n\\\"conversions\\\": 1,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.5,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": 102.77,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 142820,\\n\\\"ecpm\\\": 0.45,\\n\\\"zone_id\\\": \\\"1\\\",\\n\\\"clicks\\\": 173,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"iOS - We Heart It\\\",\\n\\\"ctr\\\": 0.12,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": 64.49,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 7095,\\n\\\"ecpm\\\": 0.52,\\n\\\"zone_id\\\": \\\"2\\\",\\n\\\"clicks\\\": 49,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 0.69,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": 3.72,\\n\\\"end_to_end_cr\\\": 0\\n},\\n{\\n\\\"cr\\\": 0,\\n\\\"impressions\\\": 14133,\\n\\\"ecpm\\\": 0.62,\\n\\\"zone_id\\\": \\\"3\\\",\\n\\\"clicks\\\": 1102,\\n\\\"conversions\\\": 0,\\n\\\"app_name\\\": \\\"Android - We Heart It\\\",\\n\\\"ctr\\\": 7.8,\\n\\\"date\\\": \\\"08/11/2016\\\",\\n\\\"revenues\\\": 8.71,\\n\\\"end_to_end_cr\\\": 0\\n}\\n],\\n\\\"count_before_filtering\\\": 8\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"reporting-api","type":"endpoint","title":"Reporting API"}
[block:api-header] { "type": "basic", "title": "API Access" } [/block] ##Getting an API key App-specific API key: * Click Apps * Click Integration of the specific app you want * Reporting API token is the Reporting API key Account-wide API key: * In the account menu, click Reporting API Key ##API overview It's a HTTP API, which tries to follow a RESTful design pattern. The results you get back will be in the JSON format. ##Mandatory API call parameter Either account_auth_token or app_auth_token: With the first one you can query for all apps under one account, with the latter only for that very app the token is for. Please note that the tokens will be different from each other, so you can't use one for another. * start_date: the format is dd/mm/yyyy and it needs to url encoded of course, so for example: 25%2F11%2F2013 * end_date: The same that applies to start_date applies here as well * app_id: Since we try hard to be RESTful, this is encoded as part of the URL. Just have a look at the example below, it's the {app_id} in apps/{app_id}/... [block:api-header] { "type": "basic", "title": "Examples" } [/block] ##Example API call by app-specific API key [block:code] { "codes": [ { "code": "curl http://dashboard.pubnative.net/api/v1/apps/{app_id}/reports?app_auth_token=YOURAPPTOKEN&start_date=25%2F11%2F2013&end_date=28%2F11%2F2013", "language": "curl" } ] } [/block] The result will be in JSON format and will look like this: [block:code] { "codes": [ { "code": "{\"reports\":[{\"date\":\"25/11/2013\",\"impressions\":95,\"clicks\":14,\"conversions\":1,\"revenues\":2.65,\"ctr\":14.74,\"cr\":7.14,\"end_to_end_cr\":1.05,\"ecpm\":27.89}]}", "language": "curl" } ] } [/block] ##Example API call for breakdown by country using an app-specific API key [block:code] { "codes": [ { "code": "curl https://dashboard.pubnative.net/api/v1/apps/{app_id}/reports/by_country?app_auth_token=YOURAPPTOKEN&start_date=25%2F11%2F2013&end_date=28%2F11%2F2013", "language": "curl" } ] } [/block] The result will be in JSON format and will look like this: [block:code] { "codes": [ { "code": "{ \n \"reports\":[ \n { \n \"date\":\"25/04/2014\",\n \"impressions\":1,\n \"clicks\":0,\n \"conversions\":0,\n \"revenues\":0.0,\n \"ctr\":0.0,\n \"cr\":0.0,\n \"end_to_end_cr\":0.0,\n \"ecpm\":0.0,\n \"country_code\":\"GP\"\n },\n { \n \"date\":\"25/04/2014\",\n \"impressions\":8,\n \"clicks\":0,\n \"conversions\":0,\n \"revenues\":0.0,\n \"ctr\":0.0,\n \"cr\":0.0,\n \"end_to_end_cr\":0.0,\n \"ecpm\":0.0,\n \"country_code\":\"CF\"\n }\n ]\n}", "language": "json" } ] } [/block] ## Account wide reports This reporting endpoint can be used to get data of across the whole account - Sample Request [block:code] { "codes": [ { "code": "https://dashboard.pubnative.net/api/reports?account_auth_token=YOURAPPTOKENYOURAPPTOKEN&start_date=07/11/2016&end_date=08/11/2016", "language": "text" } ] } [/block] Sample Response [block:code] { "codes": [ { "code": "{\n\"reports\": [\n{\n\"cr\": 0,\n\"impressions\": 276115,\n\"ecpm\": 0.43,\n\"clicks\": 2551,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.92,\n\"date\": \"07/11/2016\",\n\"revenues\": 118.49,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 175201,\n\"ecpm\": \"0.48\",\n\"clicks\": 222,\n\"conversions\": 0,\n\"app_name\": \"iOS - We Heart It\",\n\"ctr\": 0.13,\n\"date\": \"07/11/2016\",\n\"revenues\": 84.81,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": \"0.04\",\n\"impressions\": 242171,\n\"ecpm\": 0.48,\n\"clicks\": 2261,\n\"conversions\": 1,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.93,\n\"date\": \"08/11/2016\",\n\"revenues\": \"115.2\",\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 142820,\n\"ecpm\": 0.45,\n\"clicks\": 173,\n\"conversions\": 0,\n\"app_name\": \"iOS - We Heart It\",\n\"ctr\": 0.12,\n\"date\": \"08/11/2016\",\n\"revenues\": 64.49,\n\"end_to_end_cr\": 0\n}\n],\n\"count_before_filtering\": 4\n}", "language": "json" } ] } [/block] ## Account wide reports per zone Sample requests [block:code] { "codes": [ { "code": "https://dashboard.pubnative.net/api/reports?account_auth_token=AUTHTOKEN&start_date=07/11/2016&end_date=08/11/2016&group_by[]=zone_id", "language": "text" } ] } [/block] Sample Response [block:code] { "codes": [ { "code": "{\n\"reports\": [\n{\n\"cr\": 0,\n\"impressions\": 251966,\n\"ecpm\": \"0.42\",\n\"zone_id\": \"1\",\n\"clicks\": 1233,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.49,\n\"date\": \"07/11/2016\",\n\"revenues\": 105.83,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 175201,\n\"ecpm\": \"0.48\",\n\"zone_id\": \"1\",\n\"clicks\": 222,\n\"conversions\": 0,\n\"app_name\": \"iOS - We Heart It\",\n\"ctr\": 0.13,\n\"date\": \"07/11/2016\",\n\"revenues\": 84.81,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 8479,\n\"ecpm\": 0.47,\n\"zone_id\": \"2\",\n\"clicks\": 78,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.92,\n\"date\": \"07/11/2016\",\n\"revenues\": 4,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 15670,\n\"ecpm\": 0.55,\n\"zone_id\": \"3\",\n\"clicks\": 1240,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 7.91,\n\"date\": \"07/11/2016\",\n\"revenues\": 8.67,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": \"0.09\",\n\"impressions\": 220943,\n\"ecpm\": 0.47,\n\"zone_id\": \"1\",\n\"clicks\": 1110,\n\"conversions\": 1,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.5,\n\"date\": \"08/11/2016\",\n\"revenues\": 102.77,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 142820,\n\"ecpm\": 0.45,\n\"zone_id\": \"1\",\n\"clicks\": 173,\n\"conversions\": 0,\n\"app_name\": \"iOS - We Heart It\",\n\"ctr\": 0.12,\n\"date\": \"08/11/2016\",\n\"revenues\": 64.49,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 7095,\n\"ecpm\": 0.52,\n\"zone_id\": \"2\",\n\"clicks\": 49,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 0.69,\n\"date\": \"08/11/2016\",\n\"revenues\": 3.72,\n\"end_to_end_cr\": 0\n},\n{\n\"cr\": 0,\n\"impressions\": 14133,\n\"ecpm\": 0.62,\n\"zone_id\": \"3\",\n\"clicks\": 1102,\n\"conversions\": 0,\n\"app_name\": \"Android - We Heart It\",\n\"ctr\": 7.8,\n\"date\": \"08/11/2016\",\n\"revenues\": 8.71,\n\"end_to_end_cr\": 0\n}\n],\n\"count_before_filtering\": 8\n}", "language": "json" } ] } [/block]