Skip to documentation
AdQuestDocs

API reference

Base URL, authentication, headers and response format shared by every public AdQuest route.

On this page

Base URL

Base URL
ADQUEST_API_URL=https://api.adquest.batriders.ir/api/v1

All routes in this reference are relative to this URL. Use the API URL for your environment, and always include /api/v1.

Authentication

HeaderUsed onValue
X-AdQuest-Platform-KeyEvery /platform route except public-configYour public API key (aqk_). Safe in browser code.
X-AdQuest-Participant-TokenRewards routes and every quest action: start, view, click, visit, question, progress, events, referrals, metrics, growth-status, complete (required); quest list, detail and stats (optional)The participant token your backend got from a participant session. It is the participant's identity: a body external_user_id is optional and must match it. The public API key alone can no longer start or complete quests.
X-AdQuest-Platform-SecretParticipant sessions and winner contact (backend only)Your Secret Key (aqs_). Never expose it.
X-AdQuest-RuntimeOptionalJSON describing the SDK runtime capabilities, such as {"runtime_version":1,"capabilities":["quests"]}.
X-TimezoneOptionalIANA timezone of the participant, such as Asia/Tehran.

Response format

Response envelope
{
  "status": true,
  "code": "OK",
  "message": "Human-readable result",
  "data": {}
}
  • status is true when the request succeeded. Check it as well as the HTTP status.
  • code is OK on success. On failure it is an error code you can match on. See Errors. Lottery, claim and config routes omit the top-level code. Read data.code for their error code.
  • data holds the result. Validation errors (HTTP 422) list each failing field in data.
  • Request fields and response fields are snake_case. The SDK converts them to camelCase.

Rate limits

Requests are limited per minute. When you go over, the API answers HTTP 429. Back off and retry later instead of retrying in a loop.

ScopeLimit
Most routes300 a minute per participant token, or per API key and IP address. 120 a minute per IP address when no credentials are sent.
Create a participant session60 a minute.
Enter a lottery60 a minute.
Submit a claim30 a minute.
Winner contact, streak callback60 a minute.
Acknowledge a fulfillment120 a minute.
Public config240 a minute per IP address.

Idempotency

Retry only with the same key, so a repeated request never pays twice.

RouteHow
Enter a lotteryidempotency_key in the body, unique for each purchase attempt.
Complete a questIdempotency-Key header. A repeated key returns the earlier completion.
Streak callbackOptional Idempotency-Key header.
Acknowledge a fulfillmentThe same external_reference is safe to repeat. A different one returns 409.
Send an eventevent_id. A repeated ID returns duplicate: true.

Pagination

List routes take per_page and page. Lotteries return a pagination object with current_page, last_page, per_page and total. Balance history returns a paginated list in the same style.

Resources

Something unclear, missing or wrong here? Tell us