Campaigns and creatives
The flow
POST /quotesto see the price (optional; saves nothing).POST /campaignsmakes a draft goal campaign.POST /uploads, PUT the file, thenPOST /campaigns/{id}/creatives. Each creative goes to the halal review (pendingorai_passed); only a HalalAdz reviewer approves it.POST /campaigns/{id}/launchpays the whole budget from your wallet into the campaign reserve in one ledger transaction; the campaign goes toin_review, thenactive.POST /campaigns/{id}/pauseand/resumeas you need;POST /campaigns/{id}/endends it for good and returns the unspent budget at once.
Full guide with samples in curl, JavaScript, PHP and Python: developers.halaladz.com/campaigns. Every POST / PATCH needs an Idempotency-Key.
Live keys run the very same checks as the dashboard wizard; a request the dashboard would refuse is refused here with the same error code.
List and read campaigns
GET /campaigns
Scope reports:read or campaigns:write. Query: status (draft, in_review, active, paused, exhausted, ended, rejected, suspended), limit, cursor.
curl "https://api.halaladz.com/api/v1/campaigns?status=active&limit=20" \
-H "Authorization: Bearer $HZ_KEY"
GET /campaigns/{id}
curl https://api.halaladz.com/api/v1/campaigns/123 -H "Authorization: Bearer $HZ_KEY"
{"id": 123, "name": "Eid dates offer", "status": "active", "goal": "orders", "pricing": "CPC", "platforms": ["website", "app", "telegram"], "totalBudgetMicros": "4500000000", "spentMicros": "1200000000", "startsAt": "2026-11-26T04:00:00.000Z", "endsAt": "2026-12-01T04:00:00.000Z", "createdAt": "2026-11-25T10:12:00.000Z"}
Price a goal
POST /quotes
Scope campaigns:write. Body: goal, platforms, targetUnits (exact count) or budgetMicros, optional declaredCategory / priceCategory. Answers totalMicros, unitPriceMicros, minBudgetMicros, quoteKey and the per-platform lines. Saves nothing.
curl -X POST https://api.halaladz.com/api/v1/quotes \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"goal": "orders", "declaredCategory": "food", "platforms": ["website", "app"], "targetUnits": "500"}'
Create a campaign
POST /campaigns
Scope campaigns:write. The same body as the dashboard wizard's goal campaign. Send targetUnits (exactly that many clicks or views; the budget is units × one unit price) or budgetMicros.
| Field | Notes |
|---|---|
name | Up to 200 characters |
goal | brand, orders, installs, video or members |
declaredCategory | A content category code (e.g. food); priceCategory is optional |
halalConfirmed | Must be true: you confirm the product and the ad are halal |
targetUnits / budgetMicros | Digits in a string |
platforms | website, app, telegram, whatsapp, youtube, facebook, instagram, tiktok; each once; each must fit the length |
durationHours | 12, 24 or n × 24 (up to the admin maximum) |
startMode | after_review, or date with startDate (YYYY-MM-DD) and startTime (HH:mm) |
targeting, freqCap | As in the dashboard (countries, areas, content categories, devices …) |
curl -X POST https://api.halaladz.com/api/v1/campaigns \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: eid-campaign-1" \
-d '{ "name": "Eid dates offer", "goal": "orders", "declaredCategory": "food", "halalConfirmed": true, "targeting": { "countries": ["BD"] }, "targetUnits": "500", "platforms": ["website", "app", "telegram"], "durationHours": 120, "startMode": "after_review" }'
Answers 201 with the budget view (id, campaignId, totalMicros, the lines) and quote. Typical refusals: 422 below_min_budget (with minBudgetMicros), 422 rate_unavailable, 422 duration_too_short, 422 start_in_past, 400 validation_error.
Add creatives
POST /uploads
Scope creatives:write. Body {"contentType": "image/png", "sizeBytes": 48211} (image/jpeg, png, webp, gif, video/mp4, webm). Answers uploadUrl, headers and assetUrl. PUT the file to uploadUrl with exactly those headers, then use assetUrl.
curl -X POST https://api.halaladz.com/api/v1/uploads \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"contentType": "image/png", "sizeBytes": 48211}'
# then upload the file to the uploadUrl you got, with the headers you got
curl -X PUT "<uploadUrl>" -H "Content-Type: image/png" --data-binary @banner.png
POST /campaigns/{id}/creatives
Body: format (banner_300x250, banner_320x50, native, interstitial, video_muted, telegram_post …), landingUrl (https; blocked domains are refused with 422 domain_blocked), assetUrl for display and video formats, optional title, body, cta, hasPeople. Answers 201 with reviewStatus pending or ai_passed — never approved: only a HalalAdz person approves an ad, also for test keys. The webhook creative.approved / creative.rejected tells you the result.
curl -X POST https://api.halaladz.com/api/v1/campaigns/123/creatives \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"format": "banner_300x250", "assetUrl": "<assetUrl>", "title": "Fresh dates", "landingUrl": "https://shop.example.com/dates"}'
GET /campaigns/{id}/creatives
curl https://api.halaladz.com/api/v1/campaigns/123/creatives -H "Authorization: Bearer $HZ_KEY"
Launch
POST /campaigns/{id}/launch
Body {"expectedTotalMicros": "<the total you saw>", "quoteKey"?: "..."}. Re-prices at today's rates and moves the whole total from the wallet into the campaign reserve in one ledger transaction; status in_review. Same as POST /campaigns/{id}/submit.
| Answer | Meaning |
|---|---|
200 | Paid and sent to review |
402 insufficient_funds | details: totalMicros, balanceMicros, missingMicros. Add money in the dashboard wallet |
409 price_changed | details.totalMicros is the new total: check it and launch again with it |
422 no_creatives | Add at least one ad first |
403 spend_limit_reached | Live key: today's launches + this total go over the key's daily spend limit (set by HalalAdz; 0 = none yet) |
422 test_money_cap | Test key: more than one million BDT of test money in open test campaigns |
409 invalid_status, 409 already_paid | Only a draft (or rejected) campaign can be launched |
curl -X POST https://api.halaladz.com/api/v1/campaigns/123/launch \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: launch-123" \
-d '{"expectedTotalMicros": "4500000000"}'
Change budget and dates
PATCH /campaigns/{id}
Send only what changes: targetUnits or budgetMicros, platforms, startMode, startAt, durationHours, name. The price is quoted again. Only before launch (draft, or rejected with its money returned) — after launch the budget is paid and locked (409 budget_locked), as in the dashboard.
curl -X PATCH https://api.halaladz.com/api/v1/campaigns/123 \
-H "Authorization: Bearer $HZ_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"targetUnits": "300", "durationHours": 240}'
Pause, resume and end
POST /campaigns/{id}/pause
POST /campaigns/{id}/resume
POST /campaigns/{id}/end
Only an active campaign can be paused and only a paused one resumed; otherwise 409 invalid_status. end is for good: the unspent budget goes back at once.
curl -X POST https://api.halaladz.com/api/v1/campaigns/123/pause -H "Authorization: Bearer $HZ_KEY" -H "Idempotency-Key: $(uuidgen)"
curl -X POST https://api.halaladz.com/api/v1/campaigns/123/resume -H "Authorization: Bearer $HZ_KEY" -H "Idempotency-Key: $(uuidgen)"
curl -X POST https://api.halaladz.com/api/v1/campaigns/123/end -H "Authorization: Bearer $HZ_KEY" -H "Idempotency-Key: $(uuidgen)"
With a test key
With a hz_test_ key the same calls make a test campaign: the same checks and the same human halal review (a review decision cannot be simulated — POST /sandbox/creatives/{id}/review answers 410 review_by_halaladz). Its budget is test money, never your wallet; it shows only on your own places with Test ads on, never to real publishers; ending it returns the test money to the test wallet. See webhooks in the sandbox.