Skip to main content

Add an approval

After intent creation, an approval must be added before it can be executed. This endpoint attaches a signed approval to an existing intent. The approval proves the user has authorized the swap and allows it to proceed.

info

Learn examples of the approval signed data generation.

HTTP request

POST /v1/intents/{intent_id}/approvals

Request

Header parameters

Requires authentification.

Query parameters

NameTypeRequiredDescription
intent_idStringRequiredIntent ID for approval.

Body parameters

The request body depends on the approval mechanism. It includes the approval type and the signed data generated by the user.

NameTypeRequiredDescription
approval_typeStringRequiredOptions between permit2, cosign, htlc depends on the network.
signed_dataStringRequiredSigned data generated by the user via connected wallet.
Sample request for Permit2 (EVM)
application/json
{
"approval_type": "permit2",
"signed_data": "0x..."
}
Sample request for HTLC (Bitcoin)
application/json
{
"approval_type": "htlc",
"signed_data": "cHNid..."
}
Sample request for Cosign (Solana)
application/json
{
"approval_type": "cosign",
"signed_data": {
"transaction": "02000...",
"user_address": "F8ZRdxv********ETTDFg"
}
}

Response

The approval flow depends on the blockchain and swap type. The value of approval_type may change, and the structure of params_to_sign depends on the selected approval mechanism. Clients must always check approval_type and handle params_to_sign accordingly.

Response parameters

NameTypeDescription
idIntegerIntent ID for approval.
deadline_atTimestampTime for adding an approval.
secret_hashStringTransaction hash.
approval_typeStringOptions between permit2, cosign, htlc depends on the network.
params_to_signObjectObject with parameters for signing.
signed_dataStringSigned data generated by the user via connected wallet.
Sample response for Permit2 (EVM)
application/json
{
"id": "528d72ae-61cd-4fbc-9940-48ce4104abbb",
"deadline_at": 1772124002,
"secret_hash": "0x19875e12d834bc24********44dd26f37d367a44926",
"approval_type": "permit2",
"params_to_sign": {
"escrow_contract_address": "0x8DcbE1aCf********18F8e8836",
"permit2_contract_address": "0x0000000********6B43aC78BA3",
"resolver_deposit_address": "0xF3B3a4edB********f69f557029",
"nonce": 499,
"additional_data": {
"domain": { /* EIP-712 domain data */ },
"types": { /* EIP-712 types */ },
"witness": { /* witness data */ },
"secretHash": "0xabcde...",
"witness_type_string": "DepositWitness witness)DepositWitness(address resolverDepositAddress,bytes32 secretHash,uint256 deadline)TokenPermissions(address token,uint256 amount)",
"witness_hash": "0xc77ff4a96e********b8c12636c39f7f"
}
}
}
Sample response for HTLC (Bitcoin)
application/json
{
"id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5",
"approval_type": "htlc",
"params_to_sign": {
"psbt": "cHNidP8BAJ0CAAAAAQEBAQEB...",
"inputs": [0, 1, 2]
}
}
Sample response for Cosign (Solana)
application/json
{
"id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5",
"deadline_at": 1772124152,
"secret_hash": "0x84edcf7********dd0fb60baccf",
"approval_type": "cosign",
"params_to_sign": {
"transaction": "02000..."
}
}

Error response

Check the error response schema.