> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "returnOrder"
description: "Request a return for an order that has been delivered."
---

<Note>
  Due to Rye requiring Amazon Business accounts be connected to Rye via Amazon's app marketplace, this mutation has been deprecated.
  Returns can be handled via your Amazon Business account. See our [Connecting your Amazon Business account](/amazon-business/overview) on how to connect your Amazon Business account to Rye
</Note>

***

### Arguments

<ParamField path="input" type={<a href="/api-reference/returnorderinput">ReturnOrderInput!</a>} required>
  The `input` object contains the orderId and line items. See the [ReturnOrderInput](/api-reference/returnorderinput) object for more details.
</ParamField>

### Returns

<ParamField path="ReturnOrderResponse.*" type={<a href="/api-reference/returnorderresponse">ReturnOrderResponse!</a>}>
  Any requested field from the [`ReturnOrderResponse`](/api-reference/returnorderresponse) object.
</ParamField>

### Example - request

```json Query arguments
{
    "input": {
        "orderId": "3f25547a-9cfc-4b36-b882-3666b693c441",
        "lineItems":[
            {"id":"B0BFX4SC26", "quantity":1},
            {"id":"B0C68W65D3", "quantity":1},
            {"id":"B01AXM4WV2", "quantity":1}
        ]
    }
}
```

```GraphQL GraphQL
mutation ($input: ReturnOrderInput!) {
    returnOrder(input:$input){
        result {
        ...on ReturnAmazonOrderResult { orders { returnId amazonOrderId lineItems {status, productId, quantity} } }
        ...on ReturnShopifyOrderResult { status }
        }
        error {
            message
            code
        }
    }
}
```

Calling the endpoint initiates a return request. Response below is an example response for an amazon order

### Example - response

```json Response
{
    "data": {
        "returnOrder": {
            "result": {
                "orders": [
                    {
                        "returnId": "bd93158b-3abb-411a-bc62-b1fbd786cb61",
                        "amazonOrderId": "113-3749157-9026634",
                        "lineItems": [
                            {
                                "status": "RETURN_REQUESTED",
                                "productId": "B0BFX4SC26",
                                "quantity": 1
                            },
                            {
                                "status": "RETURN_REQUESTED",
                                "productId": "B0C68W65D3",
                                "quantity": 1
                            }
                        ]
                    },
                    {
                        "returnId": "e64e4fb9-57ed-4618-89db-3a1e48911cf2",
                        "amazonOrderId": "113-0355953-0101026",
                        "lineItems": [
                            {
                                "status": "RETURN_REQUESTED",
                                "productId": "B01AXM4WV2",
                                "quantity": 1
                            }
                        ]
                    }
                ]
            },
            "error": null
        }
    }
}
```

***

### Errors

The error field will display errors not related to actual status of a return request.

```json Response
{
    "data": {
        "returnOrder": {
            "result": null,
            "error": {
                "message": "Request with product B01AXM4WV2 is already in progress",
                "code": "RETURN_IN_PROGRESS"
            }
        }
    }
}
```


---

*Powered by [holocron.so](https://holocron.so)*
