const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
parties: [
{
external_reference: '<string>',
wallet_address: '<string>',
role: '<string>',
name: '<string>',
chain_id: -1
}
],
legs: [
{
leg_type: '<string>',
instrument_id: '<string>',
quantity: 1,
party_role: '<string>',
chain_id: 123,
token_standard: '<string>',
recipient_party_role: '<string>',
external_reference: '<string>'
}
],
template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
template_slug: '<string>',
external_reference: '<string>',
timeout_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api-staging.keystoneos.xyz/v1/settlements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-staging.keystoneos.xyz/v1/settlements"
payload = {
"idempotency_key": "<string>",
"parties": [
{
"external_reference": "<string>",
"wallet_address": "<string>",
"role": "<string>",
"name": "<string>",
"chain_id": -1
}
],
"legs": [
{
"leg_type": "<string>",
"instrument_id": "<string>",
"quantity": 1,
"party_role": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"recipient_party_role": "<string>",
"external_reference": "<string>"
}
],
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_slug": "<string>",
"external_reference": "<string>",
"timeout_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api-staging.keystoneos.xyz/v1/settlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"parties": [
{
"external_reference": "<string>",
"wallet_address": "<string>",
"role": "<string>",
"name": "<string>",
"chain_id": -1
}
],
"legs": [
{
"leg_type": "<string>",
"instrument_id": "<string>",
"quantity": 1,
"party_role": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"recipient_party_role": "<string>",
"external_reference": "<string>"
}
],
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_slug": "<string>",
"external_reference": "<string>",
"timeout_at": "2023-11-07T05:31:56Z"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"idempotency_key": "<string>",
"platform_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_version": 123,
"external_reference": "<string>",
"settlement_type": "<string>",
"parties": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "<string>",
"platform_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_reference": "<string>",
"name": "<string>",
"wallet_address": "<string>",
"chain_id": 123,
"status": "<string>",
"confirmed_at": "2023-11-07T05:31:56Z",
"wallet_address_hint": "<string>",
"counterparty_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"legs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leg_index": 123,
"leg_type": "<string>",
"instrument_id": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"quantity": "<string>",
"direction": "<string>",
"party_role": "<string>",
"status": "<string>",
"external_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"recipient_party_role": "<string>"
}
],
"state": "<string>",
"timeout_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"timeout_claimable": true,
"trade_type": "<string>",
"linked_settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coordinator": "<string>",
"coordinator_chain": "<string>",
"triggered_by": {},
"audit_anchor_hash": "<string>",
"repo_terms": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenor_days": 123,
"rate_bps": 123,
"haircut_bps": 123,
"margin_band_lower": "<string>",
"margin_band_upper": "<string>",
"close_leg_settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Initiate settlement
Create a new settlement. Validates the template and parties, then creates the settlement in the machine’s initial state with the machine version pinned. The settlement engine is enqueued automatically to advance through the engine-owned region of the machine. The request is idempotent - sending the same idempotency_key returns the existing settlement.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
parties: [
{
external_reference: '<string>',
wallet_address: '<string>',
role: '<string>',
name: '<string>',
chain_id: -1
}
],
legs: [
{
leg_type: '<string>',
instrument_id: '<string>',
quantity: 1,
party_role: '<string>',
chain_id: 123,
token_standard: '<string>',
recipient_party_role: '<string>',
external_reference: '<string>'
}
],
template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
template_slug: '<string>',
external_reference: '<string>',
timeout_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api-staging.keystoneos.xyz/v1/settlements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-staging.keystoneos.xyz/v1/settlements"
payload = {
"idempotency_key": "<string>",
"parties": [
{
"external_reference": "<string>",
"wallet_address": "<string>",
"role": "<string>",
"name": "<string>",
"chain_id": -1
}
],
"legs": [
{
"leg_type": "<string>",
"instrument_id": "<string>",
"quantity": 1,
"party_role": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"recipient_party_role": "<string>",
"external_reference": "<string>"
}
],
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_slug": "<string>",
"external_reference": "<string>",
"timeout_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api-staging.keystoneos.xyz/v1/settlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"parties": [
{
"external_reference": "<string>",
"wallet_address": "<string>",
"role": "<string>",
"name": "<string>",
"chain_id": -1
}
],
"legs": [
{
"leg_type": "<string>",
"instrument_id": "<string>",
"quantity": 1,
"party_role": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"recipient_party_role": "<string>",
"external_reference": "<string>"
}
],
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_slug": "<string>",
"external_reference": "<string>",
"timeout_at": "2023-11-07T05:31:56Z"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"idempotency_key": "<string>",
"platform_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_version": 123,
"external_reference": "<string>",
"settlement_type": "<string>",
"parties": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "<string>",
"platform_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_reference": "<string>",
"name": "<string>",
"wallet_address": "<string>",
"chain_id": 123,
"status": "<string>",
"confirmed_at": "2023-11-07T05:31:56Z",
"wallet_address_hint": "<string>",
"counterparty_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"legs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"leg_index": 123,
"leg_type": "<string>",
"instrument_id": "<string>",
"chain_id": 123,
"token_standard": "<string>",
"quantity": "<string>",
"direction": "<string>",
"party_role": "<string>",
"status": "<string>",
"external_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"recipient_party_role": "<string>"
}
],
"state": "<string>",
"timeout_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"timeout_claimable": true,
"trade_type": "<string>",
"linked_settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coordinator": "<string>",
"coordinator_chain": "<string>",
"triggered_by": {},
"audit_anchor_hash": "<string>",
"repo_terms": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenor_days": 123,
"rate_bps": 123,
"haircut_bps": 123,
"margin_band_lower": "<string>",
"margin_band_upper": "<string>",
"close_leg_settlement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Auth0 JWT access token. See Authentication for details.
Body
Your key for safe retries, unique within the environment. A retry with the same key returns the existing resource. Keys starting with 'match-' are reserved for keys KeyStone derives and are refused.
1 - 2551Show child attributes
Show child attributes
1Show child attributes
Show child attributes
100255Optional explicit deadline override. When omitted, the deadline defaults to now + the template's timeout_seconds.
Response
Successful Response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
True when the deadline passed while the settlement's exit still belonged to the chain (deposits pending). The contract accepts deposits and execution strictly before the deadline, so the settlement can no longer execute; where it is registered on-chain, either party can call the permissionless claimTimeout to resolve it, then claimRefund per deposited leg. KeyStone never calls claimTimeout itself.
Show child attributes
Show child attributes