---
title: "Example swap handler"
method: POST
path: "/swap"
tags: ["crate::server"]
---

# Example swap handler

`POST /swap`

This is an example swap handler that showcase how to execute a swap from the MM side

## Headers

- `X-API-KEY` string, nullable

## Request body

- SwapRequest — Order to be fulfilled by the Market Maker
  - `quoteId` string, required
  - `requestId` string, required
  - `transaction` string, required — Base64 encoded versioned transaction

## Response `200`

- SwapResponse — Response to a swap request to the Market Maker
  - `quoteId` string, required
  - `rejectionReason` string, nullable — Optional message to provide more context when the swap is rejected
  - `state` 'accepted' | 'rejected', required
  - `txSignature` string, nullable

## Other responses

- `400`
- `401`
- `500`
- `503`

## Changes

> 6 revisions in range; 1 could not be searched.

- **2025-01-06** `4bc3ef0077ec` — 1 info
  - response property `txSignature` deprecated
- **2024-12-12** `43126258a27c` — 1 info
  - response property `txSignature` reactivated

[Change history](https://skmtc.dev/jup-ag/apis/server-example/changes/swap/post.md)

---

[API](https://skmtc.dev/jup-ag/apis/server-example.md) · [All operations](https://skmtc.dev/jup-ag/apis/server-example/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jup-ag/server-example/revisions/a3335bf73304/schema)
