# Getting permission error while creating sale return through API

**URL:** <https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622>\
**Category:** GraphQL API\
**Created:** [October 6, 2021, 3:55pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622 "2021-10-06T15:55:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmitCharnalia](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@AmitCharnalia](https://community.shiphero.com/u/AmitCharnalia)\
**Post date:** [October 6, 2021, 3:55pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/1 "2021-10-06T15:55:52Z")

</div>

Hi Team,  
We are getting permission error while creating sale returns through API.  
Please see below error details any thought on this error.  
}  
[Post Response Data :] =\> Array  
(  
[errors] =\> Array  
(  
[0] =\> Array  
(  
[message] =\> Cannot access the requested order. Permission denied  
[operation] =\> return\_create  
[field] =\> return\_create  
[request\_id] =\> 61559454f0a31bf764abdd71  
[code] =\> 9  
)

```
            )

        [data] => Array
            (
                [return_create] => 
            )

    )

```

)

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [October 6, 2021, 10:28pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/2 "2021-10-06T22:28:40Z")

</div>

Hi @AmitCharnalia, welcome to the community!

Permission denied will be connected to the token that you are using. Please double-check your token.

---

<div class="post-metadata">

**Author:** ![AmitCharnalia](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@AmitCharnalia](https://community.shiphero.com/u/AmitCharnalia)\
**Post date:** [October 10, 2021, 9:42am UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/3 "2021-10-10T09:42:24Z")

</div>

Hi @Theresa  
Thanks for looking into this issue.  
Our API Key/ token works for other endpoints, it is not a token issue.

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [October 11, 2021, 5:58pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/4 "2021-10-11T17:58:23Z")

</div>

Hi @AmitCharnalia,  
I will be happy to take a closer look. Do you have a request ID that I can start my research with? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![AmitCharnalia](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@AmitCharnalia](https://community.shiphero.com/u/AmitCharnalia)\
**Post date:** [October 11, 2021, 6:46pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/5 "2021-10-11T18:46:52Z")

</div>

Hi @Theresa  
Please find below API request and response for reference.

[Post Request URL :] =\>  
[Post Request Data :] =\> mutation {  
return\_create(  
data: {  
order\_id: “146957”  
warehouse\_id: “V2FyZWhvdXNlOjczODc2”  
return\_reason: “Too small”,  
label\_type: FREE  
label\_cost: “0.00”  
display\_issue\_refund: true  
address: {  
name: “Demo Customer”  
address1: “1765 Delmar Drive”  
address2: “”  
city: “Laurel”  
state: “New York”  
zip: “11948”  
country: “US”  
phone: “6312524570”  
}  
dimensions: {  
height: “1”  
width: “1”  
length: “1”  
weight: “1”  
}  
shipping\_carrier: “UPS”  
shipping\_method: “Ground”  
line\_items:[]  
tracking\_number: “”  
create\_label: true  
partner\_id: “146179”  
}  
) {  
request\_id  
complexity  
return {  
id  
legacy\_id  
}  
}  
}  
[Post Response Data :] =\> Array  
(  
[errors] =\> Array  
(  
[0] =\> Array  
(  
[message] =\> Cannot access the requested order. Permission denied  
[operation] =\> return\_create  
[field] =\> return\_create  
[request\_id] =\> 61559454f0a31bf764abdd71  
[code] =\> 9  
)

```
            )

        [data] => Array
            (
                [return_create] => 
            )

    )

```

)

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [October 12, 2021, 6:38pm UTC](https://community.shiphero.com/t/getting-permission-error-while-creating-sale-return-through-api/1622/6 "2021-10-12T18:38:09Z")

</div>

Thank you for the request-id

The account\_id that is in the mutation, does not have an existing order with the order\_id that is in the query. The order id is the last set of numbers in the order URL.
