Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: fulfillment orders returning {"errors":"The api_client does not have the required

fulfillment orders returning {"errors":"The api_client does not have the required permission(s)."}

browntaped
Tourist
7 0 4

When trying to use the fulfillment orders API, we are getting the following error message.

{"errors":"The api_client does not have the required permission(s)."}

browntaped_0-1595821316303.png

What permissions are needed for this?

Replies 31 (31)

Kevin_A
Shopify Staff
318 42 61

Hey @browntaped 

Check out our scopes documentation here. You will likely need one of "read_assigned_fulfillment_orders", "read_merchant_managed_fulfillment_orders", or "read_third_party_fulfillment_orders".

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Paul_McWhinnie
Shopify Partner
18 0 1

Hi, I am running into the same issue (after setting up permissions). 

I am using a private app.

Thanks,

Verona4869
Visitor
1 0 0

May I ask, if you figured it out?
I have the same problem. All permissions are set, but I keep getting the message that my api_client doesn't have the authorization to access fullfillment orders.

Paul_McWhinnie
Shopify Partner
18 0 1

No luck. I have all permissions set and I am still getting {"errors":"The api_client does not have the required permission(s)."}

Does anyone know how to make this work. I really need to get location info for unfulfilled orders. 

TIA.

Kevin_A
Shopify Staff
318 42 61

Hey @Paul_McWhinnie 

Can you post your request ID header? 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Paul_McWhinnie
Shopify Partner
18 0 1

Hey back! 🙂

I have been testing from chrome (after logging in to my site)

https://smart-ho-omni-channel-qa.myshopify.com/admin/api/2020-10/orders/2915562619038/fulfillment_or...

All associated/relevant private app credentials are set to read.

Kevin_A
Shopify Staff
318 42 61

Hey @Paul_McWhinnie 

Try making the call from an API client using a private app secret that has permission for fulfillment orders. You might also be able to try from in chrome using the https://<key>:<secret>@store.myshopify.com/admin/api/2010-10/..... format. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Paul_McWhinnie
Shopify Partner
18 0 1

Hi Kevin_A,

Already tried that.. same result.

Can you talk to the developers and see if this is a bug in Shopify?


Thanks,

Kevin_A
Shopify Staff
318 42 61

Hey @Paul_McWhinnie 

When using an API client, you should be able to see the response headers. If you could pass me the request id response header, I can take a look in our logs for you. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

API_Dev
Tourist
4 0 1

Was this ever resolved?

Gabe8
Shopify Partner
10 0 0

This is ridiculous! I am getting the same issue in multiple accounts, and whenever I contact Shopify Partner Support, all they do is direct me to these forums, where these issues remain unresolved.

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

Can you provide me with an x-request-id from the response headers so I can take a look?

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Gabe8
Shopify Partner
10 0 0

Hi Kevin,

68cb1475-8b7e-4ff3-8635-aa276fee36cb

BTW, I tried it with all permissions set to at least Read.

 

Thank you!

Gabe

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

Looks like the request is originating from your browser and is inheriting permissions from what appears to be an authenticated staff account (normally we should see the request attached to an api key, but in this case it looks like there is a browser user agent). If you run this in a dedicated API client (I recommend against using one of the web based ones) you should be able to pull the fulfillment order details. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Gabe8
Shopify Partner
10 0 0

Ok, that is indeed the cause of this particular message! You can't imagine how grateful I am for finally making some progress on this!

I actually tried it in a different browser instance, one where I am not logged in anywhere, and it worked.

 

Now, trying to access fulfillment orders in our client's LIVE website. Would you be able to tell me what the reason is for getting an empty list back for the same request? Example request IDs :1f479634-bd03-40a1-8653-0cfe81c145a5,  225109f6-a6a2-4994-ac52-d99616995ee9.

Are there other permissions that we need than what we already have?

{
"access_scopes": [
{
"handle": "write_orders"
},
{
"handle": "write_products"
},
{
"handle": "write_inventory"
},
{
"handle": "write_fulfillments"
},
{
"handle": "read_assigned_fulfillment_orders"
},
{
"handle": "read_orders"
},
{
"handle": "read_products"
},
{
"handle": "read_inventory"
},
{
"handle": "read_fulfillments"
}
]
}

Thank you!

Gabe

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

I don't think this is a permissions issue. Is it only for these 2 orders that you are seeing this or are you able to reproduce this for other orders as well? 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Gabe8
Shopify Partner
10 0 0

It never worked. I tried it with at least 5 or 6 orders today, 2 of them definitely in financial_status:paid, fulfillment_status:null, and canceled_at:null.

Throughout the last couple of months, I tried it with many more. Of course, back then from the wrong browser session (where I was logged into the our dev account).

Should it work on orders that have been fulfilled already, or which have been refunded?

Right now, they only have one refunded order, when querying orders.json, without "status=any". Just tried it on that one, and here's the request ID: 17b6954e-5242-4f31-af05-3dc7b0357d37

Here's the request id for a random recent fulfilled order: 17cbd53b-988a-4dec-a08a-6a492cc7405c

Thanks,

Gabe

 

Gabe8
Shopify Partner
10 0 0

Hi @Kevin_A ,

 

So right now the account where we need access to fulfillment_orders is the one where I made the following requests that I already sent you yesterday:

1f479634-bd03-40a1-8653-0cfe81c145a5

225109f6-a6a2-4994-ac52-d99616995ee9

 

I also made other requests to other accounts where:

- we have the read_fulfillments and read_assigned_fulfillment_orders permissions  - not sure which one we really need

- there are multiple active locations - is this one of the necessary criteria?

- there is an order that fits this criteria: ?status=open&financial_status=paid&fulfillment_status=unfulfilled

 

I got no data for fulfillment_orders.json - empty array in the response

Are the above the necessary criteria? What else should I check for?

 

These are the request IDs in case it helps looking at other examples:

b261d868-cf63-446b-aa8e-aef680add206

1192bf9f-3eb6-4796-b44b-265d61959a62

6ef342cd-00a9-49fd-8288-47b5f5054adc

c47a52d3-242d-41bb-81b0-e5f9071e3467

41de4d99-6a85-4ae8-9729-52bb7a73d21e

2c02e4e7-dcbb-41d7-9047-dc11baa7a8e4

 

Thank you,

Gabe

 

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

I know that there are certain situations where fulfillment orders won't be created (such as if all items are managed by a fulfillment service) but I will need to look into this further to confirm everything is working as expected here. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Gabe8
Shopify Partner
10 0 0

Hi @Kevin_A ,

Were you able to find out anything?

 

Thank you,

Gabe

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

Sorry about the delay. It looks like the issue here is a permissions one. Take a look at: https://shopify.dev/api/admin/access-scopes

It looks like your app requests "read_assigned_fulfillment_orders" but this would only show fulfillment orders assigned by a fulfillment service associated with your app. In this case, it looks like the fulfillment orders are generated for merchant managed locations by Shopify, so I believe you need the scope "read_merchant_managed_fulfillment_orders". 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Gabe8
Shopify Partner
10 0 0

Hi @Kevin_A ,

Great! I will give that a try.

Thank you,

Gabe

Gabe8
Shopify Partner
10 0 0

Hi @Kevin_A ,

That was it! Can't thank you enough!

But to be honest, I don't really understand this concept of "merchant-managed locations" vs other kinds of locations (fulfillment service managed?), even though I have read through lots of documentation pages about locations. Is there anything you can suggest which clarifies this for me?

Thank you,

Gabe

Kevin_A
Shopify Staff
318 42 61

Hey @Gabe8 

Basically it comes down to where the fulfillment order originated from. The merchant managed scope is for any product not managed by a fulfillment service where Shopify assigns the fulfillment order based on the locations the merchant has setup. The merchant sets location priority for fulfillment, and controls the inventory levels for the products and then we do some magic to determine which location a fulfillment order should be assigned to. The other two fulfillment order scopes are for fulfillment orders made through a fulfillment service (either third party, or one that is associated with your app). 

If you want to learn more about how apps can handle fulfillments I would take a look at these guides: 

https://shopify.dev/apps/fulfillment/fulfillment-service-apps
https://shopify.dev/apps/fulfillment/order-management-apps

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

sumjoekin
Shopify Partner
8 0 1

so I believe you need the scope "read_merchant_managed_fulfillment_orders". 

How is this added?

JackNguyen
Visitor
1 0 0

Please help to check  x-request-id: fee24792-2d96-4b6a-bb75-76b6a26ea199-1718342873
https://esafetysupplies.com.au/admin/api/2010-10/fulfillments.json

{
"location_id":69607489704,
"notify_customer":false,
"line_items_by_fulfillment_order":[
{
"fulfillment_order_id": 6705934434472,
"fulfillment_order_line_items":[
{
"id":13540480450728,
"quantity":1
}
]
}
],
"tracking_info":{
"company":"Starshipit",
"number":"2492282274375"
}
}

 

talalbsse
Shopify Partner
10 0 6

Hi @Paul_McWhinnie ,

Were you ever able to solve this?

I am still trying to figure it out

talalbsse
Shopify Partner
10 0 6

Hi Kevin,

 

I am also having the same problem. This is my x-request-id response:

e6568e7b-6148-4c8c-b62f-d727f81419c7

 

Can you please help me out?

talalbsse
Shopify Partner
10 0 6

Hi @browntaped ,

 

I am also getting the same error:

talalbsse_0-1667422340235.png

We tried alot, searched a lot but no success..

 

 

ChannelCat
Shopify Partner
1 0 0

I had all the suggested permissions and was still getting the error.  I ended up scraping the permissions page and added a bunch until it worked.  One of these did the trick:


read_all_orders
read_inventory
write_inventory
read_locations
write_merchant_managed_fulfillment_orders

CStefano
Excursionist
14 3 0

Hi, I have the same problem, I have try to put all permission, all flag are acrite but when I try to read from url the fulfillment I receive the permission error 

 

{"errors":"The api_client does not have the required permission(s)."}  

 I don't think that is a permission problem... I have full permission... why?