---
title: "Mark a sale as refunded"
method: PATCH
path: "/sales"
---

# Mark a sale as refunded

`PATCH /sales`

Marks a sale as refunded and reverses the commission attached to it.

If the sale was already refunded the request still succeeds, with `alreadyRefunded` set to `true`. A sale cannot be refunded once it has passed your program's refund window, has been added to a payout batch, has already been paid out, or has been marked as manually paid — each of those returns a 400 with a `reason` you can branch on.

## Request body

- SaleRefund
  - `saleId` integer, required — The sale ID to mark as refunded

## Response `200`

The refund was processed, or the sale was already refunded.

- SaleRefundResponse
  - `success` boolean — Whether the refund request was handled successfully
  - `alreadyRefunded` boolean — Whether the sale had already been marked as refunded before this request
  - `reason` string — Why the request resolved the way it did — for example `refunded` or `already_refunded`.

## Other responses

- `400` — The sale is not eligible to be refunded. `reason` is one of `outside_refund_window`, `included_in_payout_batch`, `already_paid` or `manually_paid`.
- `401` — The `Authorization` header is missing, is not a `Bearer` header, or the token is not valid.
- `403` — API access is not enabled for this account.
- `404` — No sale with that ID exists in this program.
- `429` — Too many requests for this token on this endpoint. Please slow down.

---

[API](https://skmtc.net/referly/apis/referly-api.md) · [All operations](https://skmtc.net/referly/apis/referly-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/referly/referly-api/versions/0f506d61b9c3/schema)
