# ARC20

## POST /brc20swap/get\_swap\_psbt2

> Get the unsigned PSBT for exchange

```json
{"openapi":"3.0.1","info":{"title":"Backend API","version":"1.0.0"},"servers":[{"url":"https://api-testnet4.dotswap.app","description":"Swap test"},{"url":"https://api.dotswap.app","description":"Swap official"}],"security":[],"paths":{"/brc20swap/get_swap_psbt2":{"post":{"summary":"Get the unsigned PSBT for exchange","deprecated":false,"description":"","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"send_coin_type":{"type":"string","title":"The type of coin to send"},"send_tick":{"type":"string","title":"The tick of the coin to send"},"send_amount":{"type":"string","title":"The amount to send"},"receive_coin_type":{"type":"string","title":"The type of coin to receive"},"receive_tick":{"type":"string","title":"The tick of the coin to receive"},"receive_amount":{"type":"string","title":"The amount to receive"},"address":{"type":"string","title":"Address"},"slipper":{"type":"integer"},"fee_rate":{"type":"integer"},"user_public_key":{"type":"string"},"chl":{"type":"string"},"method":{"type":"string","description":"Non-cross-pool swap, cross-pool pools_swap, just pass 'pools_swap'"},"token":{"type":"string"},"btc_address":{"type":"string"}},"required":["receive_amount","receive_coin_type","receive_tick","send_amount","send_coin_type","send_tick","slipper","fee_rate","token","user_public_key","address","btc_address","chl"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"order_id":{"type":"string"},"psbt":{"type":"string"},"check_sign_only":{"type":"boolean"}},"required":["order_id","psbt","check_sign_only"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}},"headers":{}}}}}}}
```

## Important Notes

{% hint style="info" %}

1. After obtaining the unsigned PSBT, the user must sign it within 30 seconds.
2. Use the same address for both `btc_address` and `address`.
3. For `user_public_key`, provide the parameter as `public_key:public_key` for a wallet with one address, or `btc_public_key:ordi_public_key` for a wallet with two addresses.
4. Unlike BRC20, no pre-request is needed.
5. When swapping BTC for ARC20, the amount of ARC20 to be received plus the ARC20 already in the user's wallet must not be less than 546.
6. When swapping ARC20 for BTC, the remaining amount of the ARC20 token in the user's wallet after the swap must not be less than 546.
   {% endhint %}

## POST /brc20swap/send\_swap\_psbt

> Send the signed PSBT for exchange

```json
{"openapi":"3.0.1","info":{"title":"Backend API","version":"1.0.0"},"servers":[{"url":"https://api-testnet4.dotswap.app","description":"Swap test"},{"url":"https://api.dotswap.app","description":"Swap official"}],"security":[],"paths":{"/brc20swap/send_swap_psbt":{"post":{"summary":"Send the signed PSBT for exchange","deprecated":false,"description":"","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"order_id":{"type":"string","title":"Order ID"},"psbt":{"type":"string","title":"Signed PSBT"}},"required":["order_id","psbt"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"tx_id":{"type":"string","title":"The txid of the rawtx in PSBT"},"order_id":{"type":"string","title":"The corresponding order ID"},"need_show_task":{"type":"boolean"}},"required":["tx_id"]}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

Finally, send the signed PSBT. If the response indicates success, the swap is successful.
