---
title: "Create a swap"
method: POST
path: "/api/swap"
tags: ["Swap"]
---

# Create a swap

`POST /api/swap`

Initiates a swap between USDC and EURC using the merchant's custodial wallet balance. Exactly one of `amount` (in cents) or `max: true` must be provided. The response is returned as soon as the swap is accepted; settlement is asynchronous — poll `GET /api/swap/{id}` or `GET /api/swap/in-progress` to follow progress. A merchant can only have one in-progress swap at a time.

## Request body

- CreateSwapDto
  - `fromCurrency` 'USDC' | 'EURC', required
  - `toCurrency` 'USDC' | 'EURC', required
  - `amount` number — Amount in cents (smallest unit)
  - `max` boolean — Use full available source balance (server-resolved amount)

## Response `201`

Swap accepted and pipeline initiated

- ApiSwapDto
  - `id` string, required
  - `userId` string, required
  - `fromCurrency` 'USDC' | 'EURC', required
  - `toCurrency` 'USDC' | 'EURC', required
  - `amount` number, required — Source amount in cents (smallest unit of fromCurrency)
  - `status` 'INITIATED' | 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'CANCELED' | 'RETURNED' | 'REFUNDED', required — Merchant-facing status. Internal states (`DEPOSIT_COMPLETED`, `AWAITING_LIQUIDATION`) are collapsed to `PENDING` before being returned, so they will never appear on the wire.
  - `context` 'bridge' | 'privy', nullable — Pipeline a swap follows: `bridge` (3 steps) or `privy` (2 steps).
  - `toAmountInCents` number, nullable — Final destination amount in cents (smallest unit of toCurrency). `null` until the swap settles.
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required

## Other responses

- `400` — Invalid request (e.g. same fromCurrency/toCurrency, insufficient balance, or another swap is already in progress)
- `401` — Unauthorized - Invalid API key

---

[API](https://skmtc.dev/inflowpay/apis/inflow-api.md) · [All operations](https://skmtc.dev/inflowpay/apis/inflow-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/inflowpay/inflow-api/revisions/3012dd3dd14a/schema)
