--- title: returnRequest - GraphQL Admin description: |- A customer's return request that hasn't been approved or declined. This mutation sets the value of the `Return.status` field to `REQUESTED`. To create a return that has the `Return.status` field set to `OPEN`, use the `returnCreate` mutation. api_version: 2025-10 api_name: admin type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/returnrequest md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/returnrequest.md --- # return​Request mutation Requires `write_returns` access scope or `write_marketplace_returns` access scope. A customer's return request that hasn't been approved or declined. This mutation sets the value of the `Return.status` field to `REQUESTED`. To create a return that has the `Return.status` field set to `OPEN`, use the `returnCreate` mutation. ## Arguments * input [Return​Request​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/ReturnRequestInput) required The input fields for requesting a return. *** ## Return​Request​Payload returns * return [Return](https://shopify.dev/docs/api/admin-graphql/latest/objects/Return) The requested return. * user​Errors [\[Return​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/ReturnUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Request a return #### Description Request a return for the order. #### Query ```graphql mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } } ``` #### Variables ```json { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }", "variables": { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }`, { variables: { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } } QUERY variables = { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }`, "variables": { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } }, }, }); ``` #### Response ```json { "returnRequest": { "userErrors": [], "return": { "id": "gid://shopify/Return/945000961", "status": "REQUESTED", "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614678", "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } } ] }, "order": { "id": "gid://shopify/Order/625362839" } } } } ``` * ### returnRequest reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20ReturnRequest\(%24input%3A%20ReturnRequestInput!\)%20%7B%0A%20%20returnRequest\(input%3A%20%24input\)%20%7B%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%20%20return%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20status%0A%20%20%20%20%20%20returnLineItems\(first%3A%201\)%20%7B%0A%20%20%20%20%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20%20%20%20%20returnReason%0A%20%20%20%20%20%20%20%20%20%20%20%20customerNote%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20order%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%7B%0A%20%20%20%20%22orderId%22%3A%20%22gid%3A%2F%2Fshopify%2FOrder%2F625362839%22%2C%0A%20%20%20%20%22returnLineItems%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22fulfillmentLineItemId%22%3A%20%22gid%3A%2F%2Fshopify%2FFulfillmentLineItem%2F820022594%22%2C%0A%20%20%20%20%20%20%20%20%22quantity%22%3A%201%2C%0A%20%20%20%20%20%20%20%20%22returnReason%22%3A%20%22WRONG_ITEM%22%2C%0A%20%20%20%20%20%20%20%20%22customerNote%22%3A%20%22Sorry%2C%20I%20ordered%20the%20wrong%20item.%20Could%20I%20get%20a%20refund%20or%20store%20credit%3F%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }`, { variables: { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } }, }, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }", "variables": { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }`, { variables: { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } }`, "variables": { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } }, }, }); ``` ##### Ruby ``` session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation ReturnRequest($input: ReturnRequestInput!) { returnRequest(input: $input) { userErrors { field message } return { id status returnLineItems(first: 1) { edges { node { id returnReason customerNote } } } order { id } } } } QUERY variables = { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "input": { "orderId": "gid://shopify/Order/625362839", "returnLineItems": [ { "fulfillmentLineItemId": "gid://shopify/FulfillmentLineItem/820022594", "quantity": 1, "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } ] } } ``` ## Response JSON ```json { "returnRequest": { "userErrors": [], "return": { "id": "gid://shopify/Return/945000961", "status": "REQUESTED", "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614678", "returnReason": "WRONG_ITEM", "customerNote": "Sorry, I ordered the wrong item. Could I get a refund or store credit?" } } ] }, "order": { "id": "gid://shopify/Order/625362839" } } } } ```