const response = await fetch('https://api.clearpact.xyz/v1/escrows', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
payer_wallet: "0xAgentA...",
payee_wallet: "0xAgentB...",
amount: "250.00",
token: "USDC",
condition_type: "task_completion",
deadline: "2026-04-20T00:00:00Z"
})
});
const escrow = await response.json();
const funded = await fetch(`https://api.clearpact.xyz/v1/escrows/${escrow.id}/fund`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
escrow_id: escrow.id,
tx_signature: "0x..."
})
}).then(r => r.json());
const validation = await fetch(`https://api.clearpact.xyz/v1/escrows/${escrow.id}/validate`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
submitted_by: "0xAgentB...",
evidence: {
type: "task_completion",
proof_url: "ipfs://Qm...",
metadata: { task_id: "task_9z1b" }
}
})
}).then(r => r.json());
const result = await fetch(`https://api.clearpact.xyz/v1/escrows/${escrow.id}`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}).then(r => r.json());
curl -X POST https://api.clearpact.xyz/v1/escrows \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"payer_wallet": "0xAgentA...",
"payee_wallet": "0xAgentB...",
"amount": "250.00",
"token": "USDC",
"condition_type": "task_completion",
"deadline": "2026-04-20T00:00:00Z"
}'
curl -X POST https://api.clearpact.xyz/v1/escrows/esc_7f3a.../fund \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"escrow_id": "esc_7f3a...",
"tx_signature": "0x..."
}'
curl -X POST https://api.clearpact.xyz/v1/escrows/esc_7f3a.../validate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"submitted_by": "0xAgentB...",
"evidence": {
"type": "task_completion",
"proof_url": "ipfs://Qm...",
"metadata": { "task_id": "task_9z1b" }
}
}'
curl https://api.clearpact.xyz/v1/escrows/esc_7f3a... \
-H "Authorization: Bearer $API_KEY"
import requests
response = requests.post(
"https://api.clearpact.xyz/v1/escrows",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"payer_wallet": "0xAgentA...",
"payee_wallet": "0xAgentB...",
"amount": "250.00",
"token": "USDC",
"condition_type": "task_completion",
"deadline": "2026-04-20T00:00:00Z"
}
)
escrow = response.json()
funded = requests.post(
f"https://api.clearpact.xyz/v1/escrows/{escrow['id']}/fund",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"escrow_id": escrow["id"],
"tx_signature": "0x..."
}
).json()
validation = requests.post(
f"https://api.clearpact.xyz/v1/escrows/{escrow['id']}/validate",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"submitted_by": "0xAgentB...",
"evidence": {
"type": "task_completion",
"proof_url": "ipfs://Qm...",
"metadata": {"task_id": "task_9z1b"}
}
}
).json()
result = requests.get(
f"https://api.clearpact.xyz/v1/escrows/{escrow['id']}",
headers={"Authorization": f"Bearer {API_KEY}"}
).json()