JSON report

Article author
Bunker DB Support
  • Updated

Bunker DB analytics has the functionality to download report information in JSON format.

This functionality includes both brand and campaign reports.

To download this information, it will be necessary to have:

  • Bunker DB analytics user access credentials (username and password) with permission to view the report.
  • Brand ID or campaign ID to download.
  • A RESTful API compatible client (Postman, Insomnia, etc.).


Step by step — how to get a brand ID

  1. Select a brand.

  2. Hover over the "Edit Brand" button.

A URL will be seen at the bottom of the browser.

The brand ID will be the number at the end of the URL.



Step by step — how to get a campaign ID

  1. Select the campaign.
  2. Hover over the "Edit campaign" button.

A URL will be seen at the bottom of the browser.


The campaign ID will be the number at the end of the URL.

  • You can also view the campaign ID by entering the campaign list and hovering over the edit icon for any campaign.


Endpoint and parameters

API endpoint

Being {instance} the subdomain provided by Bunker DB when registering the service:




Sending method



  • email: Bunker DB analytics user's email address with sufficient permissions to view the report.
  • password: access password linked to the user's email.
  • type: type of report requested, "brand" or "campaign."
  • object_id: brand ID or campaign ID.
  • period_id: period ID. Possible values:
  • "CMP" (campaign).
  • "wkl" (weekly).
  • "mnt" (monthly).
  • "qrt" (trimester).
  • "bia" (biannual).
  • "ann" (annual).
  • “l15d” (last 15 days).
  • "l3d" (last three days).
  • "l7d" (last seven days).
  • selected_date: period start date, formatted as YYYY-MM-DD.
  • selected_end_date: period end date, formatted as YYYY-MM-DD (for campaigns only).
  • email_report: email where you want the report to be delivered as an attached zip.
  • zip: If you want to obtain the report in plain text or compressed in a zip.
    Possible values:
  • 1 (yes).
  • 2 (no).


[1] If an email was selected in "email_report," the report will always arrive in a zip file.


Response flow


The JSON response can be synchronous or asynchronous.

  • Synchronous: If an email_report is not specified, then the report will be returned in the same API call, either in plain (JSON) or compressed (via zip) format.
    We suggest configuring a high time out so the connection won't terminate before the report is returned.
  • Asynchronous: if an email is specified in "email_report," then the report will be processed in the background, and status will be printed. The report will be sent to the specified inbox in "email_report" once the data has been processed.



Response format (asynchronous):


    "id": “Report ID (hash)”

    "timestamp": "Report creation date (YYYY-MM-DD H:m:s)",

    "email_report": "Report recipient email",

    "status": "status (processing, failed)"





    "id": "c027d8b0bb4726611546f42c04f6b005",

    "timestamp": "2020-08-24 15:16:24",

    "email_report": "support@bunkerdb.com",

    "status": "processing"



Response codes (HTTP status)

200 — OK

The call has been successful, and the report's result is in the body of the response (called synchronous).


202 — Accepted

The report generation request (sent by email) has been received and processed (called asynchronous).


401 — Unauthorized

The credentials provided by email and password are not valid. A control of attempts will be made, and after the maximum of 5, the IP from where the calls are made will be blocked for a period of 60 minutes.


403 — Forbidden

The maximum number of failed attempts has been reached from the calling IP; you will need to try again later.


429 — Too many requests

The maximum number of simultaneous report generation requests allowed has been reached. The response to this error will contain a list of the report identifiers (hash) and the client's creation dates for possible control.



500 — Internal server error

A server-side error has occurred, the support team will check the problem.



Response base structure

Below you can see the base structure of the JSON:

The networks' content will be found within the "available_media" tree:

Call examples


curl -X POST \
   https://{instancia}.bunkerdb.com/report/json \
   -H 'cache-control: no-cache' \
   -H 'content-type: application/x-www-form-urlencoded' \
   -d 'email=it%40bunkerdb.com&password=XXX&type=brand&object_id=1&period_id=mnt&selected_date=2019-06-01&selected_end_date=2019-06-30&email_report=it%40bunkerdb.com'


Python 3

import http.client
conn = http.client.HTTPSConnection("")

payload = "email=it%40bunkerdb.com&password=XXX&type=brand&object_id=1&period_id=mnt&selected_date=2019-06-01&selected_end_date=2019-06-30&email_report=it%40bunkerdb.com"

headers = {
   'content-type': "application/x-www-form-urlencoded",
   'cache-control': "no-cache"

conn.request("POST", "{instancia}.bunkerdb.com/report/json", payload, headers)

res = conn.getresponse()
data = res.read()





$curl = curl_init();

curl_setopt_array($curl, array(
   CURLOPT_POSTFIELDS => "email=it%40bunkerdb.com&password=XXX&type=brand&object_id=1&period_id=mnt&selected_date=2019-06-01&email_report=it%40bunkerdb.com",
       "cache-control: no-cache",
       "content-type: application/x-www-form-urlencoded"


$response = curl_exec($curl);
$err = curl_error($curl);


if ($err) {
   echo "cURL Error #:" . $err;
} else {
   echo $response;


RESTful API client call example


To request the report, you can use a client for RESTful APIs. Here are the steps to request the report in JSON format.

Interaction with the API is done in "x-www-form-urlencoded" format, so the header ContentType: Application / x-www-form-urlencoded must always be present.

When using the POST method type, you must enter the parameters within the body as follows:

After the API call has been generated, the response will be displayed below the entered parameters:





Was this article helpful?

Have more questions? Submit a request