# returnApproveRequest - admin-graphql - MUTATION Version: 2024-10 ## Description Approves a customer's return request. If this mutation is successful, then the `Return.status` field of the approved return is set to `OPEN`. ### Access Scopes `write_returns` access scope or `write_marketplace_returns` access scope. Also: The user must have `return_orders` permission. ## Arguments * [input](/docs/api/admin-graphql/2024-10/input-objects/ReturnApproveRequestInput): ReturnApproveRequestInput! - The input fields to approve a return. ## Returns * [return](/docs/api/admin-graphql/2024-10/objects/Return): Return The approved return. * [userErrors](/docs/api/admin-graphql/2024-10/objects/ReturnUserError): ReturnUserError! The list of errors that occurred from executing the mutation. ## Examples ### Approve a return Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id name status returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}" #### Graphql Input { "input": { "id": "gid://shopify/Return/945000959" } } #### Graphql Response { "data": { "returnApproveRequest": { "return": { "id": "gid://shopify/Return/945000959", "name": "#1001-R1", "status": "OPEN", "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614676" } } ] }, "order": { "id": "gid://shopify/Order/311154583" } }, "userErrors": [] } } } ### Cannot approve a return with an invalid status Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id status } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n}" #### Graphql Input { "input": { "id": "gid://shopify/Return/945000958" } } #### Graphql Response { "data": { "returnApproveRequest": { "return": null, "userErrors": [ { "code": "INVALID_STATE", "field": [ "input", "id" ], "message": "Return is not approvable. Only returns with status REQUESTED can be approved." } ] } } }