Shopify Theme Dev 401 API Request Unauthorized Error

Topic summary

Main issue: Running the Shopify CLI command “shopify theme dev” returns a 401 Unauthorized API error, even after a successful login. Logging out/in does not resolve it.

Scope: Multiple users report the same problem.

Proposed fix: Explicitly set the target store when launching the dev server. Find the store name from the shop’s URL, then run: shopify theme dev --store {store_name}. A related community post about “invalid target” supports this approach.

Outcome: The user who shared the fix confirms it resolved their issue. No alternative solutions were discussed.

Status: Effectively resolved for affected users by specifying the --store flag; thread otherwise quiet on remaining edge cases.

Summarized with AI on December 22. AI used: gpt-5.

When I run the **shopify theme dev** command, I get a 401 API request unauthorized error.

The login was successful and I tried logging out and logging back in a couple times, but still the same issue.

Anybody know how to fix this issue?

3 Likes

found the same proplem

2 Likes

same problem, we need help !

https://community.shopify.com/post/1822476

I found this, and fix my problem.
The first, you need to get your store name, you can find it in the URL.

then, run the **shopify theme dev --store {store_name}** ,done.

good luck

1 Like