Skip to main content

Async jobs & polling

Some endpoints kick off long-running on-chain work and return 202 Accepted immediately. Poll the matching status endpoint until the job reaches a terminal state.

We don't send webhooks today — polling is the only option.

Fire-and-forget endpoints

StartStatus poller
POST /token/createGET /token/creation-status/:botId
POST /holders/initializeGET /holders/status/:holdersId
POST /flexi/initializeGET /flexi/getgroup/:sGroupId
POST /classic/initializeGET /classic/group/:sGroupId

Status values (eStatus)

ValueMeaning
'1'Awaiting payment or first step
'2'Running
'3'Completed
'4'Cancelled / expired
'9'Failed — check sErrorMessage

Status endpoints also return a statusLabel field with a human-readable name (PENDING_PAYMENT, RUNNING, COMPLETED, CANCELLED, FAILED) for convenience.

Retry guidance

Don't retry fire-and-forget HTTP calls on timeout — the job may already be running on our side. Call the status endpoint to see where it is. Our jobs resume automatically after internal restarts; you'll see the final state through the normal poll.

Example polling loop

BOT_ID="66a9ff…"
while true; do
BODY=$(curl -s "$BASE_URL/token/creation-status/$BOT_ID" \
-H "Authorization: Bearer $ACCESS" \
-H "x-user-id: $USER_ID")
STATUS=$(echo "$BODY" | jq -r '.eStatus')
case "$STATUS" in
3) echo "done"; echo "$BODY" | jq; break ;;
9) echo "failed: $(echo "$BODY" | jq -r '.sErrorMessage')"; exit 1 ;;
*) sleep 5 ;;
esac
done

Lost ids — disaster recovery

If your client forgets a job id mid-flow:

  • Tokens: GET /token/all lists every token the user has created.
  • Holders: GET /holders/all?eStatus=1 lists pending orders with holdersId, paymentAddress and nRequiredSol — enough to cancel and restart.
  • Flexi / Classic: GET /flexi/getallgroups and GET /classic/allgroups list all groups with current status.