[Help Needed] Shopify Admin API - 404 Not Found When Modifying theme.liquid

Hi everyone,

I’m trying to modify the theme.liquid file using the Shopify Admin API but keep encountering a 404 Not Found error.

API Request I’m Using:
Request:
PUT /admin/api/2025-04/themes/{{theme_id}}/assets.json

Headers:
* `X-Shopify-Access-Token: {{access_token}}`
* `Content-Type: application/json`
Payload
{
  "asset": {
    "key": "layout/theme.liquid",
    "value": "<html>...<body data-custom='new-value'>...</body>...</html>"
  }
}

also I tried to modify a section/snippet instead but same error.

What I've Already Checked:
🔹 File Path is Correct: I confirmed that layout/theme.liquid exists by fetching:
GET /admin/api/2025-04/themes/{{theme_id}}/assets.json?asset[key]=layout/theme.liquid

🔹 Theme ID is Correct: I verified the theme_id by listing all themes:
GET /admin/api/2025-04/themes.json
🔹 API Token Has Proper Scopes: read_themes and write_themes are present:

GET /admin/api/2025-04/access_scopes.json
🔹 Tried Multiple API Versions: 2024-10 ,2024-07, 2024-04 ,2025-04, 2025-01, unstable, but all return 404 Not Found.


![Screenshot 2025-03-10 115946|671x500](upload://bOQCzr0W5yaz3HaINB1jqshjKDV.png)
![Screenshot 2025-03-10 120126|668x500](upload://5MRVjsmh2dNAn0JmQAIZtgB3QrN.png)
![Screenshot 2025-03-10 120151|664x500](upload://w1RgIg6t6gBmE82cgPk1DyV7jTa.png)
![Screenshot 2025-03-10 120203|690x431](upload://hAWWIwzjKTyVRLfpadlKu13edjV.png)


Would love to hear from anyone who has successfully updated theme.liquid recently. Any insights or workarounds would be much appreciated as I need a solution ASAP.

Thanks in advance! 😊🚀

Hi Huda,

Can you try the same API call but with the GraphQL API instead of REST?, eg by using the themeFilesUpsert mutation? You can use the GraphiQL app to test this out.

Hi Liam,

Thank you for your response!

We tried using the GraphQL API with the themeFilesUpsert mutation as you suggested, but we received the following error:
{
“message”: “Access denied for themeFilesUpsert field. Required access: The user needs write_themes and an exemption from Shopify to modify theme files.”
}

We have already confirmed that our app has the required write_themes scope, as shown in our access_scopes API response:
“access_scopes”: [
{
“handle”: “read_themes”
},
{
“handle”: “write_themes”
}
]
Is it possible that our app is not eligible for an exemption for this API From Shopify? ,I also request an exemption to modify theme files but need to make sure ,so please if there any clarification for this Err message

Looking forward to your guidance. Thanks again!

Hi,

It does sound like a scope issue on a restricted API. When did you make this request?

Hi,
We started sending it a week ago and are still facing the same issue.

Sorry - I meant when did you make an exception request with this form Online Store Protected Scope Exemption Request

We did request [Online Store Protected Scope Exemption Request] On Monday 10/03/2025 .

Thanks Huda - you may need to wait for this to be approved.