API
API reference
This page is made from the API's own OpenAPI description, so it always matches the code.
| Item | Value |
|---|---|
| Base URL | https://api.halaladz.com/api/v1 |
| Key | Authorization: Bearer hz_live_… or hz_test_… — Keys and security |
| OpenAPI 3.1 | https://api.halaladz.com/api/v1/openapi.json (no key needed) |
| Version | 1.0.0 |
Account
GET /me
The key's account, mode and scopes
Responses: 200, 400, 401, 403, 429
Reports v1
Read-only reports (scope read). JSON or CSV, at most 92 days per request, paginated. At most 1000 requests per hour per key, plus the per-minute limit.
GET /reports/campaigns
Advertiser: each campaign's numbers per day
Advertiser keys, scope read (old keys: reports:read). One row per day and campaign with delivery. Days are the account's days (timezone: the account's time zone, Asia/Dhaka unless changed). views = verified views (viewable), results = the campaign goal's result (orders → conversions, messages / installs / members → clicks, else views). The same numbers as the dashboard Reports screen. A page holds every day of up to limit campaigns.
| Name | In | Type | Notes |
|---|---|---|---|
from | query | string; date | First day (default: 6 days before to). |
to | query | string; date | Last day (default: today in the report's time zone). At most 92 days from from to to: longer → 400 range_too_long. |
limit | query | integer; default 20; max 50 | How many campaigns per page. |
cursor | query | integer | nextCursor of the previous page (null = last page). |
campaignId | query | integer | Only this campaign. |
format | query | string; one of: json, csv; default json | csv: the same rows as a CSV file (one header line). |
Responses: 200, 400, 401, 403, 429
GET /reports/earnings
Publisher: earnings per day and ad place
Publisher keys, scope read (old keys: earnings:read). One row per business day (Asia/Dhaka, the day earnings are booked) and placement. Earnings per currency, never summed across currencies. status: pending (inside the hold days, still checked for invalid traffic) or available (released to your balance). A page holds every day of up to limit placements.
| Name | In | Type | Notes |
|---|---|---|---|
from | query | string; date | First day (default: 6 days before to). |
to | query | string; date | Last day (default: today in the report's time zone). At most 92 days from from to to: longer → 400 range_too_long. |
limit | query | integer; default 20; max 50 | How many placements per page. |
cursor | query | integer | nextCursor of the previous page (null = last page). |
placementId | query | integer | |
propertyId | query | integer | |
format | query | string; one of: json, csv; default json | csv: the same rows as a CSV file (one header line). |
Responses: 200, 400, 401, 403, 429
GET /reports/placements
Publisher: your ad places (newest first)
Publisher keys, scope read.
| Name | In | Type | Notes |
|---|---|---|---|
limit | query | integer; default 100; max 200 | How many placements per page. |
cursor | query | integer | nextCursor of the previous page (null = last page). |
format | query | string; one of: json, csv; default json | csv: the same rows as a CSV file (one header line). |
Responses: 200, 400, 401, 403, 429
GET /reports/agency/clients
Advertiser agency: client accounts and their totals
Advertiser agency keys, scope read. Every client link (invited, active, declined, revoked), newest first; totals over the range only for active clients (null otherwise). A key made by an agency manager / viewer limited to some clients sees only those. Not an agency → 403 not_an_agency.
| Name | In | Type | Notes |
|---|---|---|---|
from | query | string; date | First day (default: 6 days before to). |
to | query | string; date | Last day (default: today in the report's time zone). At most 92 days from from to to: longer → 400 range_too_long. |
limit | query | integer; default 20; max 50 | How many clients per page. |
cursor | query | integer | nextCursor of the previous page (null = last page). |
format | query | string; one of: json, csv; default json | csv: the same rows as a CSV file (one header line). |
Responses: 200, 400, 401, 403, 429
Campaigns
Advertiser keys.
GET /campaigns
List campaigns (newest first)
Scope read (or campaigns:write). A test key lists only its test campaigns; a live key only real ones.
| Name | In | Type | Notes |
|---|---|---|---|
status | query | string; one of: draft, in_review, active, paused, exhausted, ended, rejected, suspended | |
limit | query | integer; default 50; max 200 | |
cursor | query | integer | nextCursor of the previous page. |
Responses: 200, 400, 401, 403, 429
POST /campaigns
Create a goal campaign (draft)
Scope campaigns:write. Same rules as the dashboard wizard: halal category (a blocked or not-allowed category → 422), platforms that fit the length, the rate card and the minimum budget (422 below_min_budget). The campaign is a draft: add creatives, then launch. A test key makes a test campaign (test money, own test places only).
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 201, 400, 401, 403, 404, 409, 422, 429
GET /campaigns/{id}
One campaign
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer |
Responses: 200, 400, 401, 403, 404, 429
PATCH /campaigns/{id}
Update budget and dates (and the name)
Scope campaigns:write. Send only what changes; the rest is kept. Budget and dates change only while the campaign is a draft (or rejected with its money returned) — exactly like the dashboard: after launch the budget is paid and locked (409 budget_locked). The price is quoted again (answer quote).
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 409, 422, 429
POST /quotes
Price a goal (saves nothing)
Scope campaigns:write.
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 429
POST /campaigns/{id}/launch
Pay the budget and send to human halal review
Scope campaigns:write. One ledger transaction moves the whole budget into the campaign reserve (live key: from the wallet; test key: test money, never your wallet); status becomes in_review and a HalalAdz person reviews it — an API campaign never skips the review. 402 insufficient_funds, 409 price_changed (re-read the total), 422 no_creatives, 403 spend_limit_reached (live key: today's launches + this total over the key's daily spend limit; details = limitMicros, usedMicros, remainingMicros, totalMicros), 422 test_money_cap (test key: more than 1,000,000 BDT in open test campaigns).
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 402, 403, 404, 409, 422, 429
POST /campaigns/{id}/submit
Same as /launch (pay + send to review)
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 402, 403, 404, 409, 422, 429
POST /campaigns/{id}/pause
Pause an active campaign
Scope campaigns:write. active → paused (409 invalid_status otherwise). Fires campaign.paused.
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 409, 422, 429
POST /campaigns/{id}/resume
Resume a paused campaign
Scope campaigns:write. paused → active.
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 409, 422, 429
POST /campaigns/{id}/end
End a campaign for good (unspent budget goes back)
Scope campaigns:write. From any status but ended. The unspent budget goes back at once in one ledger transaction (live key: to the wallet; test key: to the test wallet). Cannot be undone.
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 409, 422, 429
Creatives
Advertiser keys. New ads always go to the halal review.
POST /uploads
Get an upload URL for a picture or video
Scope creatives:write. PUT the file to uploadUrl with exactly headers, then use assetUrl in a creative.
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 409, 413, 422, 429
GET /campaigns/{id}/creatives
The campaign's creatives
Scope read, campaigns:write or creatives:write.
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer |
Responses: 200, 400, 401, 403, 429
POST /campaigns/{id}/creatives
Add a creative (goes to halal review)
Scope creatives:write. reviewStatus starts as pending (or ai_passed only if an optional automatic pre-check ran; every ad is checked by a person) — never approved: only a HalalAdz person approves an ad, also for test keys. Webhook creative.approved / creative.rejected tells you the result.
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 201, 400, 401, 403, 404, 409, 422, 429
Reports
The same numbers as the dashboard's Analytics screen.
GET /reports
Results, views and spend by day, platform or country
Scope reports:read. The same numbers as the dashboard's Analytics screen. groupBy=country needs campaignId (goal campaigns).
| Name | In | Type | Notes |
|---|---|---|---|
from | query | string; date | First day (default: 6 days before to). |
to | query | string; date | Last day (default: today). At most 92 days per request. |
groupBy | query | string; one of: day, platform, country; default day | |
campaignId | query | integer | |
goal | query | string; one of: messages, orders, brand, video | Which result to count (default: the account's main goal). |
Responses: 200, 400, 401, 403, 429
Publisher
Publisher keys: earnings and payouts.
GET /earnings
Earnings by day or property
Scope earnings:read (publisher keys). The same numbers as the dashboard's earnings report. Money per currency, never summed across currencies.
| Name | In | Type | Notes |
|---|---|---|---|
from | query | string; date | First day (default: 6 days before to). |
to | query | string; date | Last day (default: today). At most 92 days per request. |
groupBy | query | string; one of: day, property; default day |
Responses: 200, 400, 401, 403, 429
GET /payouts
Payout requests (newest first)
| Name | In | Type | Notes |
|---|---|---|---|
limit | query | integer; max 200 | |
cursor | query | integer |
Responses: 200, 400, 401, 403, 429
Sandbox
hz_test_ keys only: simulate webhook events (never a review decision).
POST /sandbox/campaigns/{id}/goal-reached
Send a test campaign.goal_reached webhook for a test campaign (nothing changes)
| Name | In | Type | Notes |
|---|---|---|---|
id * | path | integer | |
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 404, 429
POST /sandbox/low-balance
Send a test wallet.low_balance webhook
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Key * | header | string | REQUIRED on every POST / PATCH / DELETE (else 400 idempotency_key_required). Use a new random value (e.g. a UUID) per action. Kept 24 h per key: the same key with the same method, path and body replays the first answer (header Idempotent-Replayed: true); the same key with another request → 422 idempotency_key_reused; still running → 409 idempotency_in_progress. A 5xx answer is not kept, so retry with the same key. |
Responses: 200, 400, 401, 403, 429
Webhooks
These events are POSTed to your server: campaign.approved, campaign.rejected, campaign.paused, campaign.budget_spent, creative.approved, creative.rejected, campaign.goal_reached, wallet.low_balance, payout.approved, payout.sent, earnings.finalised, property.approved, property.rejected, report.daily_ready, test.ping. Webhooks guide.
Coming soon
Coming soon The publisher agency partners report comes when publisher agencies open (agencies).
GET /reports/agency/partners Coming soon
Publisher agency: partner publishers and the agency share