description: "Learn how to manage returns using the admin REST APIs. This guide includes how to manage return reasons, view returns, mark a return as received, and cancel a return."
addHowToData: true
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# How to Manage Returns
In this document, you’ll learn how to manage returns using the admin REST APIs.
## Overview
Using the returns, orders, and return reasons admin REST APIs, you can manage returns and perform other related functionalities.
### Scenario
You want to add or use the following admin functionalities:
- Manage Return Reasons. This includes listing return reasons, creating, updating, and deleting them.
- View an Order’s, Swap’s, and Claim’s Returns
- Mark a Return Received
- Cancel a Return
---
## Prerequisites
### Medusa Components
It is assumed that you already have a Medusa backend installed and set up. If not, you can follow our [quickstart guide](../../../development/backend/install.mdx) to get started.
### JS Client
This guide includes code snippets to send requests to your Medusa backend using Medusa’s JS Client, among other methods.
If you follow the JS Client code blocks, it’s assumed you already have [Medusa’s JS Client](../../../js-client/overview.md) installed and have [created an instance of the client](../../../js-client/overview.md#configuration).
### Medusa React
This guide also includes code snippets to send requests to your Medusa backend using Medusa React, among other methods.
If you follow the Medusa React code blocks, it's assumed you already have [Medusa React installed](../../../medusa-react/overview.md) and have [used MedusaProvider higher in your component tree](../../../medusa-react/overview.md#usage).
### Authenticated Admin User
You must be an authenticated admin user before following along with the steps in the tutorial.
You can learn more about [authenticating as an admin user in the API reference](/api/admin/#section/Authentication).
---
## Manage Return Reasons
Return reasons allow you to specify why an item is returned. They are especially useful for claims, but you can also use them to ask customers to specify the reason they’re requesting to return an item.
### List Return Reasons
You can list available return reasons using the [List Return Reasons endpoint](/api/admin#tag/Return-Reasons/operation/GetReturnReasons):
curl -L -X POST '<BACKEND_URL>/admin/return-reasons' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged",
"value": "damaged"
}'
```
</TabItem>
</Tabs>
This endpoint requires the following request body parameters:
- `label`: a string that will be used as the label of the return reason. This is typically the label shown to the customer or the merchant.
- `value`: a string that is unique among return reasons. It is typically used internally for identification
You can also pass other optional request body parameters, such as a `description` parameter or a `parent_return_reason_id` if this return reason is a child of another. You can learn more about available optional request body parameters in the [API reference](/api/admin#tag/Return-Reasons/operation/PostReturnReasons).
This request returns the created return reason as an object.
### Update a Return Reason
You can update a return reason by sending a request to the [Update Return Reason endpoint](/api/admin#tag/Return-Reasons/operation/PostReturnReasonsReason):
curl -L -X POST '<BACKEND_URL>/admin/return-reasons/<REASON_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged"
}'
```
</TabItem>
</Tabs>
This endpoint requires the return reason ID to be passed as a path parameter.
In the request body, you can pass any of the return reason’s fields that you want to update as parameters. In the example above, the label is passed in the request body to be updated.
The request returns the updated return reason as an object.
### Delete a Return Reason
You can delete a return reason by sending a request to the [Delete Return Reason endpoint](/api/admin#tag/Return-Reasons/operation/DeleteReturnReason):
This endpoint requires the return reason ID as a path parameter.
The request returns the following fields:
- `id`: The ID of the deleted return reason.
- `object`: The type of object that was deleted. In this case, the value will be`return_reason`.
- `deleted`: A boolean value indicating whether the return reason was deleted.
---
## View an Order’s Returns
:::note
You can view all returns in your commerce system, regardless of which order they belong to, using the [List Returns endpoint](/api/admin#tag/Returns/operation/GetReturns).
:::
When you retrieve an order using the [Get Order endpoint](/api/admin#tag/Orders/operation/GetOrdersOrder), you can access the returns within the order object:
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
```
</TabItem>
</Tabs>
This endpoint requires the order ID as a path parameter.
The request returns the order as an object. In that object, you can access an array of return objects using the property `returns` of the order object.
---
## View a Swap’s Return
You can retrieve a swap either using the Get Order endpoint as explained here, or using the [List Swaps](/api/admin#tag/Swaps/operation/GetSwaps) or [Get Swap endpoint](/api/admin#tag/Swaps/operation/GetSwapsSwap).
In a swap object, the swap’s return is available under the `return_order` property.
---
## View a Claim’s Return
You can retrieve a claim using the Get Order endpoint and accessing the `claims` property of the order object, which is an array of claim objects. In a claim object, the claim’s return is available under the `return_order` property.
---
## Mark a Return as Received
You can mark a return as received by sending a request to the [Receive a Return endpoint](/api/admin#tag/Returns/operation/PostReturnsReturnReceive):
curl -L -X POST '<BACKEND_URL>/admin/returns/<RETURN_ID>/receive' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"items": [
{
"item_id": "<ITEM_ID>",
"quantity": 1
}
]
}'
```
</TabItem>
</Tabs>
This endpoint requires the ID of the return as a path parameter.
In the request body, the `items` parameter is required. It’s an array of objects having the following properties:
- `item_id`: a string indicating the ID of the line item in the order that is received.
- `quantity`: a number indicating the quantity of the line item that was received.
By default, the refund amount specified in the return will be refunded. If you want to refund a custom amount, you can pass the optional request body parameter `refund`, with its value being a number indicating the amount to refund. The amount must be less than the order’s `refundable_amount`.
The request returns the updated return as an object.
---
## Cancel a Return
:::note
A received return can’t be canceled.
:::
You can cancel a return by sending a request to the [Cancel Return endpoint](/api/admin#tag/Returns/operation/PostReturnsReturnCancel):
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.