Skip to main content

Create a swap intent

Creates a new intent with the swap data. A resolver makes an intent offchain and executes it onchain later.

HTTP request

POST /v1/intents/

Request

Header parameters

Requires authentication.

Body parameters

NameTypeRequiredDescription
quote_idStringRequiredYou must resecive quote before swap intent creation.
fromObjectRequiredBase token information for swap intent creation.
from.addressStringRequiredPart of the from object. Sender address.
from.refund_addressStringRequiredPart of the from object. Address for potential refund.
from.public_keyStringOptionalPart of the from object. Required only if source chain is Bitcoin or Solana.
toObjectRequiredQuote token information for swap intent creation.
to.addressStringRequiredPart of the to object. Receiver address.
Sample request
application/json
{
"quote_id": "e63243b6-c489-42c6-a8a2-739c23bc36a1",
"from": {
"address": "0xbe7A42Af09C2.....C064f5Bd98a88c8EE",
"refund_address": "0xbe7A42Af09C25.....064f5Bd98a88c8EE"
},
"to": {
"address": "B69793d1.....ChkQEr5DZo"
}
}

Response

Successful response

NameTypeRequiredDescription
idStringRequiredSwap intent UUID.
expires_atTimestamp (milliseconds)OptionalSwap intent expiration time.
secret_hashStringOptionalValue based on public_key in request.
approval_typeStringRequiredApproval mechanism, depends on network. Possible values: permit2, cosign or htlc.
approve_toString / NullableRequiredApproval address.
params_to_signObjectRequiredObject with data to sign by user's wallet.
quoteObjectRequiredApplied quote for the current swap intent.
Sample response (EVM and Tron)
application/json
{
"id": "bf53a856-46aa-4865-8d66-a649a9d5b169",
"expires_at": 1780078455,
"secret_hash": "0x3f2bb70a115e0a.....187d9351c565682b8",
"approve_to": null,
"approval_type": "permit2",
"params_to_sign": {
"nonce": 81,
"additional_data": {
"types": {
"DepositWitness": [
{
"name": "resolverDepositAddress",
"type": "address"
},
{
"name": "secretHash",
"type": "bytes32"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"PermitWitnessTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
},
{
"name": "witness",
"type": "DepositWitness"
}
]
},
"domain": {
"name": "Permit2",
"chainId": 1,
"version": "1",
"verifyingContract": "0x000000000022D.....DEE9F6B43aC78BA3"
},
"witness": {
"deadline": "0x6a19d777",
"secretHash": "0x3f2bb70a115e0a.....187d9351c565682b8",
"resolverDepositAddress": "0x745f221ca.....a6649a0c5fc5"
},
"witness_hash": "0xa6b608c2503bb6e6d9.....2a054786dbaf41beed9",
"witness_type_string": "DepositWitness witness)DepositWitness(address resolverDepositAddress,bytes32 secretHash,uint256 deadline)TokenPermissions(address token,uint256 amount)"
},
"escrow_contract_address": "0x8DcbE1aCf3.....e318F8e8836",
"permit2_contract_address": "0x0000000000.....6B43aC78BA3",
"resolver_deposit_address": "0x745F221caec.....A6649a0c5Fc5"
},
"quote": {
"id": "f5a68149-e20c-4774-9494-16d3cee0f84d",
"from": {
"network_id": 3,
"token_id": 278,
"contract_address": "0xdac17f958d2.....97c13d831ec7",
"amount": "1000000",
"decimals": 6
},
"to": {
"network_id": 177,
"token_id": 678,
"contract_address": null,
"amount": "7277684",
"decimals": 9,
"min_amount": "7241295"
},
"slippage_bps": "50",
"expires_at": 1780071289460000,
"fees": {
"changelly": {
"network_id": 3,
"contract_address": "0xc02aaa39b2.....d9083c756cc2",
"token_id": 4669,
"decimals": 18,
"amount": "4909698369185",
"bps": "100"
},
"affiliate": {
"network_id": 3,
"contract_address": "0xc02aaa39b2.....d9083c756cc2",
"token_id": 4669,
"decimals": 18,
"amount": "2454849184592",
"bps": "50"
}
}
}
}

Error response

Check the error response schema.

Error codes

Error codeError typeError description
400bad_request_errorInvalid body parameters.
400unprocessable_entity_errorSlippage value cannot be processed.
401authentication_errorAuthentication error.
404http_errorIncorrect HTTP request.
422unprocessable_entity_errorConfiguration error.
422unprocessable_entity_errorIntent already exists for quote.
422unprocessable_entity_errorInvalid address.
422unprocessable_entity_errorInvalid amount.
422unprocessable_entity_errorInvalid swap status.
422unprocessable_entity_errorNetwork or token couldn’t be processed.
422unprocessable_entity_errorOnly wrapped tokens can be used as source.
422unprocessable_entity_errorSwap type cannot be processed.
422unprocessable_entity_errorSwap type could not be processed.
422unprocessable_entity_errorQuote expired.
422unprocessable_entity_errorQuotes not available.
422unprocessable_entity_errorRequested pair could not be processed.
422unprocessable_entity_errorSwap amount is too large.
422unprocessable_entity_errorSwap amount is too small.
500internal_errorInternal configuration error.
500internal_errorInternal processing error.
Sample error response with the unprocessable_entity_error type
{
"code": 400,
"type": "creation_error",
"message": "Slippage value cannot be processed"
}
Sample error response with the bad_request_error type
{
"code": 400,
"type": "bad_request_error",
"message": "body.from.QuoteDirectionByTokenId.token_id must be an integer"
}