Skip to documentation
AdQuestDocs

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.

PropertyTypeMeaning
messagestringA readable description.
codeAdQuestErrorCodeA stable code from the list below. UNKNOWN for anything unrecognized.
statusnumber | undefinedThe HTTP status, when there was a response.
detailsunknownExtra 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

CodeMeaning
INVALID_API_KEYThe key is wrong, disabled or revoked.
INACTIVE_PLATFORMThe platform is not both accepted and active.
ORIGIN_FORBIDDEN, PACKAGE_FORBIDDENThe request came from an origin or package that is not on the platform’s Where AdQuest may appear list.
CAPACITY_EXHAUSTEDDelivery limits were reached. Back off and retry later.
QUEST_NOT_FOUNDThe quest does not exist or is not available to this participant.
TIMER_NOT_STARTEDThe quest was not started or its timer has not run.
INVALID_ANSWERThe submitted answer is not valid for the question.
ALREADY_COMPLETEDThe participant already completed this quest.
PARTICIPANT_AUTH_REQUIRED, PARTICIPANT_EXPIREDThe participant token is missing or has expired. Refresh it through your backend.
PARTICIPANT_BLOCKEDThe participant’s account is blocked. Refreshing will not help.
INVALID_DEEP_LINKA link was rejected by the deep link allowlist.
INSUFFICIENT_TOKENSThe participant does not have enough tokens for the purchase.
LOTTERY_NOT_FOUND, LOTTERY_NOT_AVAILABLEThe lottery does not exist or is not available for this participant.
LOTTERY_CLOSEDThe lottery is no longer open for entries.
ENTRY_LIMIT_REACHEDThe participant reached the lottery’s entry limit.
DUPLICATE_PURCHASEA purchase with the same idempotency key was already made.
CLAIM_NOT_AVAILABLEThe claim does not exist for this participant or is closed.
RATE_LIMITEDToo many requests. Back off instead of retrying in a loop.
NETWORK_ERRORThe API could not be reached.
HOST_CONTEXT_TOO_LARGE, HOST_CONTEXT_INVALIDThe host context is over 8 KB or has the wrong shape.
STREAK_CALLBACK_REQUIREDStreak days are submitted from the callback URL, not from the SDK.
UNSUPPORTED_PROOFThe quest asks for evidence this client cannot send.
UNKNOWNAn 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.

Something unclear, missing or wrong here? Tell us