{"openapi":"3.1.0","info":{"title":"HalalAdz Public API","version":"1.0.0","summary":"Create and manage halal ad campaigns, read reports, and read publisher earnings.","description":"Live keys (`hz_live_…`) act on real data through exactly the same checks as the dashboard (halal review, minimum budget, wallet). Test keys (`hz_test_…`) run the same validation and the same human review, but campaigns are test campaigns paid with test money, shown only on your own test places, and reports stay empty. Rate limit (default): 120 requests per minute per live key, 60 per sandbox key; HalalAdz may change it — GET /me rateLimitPerMinute and X-RateLimit-Limit show the current one. On top of that, at most 1000 requests per hour per key (X-RateLimit-Hour-*). Campaign write API (D-296): scopes `campaigns:write` + `creatives:write` — always on test keys (test money, your own test places only); on live keys only after HalalAdz switched it on, and each live key has a daily spend limit set by HalalAdz. Every POST / PATCH / DELETE needs an `Idempotency-Key` header. API campaigns always go through the same human halal review as the dashboard. Money is integer micros in strings. Docs: https://halaladz.com/docs/api","contact":{"name":"HalalAdz support","url":"https://halaladz.com/docs/api","email":"support@halaladz.com"}},"servers":[{"url":"https://api.halaladz.com/api/v1"}],"security":[{"bearerKey":[]}],"tags":[{"name":"Account"},{"name":"Campaigns","description":"Advertiser keys."},{"name":"Creatives","description":"Advertiser keys. New ads always go to the halal review."},{"name":"Reports","description":"The same numbers as the dashboard's Analytics screen."},{"name":"Publisher","description":"Publisher keys: earnings and payouts."},{"name":"Sandbox","description":"hz_test_ keys only: simulate webhook events (never a review decision)."},{"name":"Reports v1","description":"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."}],"paths":{"/me":{"get":{"tags":["Account"],"summary":"The key's account, mode and scopes","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns":{"get":{"tags":["Campaigns"],"summary":"List campaigns (newest first)","description":"Scope `read` (or `campaigns:write`). A test key lists only its test campaigns; a live key only real ones.","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["draft","in_review","active","paused","exhausted","ended","rejected","suspended"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}},"nextCursor":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Campaigns"],"summary":"Create a goal campaign (draft)","description":"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).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCreate"}}}},"responses":{"201":{"description":"Created (draft)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignBudget"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}":{"get":{"tags":["Campaigns"],"summary":"One campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Campaigns"],"summary":"Update budget and dates (and the name)","description":"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`).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignBudget"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/quotes":{"post":{"tags":["Campaigns"],"summary":"Price a goal (saves nothing)","description":"Scope `campaigns:write`.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/launch":{"post":{"tags":["Campaigns"],"summary":"Pay the budget and send to human halal review","description":"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).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignBudget"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/BusinessRule"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/submit":{"post":{"tags":["Campaigns"],"summary":"Same as /launch (pay + send to review)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignBudget"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/BusinessRule"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/pause":{"post":{"tags":["Campaigns"],"summary":"Pause an active campaign","description":"Scope `campaigns:write`. active → paused (`409 invalid_status` otherwise). Fires `campaign.paused`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/resume":{"post":{"tags":["Campaigns"],"summary":"Resume a paused campaign","description":"Scope `campaigns:write`. paused → active.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/end":{"post":{"tags":["Campaigns"],"summary":"End a campaign for good (unspent budget goes back)","description":"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.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uploads":{"post":{"tags":["Creatives"],"summary":"Get an upload URL for a picture or video","description":"Scope `creatives:write`. PUT the file to `uploadUrl` with exactly `headers`, then use `assetUrl` in a creative.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["contentType","sizeBytes"],"properties":{"contentType":{"type":"string","enum":["image/jpeg","image/png","image/webp","image/gif","video/mp4","video/webm"]},"sizeBytes":{"type":"integer"},"sha256":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"method":{"const":"PUT"},"uploadUrl":{"type":"string"},"headers":{"type":"object"},"assetUrl":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"413":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/campaigns/{id}/creatives":{"get":{"tags":["Creatives"],"summary":"The campaign's creatives","description":"Scope `read`, `campaigns:write` or `creatives:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Creative"}}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Creatives"],"summary":"Add a creative (goes to halal review)","description":"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.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreativeCreate"}}}},"responses":{"201":{"description":"Created (in review)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Creative"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/BusinessRule"},"422":{"$ref":"#/components/responses/BusinessRule"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports":{"get":{"tags":["Reports"],"summary":"Results, views and spend by day, platform or country","description":"Scope `reports:read`. The same numbers as the dashboard's Analytics screen. `groupBy=country` needs `campaignId` (goal campaigns).","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"description":"Last day (default: today). At most 92 days per request."},{"name":"groupBy","in":"query","schema":{"type":"string","enum":["day","platform","country"],"default":"day"}},{"name":"campaignId","in":"query","schema":{"type":"integer"}},{"name":"goal","in":"query","schema":{"type":"string","enum":["messages","orders","brand","video"]},"description":"Which result to count (default: the account's main goal)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/earnings":{"get":{"tags":["Publisher"],"summary":"Earnings by day or property","description":"Scope `earnings:read` (publisher keys). The same numbers as the dashboard's earnings report. Money per currency, never summed across currencies.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"description":"Last day (default: today). At most 92 days per request."},{"name":"groupBy","in":"query","schema":{"type":"string","enum":["day","property"],"default":"day"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Earnings"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/payouts":{"get":{"tags":["Publisher"],"summary":"Payout requests (newest first)","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}},{"name":"cursor","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Payout"}},"nextCursor":{"type":["integer","null"]}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/sandbox/creatives/{id}/review":{"post":{"tags":["Sandbox"],"summary":"Removed: a review decision cannot be simulated","description":"D-296: API campaigns never skip the human review, also with test keys. Always `410 review_by_halaladz`; a HalalAdz person reviews your test ads.","deprecated":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"410":{"description":"review_by_halaladz","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/sandbox/campaigns/{id}/goal-reached":{"post":{"tags":["Sandbox"],"summary":"Send a test campaign.goal_reached webhook for a test campaign (nothing changes)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/sandbox/low-balance":{"post":{"tags":["Sandbox"],"summary":"Send a test wallet.low_balance webhook","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports/campaigns":{"get":{"tags":["Reports v1"],"summary":"Advertiser: each campaign's numbers per day","description":"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.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"Last day (default: today in the report's time zone). At most 92 days from `from` to `to`: longer → 400 range_too_long."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"description":"How many campaigns per page."},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page (null = last page)."},{"name":"campaignId","in":"query","schema":{"type":"integer"},"description":"Only this campaign."},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"`csv`: the same rows as a CSV file (one header line)."}],"responses":{"200":{"description":"OK (JSON, or CSV with format=csv)","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Hour-Limit":{"$ref":"#/components/headers/X-RateLimit-Hour-Limit"},"X-RateLimit-Hour-Remaining":{"$ref":"#/components/headers/X-RateLimit-Hour-Remaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDailyReport"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports/earnings":{"get":{"tags":["Reports v1"],"summary":"Publisher: earnings per day and ad place","description":"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.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"Last day (default: today in the report's time zone). At most 92 days from `from` to `to`: longer → 400 range_too_long."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"description":"How many placements per page."},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page (null = last page)."},{"name":"placementId","in":"query","schema":{"type":"integer"}},{"name":"propertyId","in":"query","schema":{"type":"integer"}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"`csv`: the same rows as a CSV file (one header line)."}],"responses":{"200":{"description":"OK (JSON, or CSV with format=csv)","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Hour-Limit":{"$ref":"#/components/headers/X-RateLimit-Hour-Limit"},"X-RateLimit-Hour-Remaining":{"$ref":"#/components/headers/X-RateLimit-Hour-Remaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EarningsDailyReport"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports/placements":{"get":{"tags":["Reports v1"],"summary":"Publisher: your ad places (newest first)","description":"Publisher keys, scope `read`.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"description":"How many placements per page."},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page (null = last page)."},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"`csv`: the same rows as a CSV file (one header line)."}],"responses":{"200":{"description":"OK (JSON, or CSV with format=csv)","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Hour-Limit":{"$ref":"#/components/headers/X-RateLimit-Hour-Limit"},"X-RateLimit-Hour-Remaining":{"$ref":"#/components/headers/X-RateLimit-Hour-Remaining"}},"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Placement"}},"nextCursor":{"type":["integer","null"]}}}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports/agency/clients":{"get":{"tags":["Reports v1"],"summary":"Advertiser agency: client accounts and their totals","description":"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.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"Last day (default: today in the report's time zone). At most 92 days from `from` to `to`: longer → 400 range_too_long."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"description":"How many clients per page."},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page (null = last page)."},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"`csv`: the same rows as a CSV file (one header line)."}],"responses":{"200":{"description":"OK (JSON, or CSV with format=csv)","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Hour-Limit":{"$ref":"#/components/headers/X-RateLimit-Hour-Limit"},"X-RateLimit-Hour-Remaining":{"$ref":"#/components/headers/X-RateLimit-Hour-Remaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgencyClients"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reports/agency/partners":{"get":{"tags":["Reports v1"],"summary":"Publisher agency: partner publishers and the agency share","description":"Publisher agency keys, scope `read`. Every partner link (linked, left, invited), newest first. Over the range (Asia/Dhaka business days), only for days the link covered: `earnedMicros` = the publisher's earnings (their 70 %), `shareMicros` = the agency share (released days as posted, the rest as expected), `releasedShareMicros` = already in the agency wallet. HalalAdz's 30 % is never reduced: the agency share comes only from the publisher's part. An invited publisher shows no name or numbers. Not an agency → 403 not_an_agency.","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"First day (default: 6 days before `to`)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","description":"YYYY-MM-DD."},"description":"Last day (default: today in the report's time zone). At most 92 days from `from` to `to`: longer → 400 range_too_long."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"description":"How many partners per page."},{"name":"cursor","in":"query","schema":{"type":"integer"},"description":"`nextCursor` of the previous page (null = last page)."},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"`csv`: the same rows as a CSV file (one header line)."}],"responses":{"200":{"description":"OK (JSON, or CSV with format=csv)","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Hour-Limit":{"$ref":"#/components/headers/X-RateLimit-Hour-Limit"},"X-RateLimit-Hour-Remaining":{"$ref":"#/components/headers/X-RateLimit-Hour-Remaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgencyPartners"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"webhooks":{"campaign.approved":{"post":{"summary":"Event campaign.approved","x-data":"campaignId, autoApproved?","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"campaign.rejected":{"post":{"summary":"Event campaign.rejected","x-data":"campaignId, reason","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"campaign.paused":{"post":{"summary":"Event campaign.paused","x-data":"campaignId, previousStatus","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"campaign.budget_spent":{"post":{"summary":"Event campaign.budget_spent","x-data":"campaignId, billing (payg | upfront)","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"creative.approved":{"post":{"summary":"Event creative.approved","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"creative.rejected":{"post":{"summary":"Event creative.rejected","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"campaign.goal_reached":{"post":{"summary":"Event campaign.goal_reached","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"wallet.low_balance":{"post":{"summary":"Event wallet.low_balance","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"payout.approved":{"post":{"summary":"Event payout.approved","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"payout.sent":{"post":{"summary":"Event payout.sent","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"earnings.finalised":{"post":{"summary":"Event earnings.finalised","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"property.approved":{"post":{"summary":"Event property.approved","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"property.rejected":{"post":{"summary":"Event property.rejected","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"report.daily_ready":{"post":{"summary":"Event report.daily_ready","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}},"test.ping":{"post":{"summary":"Event test.ping","description":"Signed with header X-HalalAdz-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. Answer 2xx within 10 s. Retried with backoff up to 8 times.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Received"}}}}},"components":{"securitySchemes":{"bearerKey":{"type":"http","scheme":"bearer","description":"Authorization: Bearer hz_live_… (or hz_test_…). X-Api-Key is also accepted."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[A-Za-z0-9_.:-]{1,200}$"},"description":"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."}},"headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the minute window resets."},"X-RateLimit-Hour-Limit":{"schema":{"type":"integer"},"description":"D-291: at most 1000 requests per hour per key."},"X-RateLimit-Hour-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Hour-Reset":{"schema":{"type":"integer"},"description":"Seconds until the hour window resets."}},"responses":{"ValidationError":{"description":"validation_error (issues lists each problem), idempotency_key_required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"invalid_api_key, key_owner_removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"insufficient_scope, forbidden, account_suspended, ip_not_allowed (the key has an IP allowlist), not_an_agency, campaign_write_off (a live key with write scopes while HalalAdz has not switched the campaign write API on for live keys), spend_limit_reached (the live key's daily spend limit)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"not_found (also for objects of another account, and for a test campaign asked with a live key or the other way round)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BusinessRule":{"description":"A business rule (below_min_budget, insufficient_funds, price_changed, invalid_status, budget_locked, no_creatives, domain_blocked, test_money_cap, idempotency_key_reused, idempotency_in_progress …)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"rate_limited","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}},"details":{"type":"object"}}},"Me":{"type":"object","properties":{"accountId":{"type":"integer"},"accountKind":{"enum":["advertiser","publisher"]},"mode":{"enum":["live","test"]},"keyPrefix":{"type":"string"},"scopes":{"type":"array","items":{"enum":["reports:read","campaigns:write","creatives:write","earnings:read","conversions:write","read"]}},"role":{"type":"string"},"rateLimitPerMinute":{"type":"integer"},"rateLimitPerHour":{"type":"integer"}}},"Campaign":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"status":{"type":"string"},"goal":{"type":["string","null"]},"pricing":{"type":"string"},"platforms":{"type":["array","null"],"items":{"type":"string"}},"totalBudgetMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"spentMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"apiTest":{"type":"boolean","description":"true for a test campaign made with a test key (test money, own test places only)."}}},"CampaignCreate":{"type":"object","required":["name","goal","declaredCategory","halalConfirmed","platforms","startMode"],"properties":{"name":{"type":"string","maxLength":200},"goal":{"type":"string","enum":["brand","orders","installs","video","members"],"description":"What you pay for (the dashboard wizard goals)."},"declaredCategory":{"type":"string","description":"A content category code from the dashboard (e.g. food)."},"priceCategory":{"type":"string"},"halalConfirmed":{"const":true,"description":"You confirm the product and ad are halal."},"targetUnits":{"type":"string","pattern":"^\\d+$","description":"Exactly this many results (clicks / views); budget = units × unit price."},"budgetMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"platforms":{"type":"array","items":{"type":"string","enum":["website","app","telegram","whatsapp","youtube","facebook","instagram","tiktok"]},"description":"Where the ads run; the length must fit each platform."},"durationHours":{"type":"integer","description":"12, 24 or n × 24."},"startMode":{"enum":["after_review","date"]},"startDate":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"startTime":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"startAt":{"type":"string","format":"date-time"},"categoryOtherText":{"type":"string","description":"With declaredCategory other: your own words (checked like the dashboard)."},"targeting":{"type":"object","description":"As in the dashboard: countries, areas, content categories, devices …"},"freqCap":{"type":["object","null"],"properties":{"per_user":{"type":"integer"},"window_h":{"type":"integer"}}}}},"CampaignUpdate":{"type":"object","description":"Send at least one field. Budget: targetUnits (exact count) or budgetMicros. Dates: startMode, startAt (or startDate + startTime), durationHours (or deliveryDays).","properties":{"name":{"type":"string","maxLength":200},"targetUnits":{"type":"string","pattern":"^\\d+$"},"budgetMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"platforms":{"type":"array","items":{"type":"string"}},"priceCategory":{"type":["string","null"]},"startMode":{"enum":["after_review","date"]},"startAt":{"type":"string","format":"date-time","description":"The start with its offset; wins over startDate + startTime."},"startDate":{"type":"string","format":"date","description":"YYYY-MM-DD (Asia/Dhaka business day)."},"startTime":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"durationHours":{"type":"integer","description":"12, 24 or n × 24."},"deliveryDays":{"type":"integer"}}},"LaunchRequest":{"type":"object","required":["expectedTotalMicros"],"properties":{"expectedTotalMicros":{"type":"string","pattern":"^\\d+$","description":"The total you saw (campaign totalMicros / quote); a different current price → 409 price_changed."},"quoteKey":{"type":"string"}}},"CampaignBudget":{"type":"object","description":"The campaign's budget view (as the dashboard wizard gets it) plus `quote`.","additionalProperties":true},"QuoteRequest":{"type":"object","required":["goal","platforms"],"properties":{"goal":{"type":"string"},"declaredCategory":{"type":"string"},"priceCategory":{"type":"string"},"platforms":{"type":"array","items":{"type":"string"}},"budgetMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"targetUnits":{"type":"string"}}},"Quote":{"type":"object","properties":{"totalMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"unitPriceMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"minBudgetMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"quoteKey":{"type":"string"}},"additionalProperties":true},"Creative":{"type":"object","properties":{"id":{"type":"integer"},"campaignId":{"type":"integer"},"format":{"type":"string"},"landingUrl":{"type":"string"},"assetUrl":{"type":["string","null"]},"title":{"type":["string","null"]},"reviewStatus":{"enum":["pending","ai_passed","approved","rejected"]}},"additionalProperties":true},"CreativeCreate":{"type":"object","required":["format","landingUrl"],"properties":{"format":{"type":"string","description":"banner_300x250, banner_320x50, native, interstitial, video_muted, telegram_post …"},"landingUrl":{"type":"string","format":"uri","description":"https only; blocked domains are refused."},"assetUrl":{"type":"string","description":"From POST /uploads (display and video formats)."},"assetSha256":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"cta":{"type":"string"},"hasPeople":{"type":["boolean","null"]}}},"ReportRow":{"type":"object","properties":{"key":{"type":"string","description":"The day, platform or country code."},"results":{"type":"string"},"views":{"type":["string","null"]},"spendMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"costPerResultMicros":{"type":["string","null"]}}},"Report":{"type":"object","properties":{"from":{"type":["string","null"]},"to":{"type":["string","null"]},"groupBy":{"type":"string"},"currency":{"const":"BDT"},"goal":{"type":["string","null"]},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ReportRow"}},"totals":{"$ref":"#/components/schemas/ReportRow"},"sandbox":{"type":"boolean"}}},"Earnings":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"groupBy":{"type":"string"},"rows":{"type":"array","items":{"type":"object","additionalProperties":true}},"totals":{"type":"object","additionalProperties":true}}},"Payout":{"type":"object","properties":{"id":{"type":"integer"},"amountMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50 BDT."},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"additionalProperties":true},"AgencyPartners":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"timezone":{"const":"Asia/Dhaka"},"currency":{"const":"BDT"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"The partner link id."},"publisherAccountId":{"type":["integer","null"]},"publisherName":{"type":["string","null"],"description":"null while the invitation is not accepted."},"status":{"enum":["invited","linked","left"]},"joinedVia":{"enum":["signup_link","invite"]},"sharePercent":{"type":"number"},"sinceDay":{"type":["string","null"],"format":"date"},"untilDay":{"type":["string","null"],"format":"date"},"earnedMicros":{"type":["string","null"]},"shareMicros":{"type":["string","null"]},"releasedShareMicros":{"type":["string","null"]}}}},"nextCursor":{"type":["integer","null"]},"sandbox":{"type":"boolean"}}},"CampaignDailyRow":{"type":"object","properties":{"day":{"type":"string","format":"date","description":"YYYY-MM-DD."},"campaignId":{"type":"integer"},"campaignName":{"type":"string"},"goal":{"type":"string","description":"messages, orders, brand, video, installs, members …"},"impressions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"views":{"type":"string","pattern":"^\\d+$","description":"Verified views (50 % on screen for 1 s; video 2 s)."},"clicks":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"conversions":{"type":"string","pattern":"^\\d+$","description":"Click-attributed conversions."},"results":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"spendMicros":{"type":"string","pattern":"^\\d+$","description":"What was really charged (BDT micros)."}}},"CampaignDailyReport":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"YYYY-MM-DD."},"to":{"type":"string","format":"date","description":"YYYY-MM-DD."},"timezone":{"type":"string","description":"IANA zone of the days, e.g. Asia/Dhaka."},"currency":{"const":"BDT"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignDailyRow"}},"totals":{"type":"object","properties":{"impressions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"views":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"clicks":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"conversions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"results":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"spendMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50."}},"description":"Totals of this page's rows."},"nextCursor":{"type":["integer","null"]},"sandbox":{"type":"boolean","description":"Only for hz_test_ keys (always no rows)."}}},"EarningsDailyRow":{"type":"object","properties":{"day":{"type":"string","format":"date","description":"YYYY-MM-DD."},"propertyId":{"type":"integer"},"propertyName":{"type":"string"},"propertyKind":{"type":"string","description":"website, android_app, telegram_channel, youtube_channel …"},"placementId":{"type":"integer"},"placementName":{"type":["string","null"]},"format":{"type":"string"},"impressions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"views":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"clicks":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"earnings":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"micros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50."}}}},"status":{"enum":["pending","available"]}}},"EarningsDailyReport":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"YYYY-MM-DD."},"to":{"type":"string","format":"date","description":"YYYY-MM-DD."},"timezone":{"const":"Asia/Dhaka"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/EarningsDailyRow"}},"totals":{"type":"object","properties":{"impressions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"views":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"clicks":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"earnings":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"pendingMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50."},"availableMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50."}}}}}},"nextCursor":{"type":["integer","null"]},"sandbox":{"type":"boolean"}}},"Placement":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":["string","null"]},"format":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"property":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"kind":{"type":"string"},"status":{"type":"string"}}}}},"AgencyClients":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"YYYY-MM-DD."},"to":{"type":"string","format":"date","description":"YYYY-MM-DD."},"currency":{"const":"BDT"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"The client link id."},"clientAccountId":{"type":["integer","null"]},"clientName":{"type":["string","null"],"description":"null while the invitation is not accepted."},"status":{"enum":["invited","active","declined","revoked"]},"role":{"enum":["admin","finance","read_only"]},"billingParty":{"enum":["client","agency"]},"invitedAt":{"type":"string","format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"totals":{"type":["object","null"],"properties":{"impressions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"views":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"clicks":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"conversions":{"type":"string","pattern":"^\\d+$","description":"A count as a decimal string (can exceed 2^53)."},"spendMicros":{"type":"string","pattern":"^\\d+$","description":"Money in integer micros as a string: \"1500000\" = 1.50."},"timezone":{"type":"string"}}}}}},"nextCursor":{"type":["integer","null"]},"sandbox":{"type":"boolean"}}},"WebhookEvent":{"type":"object","required":["id","type","created","livemode","accountId","data"],"properties":{"id":{"type":"string","description":"A stable event id (evt_…); the same event is never sent twice to one endpoint, but a retry repeats it."},"type":{"enum":["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"]},"created":{"type":"string","format":"date-time"},"livemode":{"type":"boolean"},"accountId":{"type":"integer"},"data":{"type":"object","additionalProperties":true}}}}}}