Skip to main content
Every browser tab running the SDK gets a session. A session can’t run tasks until your server claims it with your ak_live_... API key. Claiming is how Argide knows the page belongs to you: the browser proves it holds a freshly minted pairing code, and your server proves it holds your key.

The session lifecycle

  • Mintedinit() created a new session and produced { sessionId, pairingCode }. do() queues until the claim lands; an unclaimed session’s tasks are refused by the server.
  • Claimed — your server exchanged the pair for a claim. Tasks run.
  • Recovered — after a page reload, the SDK re-attaches to the existing session. It is already claimed; no new pairing code is issued.

Default path: the claim callback

Pass claim to init and the SDK calls it at exactly the right moment — only when a session is freshly minted, never on recovery. You don’t track any state yourself.
The quickstart has a ready-made Next.js route handler for the server side of this call.

Custom path: your own channel

If your architecture forwards the pairing code to your server some other way — an existing socket, your chatbot’s backend — omit claim and read the session yourself:
Claim only when recovered is false. A recovered session was already claimed; re-claiming returns 409 ALREADY_CLAIMED, which is reserved as the signal that someone is using a stolen pairing code.

The claim endpoint

Your server performs the claim with one HTTP call:

Treat ALREADY_CLAIMED as a security signal

409 ALREADY_CLAIMED is reserved for one situation: a pairing code that was already exchanged is being presented again. If your integration claims only when recovered is false, you should never see it in normal operation. When you do see it, treat it as someone replaying a stolen code — log it and alert. Don’t retry the claim.