---
title: "Cancel a payout order if is possible"
method: PATCH
path: "/payout_orders/{payout_order_id}/state/cancel"
tags: ["Payout orders Cancel"]
---

# Cancel a payout order if is possible

`PATCH /payout_orders/{payout_order_id}/state/cancel`

## Request

- Base URL: `https://api.treasury.shinkansen.finance/v1`
- URL: `https://api.treasury.shinkansen.finance/v1/payout_orders/{payout_order_id}/state/cancel`
- Auth: API key in header `Shinkansen-Treasury-Api-Key`

Cancels a payout order that is still `created`, `waiting_validation`, `waiting_approval` or `scheduled`. On success the payout order transitions to `cancelled` and the resulting state is returned.

Those four are the only states the transition is allowed from. An order that is already `approved`, `pending_funds`, `enqueued` or `executing` cannot be cancelled even though it has not finished, and neither can one in a terminal state. In every one of those cases the request fails with 422 and the payout order is left untouched.

## Response `200`

Returns when was possible to cancel the payout order identified by the given id.

- PayoutOrderCancel: Cancel Payout order
  - `shinkansen_payout_order_state` string: The state of the payout order. This will have the value "cancelled" as other values return error.

## Other responses

- `404`: Requested payout is not found.
- `422`: The payout order exists but its current state does not allow a transition to `cancelled`.

---

[API](https://skmtc.dev/shinkansen/apis/treasury-shinkansen-endpoints.md) - [All operations](https://skmtc.dev/shinkansen/apis/treasury-shinkansen-endpoints/llms.txt) - [OpenAPI document](https://skmtc.dev/shinkansen/apis/treasury-shinkansen-endpoints/revisions/2d3ec7684af3?raw)
