HalalAdzDevelopers বাংলা · EN Go to dashboard
Docs menu

Start

Your first report in 5 minutes

Agencies, owners of many sites and app developers can read HalalAdz reports and run campaigns from their own software.

1. Get a test key

Dashboard → Settings → API keys → "Make a new key" → choose "Test key". A test key (hz_test_…) never moves real money. The key is shown only once — copy it right away.

Terminal
export HALALADZ_KEY="hz_test_1a2b3c4d_YOUR_SECRET"

2. Send the first request

With an advertiser key, each campaign's numbers per day:

curl
curl "https://api.halaladz.com/api/v1/reports/campaigns?from=2026-12-01&to=2026-12-05" \
  -H "Authorization: Bearer $HALALADZ_KEY"
JavaScript
// Node.js 18+ (fetch is built in). Keep the key on your server, never in a web page or app.
const res = await fetch("https://api.halaladz.com/api/v1/reports/campaigns?from=2026-12-01&to=2026-12-05", {
  headers: { Authorization: `Bearer ${process.env.HALALADZ_KEY}` },
});
const report = await res.json();
if (!res.ok) throw new Error(`${res.status} ${report.error}: ${report.message}`);
console.log(report.totals);
PHP
<?php
$query = http_build_query(['from' => '2026-12-01', 'to' => '2026-12-05']);
$ch = curl_init('https://api.halaladz.com/api/v1/reports/campaigns?' . $query);
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('HALALADZ_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$report = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 200) { throw new Exception($report['error'] . ': ' . $report['message']); }
print_r($report['totals']);
Python
import os
import requests

r = requests.get(
    "https://api.halaladz.com/api/v1/reports/campaigns",
    params={"from": "2026-12-01", "to": "2026-12-05"},
    headers={"Authorization": f"Bearer {os.environ['HALALADZ_KEY']}"},
    timeout=30,
)
r.raise_for_status()
print(r.json()["totals"])

3. The answer

With a test key you get the same shape with no rows and zero totals (the answer says "sandbox": true) — no number is ever made up.

JSON
{
  "from": "2026-12-01", "to": "2026-12-05", "timezone": "Asia/Dhaka", "currency": "BDT",
  "rows": [],
  "totals": { "impressions": "0", "views": "0", "clicks": "0", "conversions": "0", "results": "0", "spendMicros": "0" },
  "nextCursor": null,
  "sandbox": true
}

With a live key (hz_live_…) you get the same numbers as the dashboard's Reports screen:

JSON
{
  "from": "2026-12-01", "to": "2026-12-05", "timezone": "Asia/Dhaka", "currency": "BDT",
  "rows": [
    { "day": "2026-12-01", "campaignId": 123, "campaignName": "Eid dates offer", "goal": "orders",
      "impressions": "1520", "views": "1240", "clicks": "38", "conversions": "4", "results": "4",
      "spendMicros": "228000000" }
  ],
  "totals": { "impressions": "1520", "views": "1240", "clicks": "38", "conversions": "4", "results": "4", "spendMicros": "228000000" },
  "nextCursor": null
}

Money is always an integer in micros, as a JSON string: "200000000" = 200.00 BDT. Days are counted in your account's time zone (timezone in the answer; Bangladesh time unless you changed it). Accounts in every country are kept in BDT.

Publisher? Read your earnings

With a publisher key, earnings per day and ad place:

curl
curl "https://api.halaladz.com/api/v1/reports/earnings?from=2026-12-01&to=2026-12-05" \
  -H "Authorization: Bearer $HALALADZ_KEY"
JavaScript
const res = await fetch("https://api.halaladz.com/api/v1/reports/earnings?from=2026-12-01&to=2026-12-05", {
  headers: { Authorization: `Bearer ${process.env.HALALADZ_KEY}` },
});
const earnings = await res.json();
for (const row of earnings.rows) console.log(row);
PHP
<?php
$ch = curl_init('https://api.halaladz.com/api/v1/reports/earnings?from=2026-12-01&to=2026-12-05');
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('HALALADZ_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$earnings = json_decode(curl_exec($ch), true);
curl_close($ch);
foreach ($earnings['rows'] as $row) { print_r($row); }
Python
import os
import requests

r = requests.get(
    "https://api.halaladz.com/api/v1/reports/earnings",
    params={"from": "2026-12-01", "to": "2026-12-05"},
    headers={"Authorization": f"Bearer {os.environ['HALALADZ_KEY']}"},
    timeout=30,
)
r.raise_for_status()
for row in r.json()["rows"]:
    print(row)

Next