> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerswap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# onSwapCreate

> Triggered when a new swap is created.

`onSwapCreate` fires after the user submits the form and the API creates the swap.

```tsx theme={null}
<LayerswapWidget
  config={widgetConfig}
  callbacks={{
    onSwapCreate: (response) => {
      console.log("Swap created:", response as SwapResponse)
    },
  }}
/>
```

## Callback payload

<Snippet file="snippets/swap-response-types.mdx" />
