# Shopify Theme Dev 401 API Request Unauthorized Error

**URL:** <https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448>\
**Category:** Shopify Discussion\
**Tags:** troubleshooting\
**Created:** [March 7, 2024, 9:51pm UTC](https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448 "2024-03-07T21:51:28Z")\
**Posts on this page:** 4\
**Page:** 1

## AI-generated 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.

<div class="post-metadata">

**Author:** ![sehyun-kelly](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sehyun-kelly](https://community.shopify.com/u/sehyun-kelly)\
**Post date:** [March 7, 2024, 9:51pm UTC](https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448/1 "2024-03-07T21:51:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ka3Hun9](https://avatars.discourse-cdn.com/v4/letter/k/91b2a8/32.png) [@Ka3Hun9](https://community.shopify.com/u/Ka3Hun9)\
**Post date:** [March 12, 2024, 6:17am UTC](https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448/2 "2024-03-12T06:17:47Z")

</div>

found the same proplem

---

<div class="post-metadata">

**Author:** ![wenren](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wenren](https://community.shopify.com/u/wenren)\
**Post date:** [August 10, 2024, 3:05pm UTC](https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448/3 "2024-08-10T15:05:04Z")

</div>

same problem, we need help !

---

<div class="post-metadata">

**Author:** ![wenren](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wenren](https://community.shopify.com/u/wenren)\
**Post date:** [August 10, 2024, 4:06pm UTC](https://community.shopify.com/t/shopify-theme-dev-401-api-request-unauthorized-error/303448/4 "2024-08-10T16:06:24Z")

</div>

[https://community.shopify.com/post/1822476](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
