Skip to main content

Add an approval

Attaches a signed approval to an existing intent. The approval proves the user has authorized the swap and allows it to proceed. After intent creation, you must attach the approval before execution.

info

Learn sample codes of the approval signed data generation.

HTTP request

POST /v1/intents/{intent_id}/approvals

Request

Header parameters

Requires authentication.

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. It must be base64 string for cosign approval type.
info

The value of the signed_data parameter for Solana transactions is a stringified JSON object containing two string fields: transaction and user_address.

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": "eyJ0cmFuc2FjdGlvbi..."
}

Response

Successful response

NameTypeDescription
intent_idStringIntent ID for approval.
Sample response for Permit2 (EVM)
application/json
{
"intent_id": "528d72ae-61cd-4fbc-9940-48ce4104abbb"
}
Sample response for HTLC (Bitcoin)
application/json
{
"intent_id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5"
}
Sample response for Cosign (Solana)
application/json
{
"intent_id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5"
}

Error response

Check the error response schema.

Error codes

Error codeError typeError description
400bad_request_errorInvalid body parameters.
401authentication_errorAuthentication error.
404entity_not_found_errorEntity not found.
404http_errorIncorrect HTTP request.
422unprocessable_entity_errorApproval failed.
422unprocessable_entity_errorConfiguration error.
422unprocessable_entity_errorIntent could not be processed.
422unprocessable_entity_errorIntent signature validation failed on provider side.
422unprocessable_entity_errorInvalid balance.
422unprocessable_entity_errorInvalid intent status.
422unprocessable_entity_errorInvalid Permit2.
500internal_errorIntent approve error.
500internal_errorInternal configuration error.
{
"code": 400,
"type": "bad_request_error",
"message": "body.approval_type invalid value"
}