Shopify API to add custom a section with long HTML code

Topic summary

A developer is working with the Shopify API to add custom sections to an active theme but faces limitations with file size. The issue centers on uploading sections with lengthy HTML and Liquid code, including {% schema %} blocks.

Current limitation:

  • The Shopify Admin REST API only supports uploading assets via image URLs, not direct file/Liquid URLs for section uploads
  • The developer currently uses PUT requests to the theme assets endpoint but must send the entire code as an array/string

Question posed:
Is there a way to upload a complete file as a section instead of embedding extensive code directly in the API request?

The thread remains open with minimal engagement and no solution provided yet.

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

I have an app that creates custom section on the active theme, but the file content is too long and I also added {% schema %}.
is there an option to upload a file as a section instead sending an array with endless code?

on the API documentation there is an option only for image URL but not for file/liquid URL for upload as section.

sample of PUT request i use:

PUT /admin/api/2021-01/themes/828155753/assets.json { “asset”: { “key”: “templates/index.liquid”, “value”: “

We are busy updating the store for you and will be back within the hour.

” } }

https://shopify.dev/docs/admin-api/rest/reference/online-store/asset

As expected, no replies