How can I find a theme's template ID programmatically (for deep linking into an existing app block?)

Topic summary

Main issue: How to obtain a theme’s TEMPLATE_ID programmatically to deep link directly into an existing App Block within the Shopify theme editor.

Context and URL pattern: Deep linking works for adding App Blocks per Shopify docs, but the goal is linking to an existing block. Observed editor URL requires:

  • block=template–[TEMPLATE_ID]__[SECTION_ID]/[BLOCK_ID]
  • section=template–[TEMPLATE_ID]__[SECTION_ID]
  • Other params include theme ID and optional previewPath (e.g., /pages/contact).

What’s known vs missing:

  • Can retrieve THEME_ID, SECTION_ID, BLOCK_ID via themes.json and assets.json APIs.
  • Cannot find TEMPLATE_ID via those endpoints and seeks a dynamic/programmatic method to fetch it.

Current status:

  • No solution provided in the thread; subsequent posts also inquire about an answer.
  • Discussion remains open with an unresolved key question: where to programmatically obtain TEMPLATE_ID for use in the template–[TEMPLATE_ID] URL segments.
Summarized with AI on January 10. AI used: gpt-5.

Hey Shopify app devs… hoping to get some help on an issue I’m working on, specifically related to deep linking from my app into the theme editor. It appears that the deep linking functionality is only for “adding” an App Block to a theme. (https://shopify.dev/docs/apps/online-store/theme-app-extensions/extensions-framework#app-block-deep-link-query-parameters)

The use case I am looking into is related to deep linking into an “existing” App Block. In looking at the URL structure when I am inside of my theme, is see the following pattern:

https://admin.shopify.com/store/[SUBDOMAIN]/themes/[THEME_ID]/editor?previewPath=/pages/contact&block=template–[TEMPLATE_ID][SECTION_ID]/[BLOCK_ID]&section=template–[TEMPLATE_ID][SECTION_ID]

Using the themes.json and assets.json APIs, I am able to retrieve all of the above information EXCEPT for the TEMPLATE_ID. I can’t seem to figure out how to fetch this value dynamically.

Does anyone know how/where I can find this programmatically?

Any ideas or suggestions would be appreciated… :call_me_hand:

3 Likes

Still searching for this answer if anyone has any insights :grinning_face_with_smiling_eyes: .

Has anyone found the solution to this one??