The Agents API must be enabled for your platform; until it is, agent endpoints answer
403. To enable it, book a demo or reach out to your Lightspark contact.Create an agent
CallPOST /agents from your backend with platform credentials. name, customerId and policy are required. See Policies & permissions for every policy field.
201 Created
Optional fields
Agents of
BUSINESS customers are available only where your platform enables them, and actingFor is required for them. Until the business’s KYB status is APPROVED, its agents’ sends and deposits are held to the same limits as an unverified individual’s, counted across the whole business.
Idempotent creation
Idempotency-Key is optional on POST /agents but you should always send one. Without a key, Grid cannot recognize a retry, so each request creates its own agent.
- A retry with a key already used returns the agent the first request created, with
200instead of201, and a new device code that replaces any unredeemed one. - The retry is compared with the agent as it is now. Reusing a key with a different customer, name, policy,
actingFororspendingPoolId, after the agent’s policy or pool was changed, for an agent that was deleted, or for one that is already connected, is rejected with409. Use a new key for a new agent.
Connect the agent software
ThedeviceCode.code is an opaque 22-character string the agent software exchanges for its own credential. Hand it to the customer to paste into the agent, or pass it to the agent through your own install flow.
- Grid stores only a hash of the code, so it is returned only when it is issued.
- It can be redeemed once, and only before
expiresAt. Codes expire 15 minutes after they are issued by default; Grid can set your platform’s lifetime between 1 and 60 minutes. - An agent has at most one unredeemed code. If it expires or is lost, issue a new one with
POST /agents/{agentId}/device-codes, which invalidates the previous code. Regenerating is refused with409once the agent is connected.
Redeem the code
The agent software callsPOST /agents/device-codes/redeem. It needs no platform credentials: the code itself is the proof.
429 RATE_LIMITED with a Retry-After header and should wait that long before retrying.
Watch for the connection
From your backend, pollPOST /agents/device-codes/status with the code. status is one of:
Once redeemed, the agent’s
isConnected is true. You can also list connected agents with GET /agents?isConnected=true.
What the agent can call
With its token, the agent reads its own profile, policy and current usage fromGET /agents/me, and calls the operations its permissions allow: quotes and sends, deposits, external accounts, cards, and identity. Every /agents/me/... request is bound to the agent’s customer; the agent cannot name another customer, and a resource of another customer answers 404.
Delegate signing on the Global Account
Sends from a Global Account must be signed for the wallet. For an agent, the customer authorizes Grid to sign on the agent’s behalf by creating a delegated key for that agent and wallet withPOST /auth/delegated-keys:
- Call
POST /auth/delegated-keyswith no signature headers. Grid responds202with apayloadToSignandrequestId. - Stamp
payloadToSignwith the customer’s session key and retry withGrid-Wallet-SignatureandRequest-Id. Grid responds with a second202and a newpayloadToSign. - Stamp the new payload and retry once more. Grid responds
201with theDelegatedKeyinACTIVEstatus.
ACTIVE, Grid uses it to sign the agent’s sends that its policy allows or the customer approves; your platform never handles the key material. Each agent and wallet pair may have at most one unrevoked (PENDING or ACTIVE) key. A flow abandoned after the second leg leaves a PENDING key that blocks a new one until you revoke it.
Manage the agent
A paused agent cannot initiate any action. Deleting an agent freezes the standard card issued for it; if the customer reconnects the same agent software as a new agent,
POST /agents/{agentId}/card-handover moves that card to the new agent and unfreezes it. See Cards.