Sandbox setup
- Go to app.lightspark.com, create an account, and generate sandbox API keys from the dashboard.
- Ask your Lightspark contact to enable the Agents API for your sandbox platform, and any of spending pools, agent cards, purchase cards, stored cards, claimable payouts and payout runs you want to test.
- Use the normal base URL,
https://api.lightspark.com/grid/2025-10-13, with your sandbox token over HTTP Basic auth.
USDB in its supported currencies.
End-to-end test
1
Create a customer and find the Global Account
Follow steps 1 and 2 of the Global Accounts walkthrough.
2
Create and connect an agent
POST /agents with a policy, then redeem the returned device code with POST /agents/device-codes/redeem as the agent software would. Keep the accessToken as $AGENT_TOKEN. See Creating agents.3
Delegate signing
Verify the customer’s email OTP credential to get a session (the sandbox OTP code is always
000000), then create the agent’s delegated key with POST /auth/delegated-keys, stamping each leg with the session key. See Sandbox testing for Global Accounts for the OTP and signing shortcuts.4
Fund the Global Account
INCOMING_PAYMENT webhook.5
Send under and over the threshold
As the agent, quote and execute a send below the policy’s
approvalThresholds.amount and check it comes back APPROVED. Then send one above it and check it comes back PENDING_APPROVAL and your endpoint receives AGENT_ACTION.PENDING_APPROVAL.6
Approve, reject and let one expire
Approve one pending action and reject another with
POST /agents/{agentId}/actions/{actionId}/approve and .../reject. Leave a third until its quote expires and check it ends FAILED. Poll each with GET /agents/me/actions/{actionId} as the agent would.7
Test the edges
Exceed
perTransactionLimit and check the send is refused with 403. Pause the agent with PATCH /agents/{agentId} and check it can no longer act. Retry a create with the same Idempotency-Key and check you get the original back.Simulating card charges
Where your sandbox platform has a card program, charge an agent’s cards with the card simulators. They support card programs where Grid makes authorization decisions. The simulation is accepted with202 and its result arrives asynchronously, with the usual card webhooks.
merchant.descriptor (1 to 25 characters) choose the outcome:
Use them to check how your product shows an agent’s card charges and declines, including charges above the agent’s limits or spending pool. The other simulators under
/sandbox/cards/{id}/simulate/... cover clearing, returns, reversals and disputes.
Webhooks
All webhooks fire in sandbox. UsePOST /webhooks/test to send a signed test event to your endpoint, and see Webhooks for the agent events.
Moving to production
- Swap in production API tokens and ask your Lightspark contact to enable the agent features you use on your production platform.
- Remove sandbox shortcuts, such as the fixed OTP code, from your client and server code.
- Configure production webhook endpoints and confirm
AGENT_ACTION.PENDING_APPROVALreaches the customer as a notification. - Start agents with conservative policies and small limits.