SDK reference
AdQuestError
The error every SDK method throws, with its stable codes.
On this page
The error
Every failed call throws an AdQuestError. Match on code, not on message.
| Property | Type | Meaning |
|---|---|---|
| message | string | A readable description. |
| code | AdQuestErrorCode | A stable code from the list below. UNKNOWN for anything unrecognized. |
| status | number | undefined | The HTTP status, when there was a response. |
| details | unknown | Extra data from the response. |
Handle an error
import { AdQuestError } from "@adquest/sdk";
try {
await client.getQuests();
} catch (error) {
if (error instanceof AdQuestError && error.code === "PARTICIPANT_EXPIRED") {
// Refresh the token through your backend, then retry once.
}
}Error codes
| Code | Meaning |
|---|---|
| INVALID_API_KEY | The key is wrong, disabled or revoked. |
| INACTIVE_PLATFORM | The platform is not both accepted and active. |
| ORIGIN_FORBIDDEN, PACKAGE_FORBIDDEN | The request came from an origin or package that is not on the platform’s Where AdQuest may appear list. |
| CAPACITY_EXHAUSTED | Delivery limits were reached. Back off and retry later. |
| QUEST_NOT_FOUND | The quest does not exist or is not available to this participant. |
| TIMER_NOT_STARTED | The quest was not started or its timer has not run. |
| INVALID_ANSWER | The submitted answer is not valid for the question. |
| ALREADY_COMPLETED | The participant already completed this quest. |
| PARTICIPANT_AUTH_REQUIRED, PARTICIPANT_EXPIRED | The participant token is missing or has expired. Refresh it through your backend. |
| PARTICIPANT_BLOCKED | The participant’s account is blocked. Refreshing will not help. |
| INVALID_DEEP_LINK | A link was rejected by the deep link allowlist. |
| INSUFFICIENT_TOKENS | The participant does not have enough tokens for the purchase. |
| LOTTERY_NOT_FOUND, LOTTERY_NOT_AVAILABLE | The lottery does not exist or is not available for this participant. |
| LOTTERY_CLOSED | The lottery is no longer open for entries. |
| ENTRY_LIMIT_REACHED | The participant reached the lottery’s entry limit. |
| DUPLICATE_PURCHASE | A purchase with the same idempotency key was already made. |
| CLAIM_NOT_AVAILABLE | The claim does not exist for this participant or is closed. |
| RATE_LIMITED | Too many requests. Back off instead of retrying in a loop. |
| NETWORK_ERROR | The API could not be reached. |
| HOST_CONTEXT_TOO_LARGE, HOST_CONTEXT_INVALID | The host context is over 8 KB or has the wrong shape. |
| STREAK_CALLBACK_REQUIRED | Streak days are submitted from the callback URL, not from the SDK. |
| UNSUPPORTED_PROOF | The quest asks for evidence this client cannot send. |
| UNKNOWN | An error the SDK does not recognize. Read details before you treat the call as a success. |
- Errors from the HTTP API use the same codes. The full list with next steps is on the Errors page.
- Treat an unfamiliar code as a failure, not a success.