Create Swap

Creates a new swap based on an existing quote. This is the second step in the swap flow, after obtaining a quote.

HTTP request
POST/swaps
Authorization requirements
Header Type Required Description
Authorization string Yes Bearer token used to authenticate the request. See Authentication flows for instructions on generating this token.
Request body
Field Type Required Description
quoteId string Yes ID of the quote used for creating the swap. Length must be between 1 and 64 characters.
provider string Yes Swap provider. Must match the provider used in the quote. One of UniswapX or UniswapClassic.
walletId string Yes ID of the IBM Digital Asset Haven wallet spending the source asset. Must match the quote. Length must be 1 to 64 characters.
slippageBps number Yes Slippage tolerance in basis points. Must match the quote. One basis point equals 0.01 percent.
sourceAsset object Yes Source asset spent in the swap. Must match the quote.
targetAsset object Yes Target asset received in the swap. Must match the quote.
reference string No User-defined reference for the swap.
targetWalletId string No ID of the wallet receiving the target asset. Must match walletId under current system rules. Length must be 1 to 64 characters.
Supported asset formats
  • Native Asset
  • EVM Fungible Token (ERC‑20)
These use the same structures as the Transfer API and Swap Quote API.
curl --request POST \
  --url https://api.digitalassets.ibm.com/swaps \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-DFNS-USERACTION: <api-key>' \
  --data '
{
  "quoteId": "swapQuote-3hgv4-q8tbf-8v2ajmrbmg6m4i9t",
  "reference": "optional reference for record keeping",
  "provider": "UniswapClassic",
  "walletId": "wa-123456-12345678",
  "targetWalletId": "wa-123456-87654321",
  "slippageBps": 50,
  "sourceAsset": {
    "kind": "Native",
    "amount": "1000000000000000000"
  },
  "targetAsset": {
    "kind": "Erc20",
    "contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "5600000"
  }
}
' 
Response
200: Success

Example response:

{
  "id": "swap-6a3ku-bn8d7-8u5rs1oukojms7k8",
  "quoteId": "swapQuote-3hgv4-q8tbf-8v2ajmrbmg6m4i9t",
  "reference": null,
  "walletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
  "targetWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
  "status": "PendingPolicyApproval",
  "provider": "UniswapClassic",
  "quotedSourceAsset": {
    "kind": "Native",
    "amount": "10000000000",
    "metadata": {
      "network": "EthereumSepolia",
      "name": "Ethereum",
      "symbol": "SepoliaETH",
      "decimals": 18,
      "tid": "native:eth"
    }
  },
  "quotedTargetAsset": {
    "kind": "Erc20",
    "contract": "0xda0be7efd234295395d4204d0df4358339b57b27",
    "amount": "6467571553831928182",
    "metadata": {
      "network": "EthereumSepolia",
      "name": "Test",
      "symbol": "Test",
      "decimals": 18,
      "tid": "erc20:0xda0be7efd234295395d4204d0df4358339b57b27"
    }
  },
  "slippageBps": 100,
  "dateCreated": "2025-09-11T10:57:55.758Z",
  "requestBody": {
    "quoteId": "swapQuote-3hgv4-q8tbf-8v2ajmrbmg6m4i9t",
    "walletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "targetWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "provider": "UniswapClassic",
    "slippageBps": 100,
    "sourceAsset": {
      "kind": "Native",
      "amount": "10000000000"
    },
    "targetAsset": {
      "kind": "Erc20",
      "contract": "0xda0be7efd234295395d4204d0df4358339b57b27",
      "amount": "653003161"
    }
  },
  "requester": {
    "userId": "us-48r5q-eshfg-9pmr2lo6bmpr4i4i",
    "tokenId": "to-4etah-smoal-9n3rmhul4dpaueg5"
  }
}