Assets API returns 404 error when try to create a liquid file

Topic summary

A developer encounters a 404 error when attempting to create a liquid template file via Shopify’s Assets API.

Technical Details:

  • Using Laravel with the kyon147/laravel-shopify package
  • Error occurs on PUT request to /admin/api/2023-10/themes/{theme_id}/assets.json
  • Attempting to create an ‘out-of-stock.liquid’ template file
  • Code retrieves active theme ID and tries to create asset with key ‘templates/out-of-stock.liquid’ and test content

Current Status:

  • Issue remains unresolved
  • At least one other developer (thiago_tns) reports experiencing the identical problem
  • No solution or explanation has been provided yet

The discussion appears to be seeking help identifying what’s causing the API endpoint to return 404 instead of successfully creating the liquid file.

Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

I am using Laravel and kyon147/laravel-shopify package to create an app. When I wanted to create a liquid file through asset API, I got the below error. Let me know what is wrong.

  "exception"
      Client error: `PUT my-shop-domain/admin/api/2023-10/themes/161834598681/assets.json` resulted in a `404 Not Found`

Controller Method:

    public function index()
    {
        /** @var IShopModel $shop*/
        $shop = Auth::user();
        $themes = $shop->api()->rest('GET', '/admin/api/2023-10/themes.json');

        $activeThemeId = '';

        foreach ($themes['body']['themes'] as $theme) {
            if ($theme['role'] === 'main') {
                $activeThemeId = $theme['id'];
            }
        }

        if ($activeThemeId) {

            $content = "test content";

            $liquidFile = [
                'asset' => [
                    'key' => 'templates/out-of-stock.liquid',
                    'value' => "test content"
                ]
            ];

            $response = $shop->api()->rest('PUT', '/admin/api/2023-10/themes/' . $activeThemeId . '/assets.json', $liquidFile);

            dd($response);
        }
    }
1 Like

I have the exact same issue right now.

1 Like