---
title: "Set your receive (payout) / refund address for a leg"
method: POST
path: "/v1/swaps/{id}/address"
---

# Set your receive (payout) / refund address for a leg

`POST /v1/swaps/{id}/address`

## Request

- Base URL: `https://api.hashlock.markets`
- URL: `https://api.hashlock.markets/v1/swaps/{id}/address`
- Auth: HTTP bearer

Set your receive (payout) / refund address for a leg. Bitcoin: the compressed pubkey (hex) — the P2WSH is derived once both sides are set. Required before funding. An address that RECEIVES money — the payout one, and on Bitcoin and Solana the refund one too — must be a wallet this account signed in with, one proven with the login wallet's authorisation (POST /v1/wallets/<chain> with `authorization`), or one proved from a signed-in wallet session on the web (for Bitcoin, the pubkey of such an address). A proof made with an API key alone widens what you can trade but does not count here, so a leaked key cannot redirect your money.

## Path parameters

- `id` string, required

## Request body

- object
  - `chain` string, required
  - `address` string, required
  - `leg` 'a' | 'b': required only when both legs of the swap are on `chain`

## Response `200`

ok

- object
  - `swap` Swap
    - `id` string
    - `status` string

## Other responses

- `400`: error
- `409`: a funding of this leg is on its way — its refund address is fixed until it is recorded or fails
- `504`: a chain or explorer read of ours ran out of time — nothing was changed; retry (an Idempotency-Key does not remember a 504)

---

[API](https://skmtc.dev/hashlock/apis/hashlock-markets-api.md) · [All operations](https://skmtc.dev/hashlock/apis/hashlock-markets-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hashlock/apis/hashlock-markets-api/revisions/b85bd3992c46?raw)
