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. |
| requestId | string | undefined | The API’s X-Request-ID for the failure, when the response had one. Give it to support. |
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_SETTLES_ITSELF | complete was called on a streak quest. Days come from your server’s activity; the last day settles it. |
| UNSUPPORTED_PROOF | The quest asks for evidence this client cannot send. |
| RESERVATION_EXPIRED | The attempt’s time ran out. |
| STALE_RESERVATION | The request belongs to an earlier attempt. |
| RESTART_TOO_SOON | The quest was started again too soon. Wait details.retry_after seconds. |
| ATTEMPTS_EXHAUSTED | No attempts are left for this quest. |
| QUEST_PROCESSING | The submission is being processed. Read the result with awaitCompletion. |
| QUEST_BUSY | The quest is busy: 409, or 429 when the start gate answers. Both are retryable: try again after details.retry_after seconds. |
| QUEST_NOT_ACTIVE | The quest is not active. |
| CLICK_REQUIRED | The quest needs a real click on its media before completion. |
| VISIT_TOO_SHORT | The visit was shorter than the quest requires. |
| PROFILE_ALREADY_COMPLETE | The participant’s profile was already complete. |
| ANSWER_REJECTED | The answers were incorrect or did not match. |
| 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.