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
| Name | Type | Required | Description |
|---|---|---|---|
intent_id | String | Required | Intent 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.
| Name | Type | Required | Description |
|---|---|---|---|
approval_type | String | Required | Options between permit2, cosign, htlc depends on the network. |
signed_data | String | Required | Signed 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
| Name | Type | Description |
|---|---|---|
intent_id | String | Intent 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 code | Error type | Error description |
|---|---|---|
400 | bad_request_error | Invalid body parameters. |
401 | authentication_error | Authentication error. |
404 | entity_not_found_error | Entity not found. |
404 | http_error | Incorrect HTTP request. |
422 | unprocessable_entity_error | Approval failed. |
422 | unprocessable_entity_error | Configuration error. |
422 | unprocessable_entity_error | Intent could not be processed. |
422 | unprocessable_entity_error | Intent signature validation failed on provider side. |
422 | unprocessable_entity_error | Invalid balance. |
422 | unprocessable_entity_error | Invalid intent status. |
422 | unprocessable_entity_error | Invalid Permit2. |
500 | internal_error | Intent approve error. |
500 | internal_error | Internal configuration error. |
- 400
- 401
- 404
- 422
- 500
{
"code": 400,
"type": "bad_request_error",
"message": "body.approval_type invalid value"
}
{
"code": 401,
"type": "authentication_error",
"message": "Authentication error"
}
Sample error response with the entity_not_found_error type
{
"code": 404,
"type": "entity_not_found_error",
"message": "Entity not found"
}
Sample error response with the http_error type
{
"code": 404,
"type": "http_error",
"message": "HTTP error"
}
{
"code": 422,
"type": "unprocessable_entity_error",
"message": "Configuration error"
}
{
"code": 500,
"type": "internal_error",
"message": "Internal configuration error"
}