---
title: "Refund a failed deposit by id"
method: POST
path: "/deposits/{id}/refund"
tags: ["Processing"]
---

# Refund a failed deposit by id

`POST /deposits/{id}/refund`

Transfer the funds from a failed deposit back to a caller-provided address on the same chain, addressing the deposit by the stable id returned by `GET /deposits`. Authenticate with an `x-api-key` (write scope) or a Bearer platform token. Scoped to the caller's tenant: an unknown id and another tenant's id are both a 404. The deposit must be `failed` or `rejected`; operator-only states (`ignored`, `delayed`) are refundable through the admin endpoint only.

## Path parameters

- `id` string, required — Deposit id. Returned by GET /deposits.

## Headers

- `x-api-key` string — API key for authentication (omit when sending Authorization)
- `authorization` string — Bearer platform token (e.g. forwarded by user-service). Takes precedence over `x-api-key` when both are present.

## Request body

- RefundDepositByIdRequestBody
  - `recipient` string, required — Address to receive the refunded tokens (EVM address or Solana public key).

## Response `200`

Deposit refunded successfully

- RefundDepositResponse
  - `message` string, required
  - `transactionHash` string, required
  - `amount` string, required

## Other responses

- `400` — Invalid deposit id or recipient, or deposit not eligible for refund
- `401` — Authentication required or invalid
- `403` — Unauthorized - credential does not belong to the client that registered the account, or API key lacks write scope
- `404` — Deposit not found or not owned by the caller
- `500` — Refund transfer failed

---

[API](https://skmtc.net/rhinestonewtf/apis/deposit-service-api.md) · [All operations](https://skmtc.net/rhinestonewtf/apis/deposit-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/rhinestonewtf/deposit-service-api/revisions/c9aa3f252e4f/schema)
