# What is a Swap?

SafeSwap uses the "atomic swap" technique to guarantee that a swap occurs in a trustless manner. The idea is explained fully [here](https://www.investopedia.com/terms/a/atomic-swaps.asp).

## &#x20;Steps in a Swap

1. **Initiate a Swap:** User sends funds to the swap contract with a hashed preimage in the ecosystem where they currently hold their assets.
2. **Send Fees:** Pay the required fees on the original chain and the destination chain. These fees cover our portion of the smart contract interactions.
3. **Creating the Swap in our API:** Send an API request to our server to let us know about the smart contract interaction and the details of the swap that the user is trying to do. This includes information about what chain the swap should be sent to, the token, and more.
4. **Wait for us to set up the Swap:** Poll our API occasionally (usually takes about 30 seconds) to find the status of the swap on the target chain.
5. **Complete the Swap on target chain:** User claims new funds on the destination chain using their preimage. Then our system claims the original funds on the original chain and the swap is complete.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.safeswap.io/builders/api-integration-guide/what-is-a-swap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
