---
title: "The swap operation."
method: POST
path: "/v1/brc20-swap/swap"
tags: ["BRC20-Swap"]
---

# The swap operation.

`POST /v1/brc20-swap/swap`

## Request

- Base URL: `https://open-api.unisat.io`
- URL: `https://open-api.unisat.io/v1/brc20-swap/swap`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/unisat/apis/unisat-wallet-openapi/docs/v1/brc20-swap/swap/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- object
  - `address` string, required
  - `tickIn` string, required: Input tick
  - `tickOut` string, required: Output tick
  - `amountIn` string, required: The amount of input tick
  - `amountOut` string, required: The amount of output tick
  - `slippage` string, required
  - `exactType` 'exactIn' | 'exactOut', required
  - `ts` number, required: Timestamp (seconds)
  - `sig` string, required: User signature

## Response `200`

Default Response

- object
  - `code` number, required
  - `msg` string, required
  - `data` object, required
    - `id` string: Function id
    - `rollupInscriptionId` string: The rollup inscription id where the function is located
    - `address` string
    - `tickIn` string
    - `tickOut` string
    - `amountIn` string
    - `amountOut` string
    - `exactType` string
    - `ts` number

---

[API](https://skmtc.dev/unisat/apis/unisat-wallet-openapi.md) - [All operations](https://skmtc.dev/unisat/apis/unisat-wallet-openapi/llms.txt) - [OpenAPI document](https://skmtc.dev/unisat/apis/unisat-wallet-openapi/revisions/68de350419c7?raw)
