Prerequisites
- A KeyStone OS platform account with API credentials (M2M client ID and secret) - find these in the KeyStone Dashboard under Settings > General
- An active environment (sandbox or production)
Step 1: Authenticate
KeyStone uses Auth0 M2M (client credentials) tokens for platform API access.access_token is a JWT valid for 24 hours. Include it in all API requests:
Step 2: Browse available templates
Templates define the settlement workflow and are pre-configured by KeyStone. Browse the available templates to find the right one for your use case.dvp-standard template. Note the slug field - you will reference it when submitting instructions.
Step 3: Submit the seller instruction
Submit one side of the trade. KeyStone generates a trade reference that your counterparty will use to submit the other side.Step 4: Share trade reference with counterparty
Send thetrade_reference to your counterparty through your own channels (email, chat, API integration, etc.). They will use it to submit the matching instruction.
Step 5: Counterparty submits matching instruction
The counterparty submits their side with the same trade reference:Step 6: Settlement created on-chain
After matching, the settlement entersINSTRUCTED and KeyStone registers it on the KeystoneSettlement contract - recipients, deposit keys, party hashes, and the timeout are all bound at registration.
Step 7: Compliance runs automatically
If the template has compliance configured, KeyStone screens all parties through LSEG World-Check (entity) and CipherOwl (wallet), then attests the results to the ComplianceRegistry on-chain. The contract enforces that compliance must pass before the settlement can advance.Step 8: Both parties deposit to escrow
When the settlement reachesAWAITING_DEPOSITS, the settlement response includes a deposit_secret and deposit_key for each leg. Both parties deposit their assets directly to the escrow smart contract by calling depositLeg(settlementId, legIndex, depositSecret). Your platform uses its custody provider to sign the deposit transaction. KeyStone is not involved in the deposit step.
Step 9: Contracts auto-execute and finalize
The last deposit executes the settlement inline once the compliance gate passes - the contract pays every leg to its recipient bound at registration in one atomic transaction. Tokens go to the buyer, USDC goes to the seller. KeyStone observes theSettlementExecuted event and the settlement moves through SETTLED to FINALIZED.
Step 10: Check the result
What happened
Next: Authentication
Learn about M2M tokens, user tokens, scopes, and environment resolution.