Script tags
Scripts an app loads on the online store's pages. An app sees and changes only the script tags it created; they're removed when the app is uninstalled.
Endpoints#
- GET
/script_tags.jsonList the app's script tags - GET
/script_tags/count.jsonCount the app's script tags - GET
/script_tags/{id}.jsonGet a script tag - POST
/script_tags.jsonAdd a script tag - PUT
/script_tags/{id}.jsonChange a script tag - DELETE
/script_tags/{id}.jsonRemove a script tag
Paths are relative to https://store.weftgrid.com/api/admin/2026-10. The examples read the token from $STORELOOM_TOKEN and ids from variables like $ORDER_ID.
The script tag object#
What the endpoints below return for one script tag.
{
"id": "cm2scrp0001",
"src": "https://reviews.example/storefront.js",
"event": "onload",
"display_scope": "online_store",
"created_at": "2026-10-25T09:12:00.000Z",
"updated_at": "2026-10-25T09:12:00.000Z"
}List the app's script tags#
/script_tags.jsonread_script_tags| Parameter | Description |
|---|---|
src | Only the script tag with this URL. |
since_id | Only script tags after this id. |
limit | Up to 250 (default 50). |
curl "https://store.weftgrid.com/api/admin/2026-10/script_tags.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"script_tags": [
{
"id": "cm2scrp0001",
"src": "https://reviews.example/storefront.js",
"event": "onload",
"display_scope": "online_store",
"created_at": "2026-10-25T09:12:00.000Z",
"updated_at": "2026-10-25T09:12:00.000Z"
}
]
}Count the app's script tags#
/script_tags/count.jsonread_script_tagscurl "https://store.weftgrid.com/api/admin/2026-10/script_tags/count.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{ "count": 1 }Get a script tag#
/script_tags/{id}.jsonread_script_tagscurl "https://store.weftgrid.com/api/admin/2026-10/script_tags/$SCRIPT_TAG_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{
"script_tag": {
"id": "cm2scrp0001",
"src": "https://reviews.example/storefront.js",
"event": "onload",
"display_scope": "online_store",
"created_at": "2026-10-25T09:12:00.000Z",
"updated_at": "2026-10-25T09:12:00.000Z"
}
}Add a script tag#
/script_tags.jsonwrite_script_tagsLoads the script (async, at the end of the page) on the store's storefront. display_scope: online_store (every storefront page, the default), order_status (the order status page) or all. src must be https. Scripts only load when shoppers are on the store's own address (its subdomain or domain), never on the platform's /store/<key> preview paths. An app can have up to 10, and they're removed when the app is uninstalled. Only apps installed from the App Store can add them.
{"script_tag":{"event":"onload","src":"https://reviews.example/storefront.js","display_scope":"online_store"}}curl -X POST "https://store.weftgrid.com/api/admin/2026-10/script_tags.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"script_tag":{"event":"onload","src":"https://reviews.example/storefront.js","display_scope":"online_store"}}'Example responseShowHide
{
"script_tag": {
"id": "cm2scrp0001",
"src": "https://reviews.example/storefront.js",
"event": "onload",
"display_scope": "online_store",
"created_at": "2026-10-25T09:12:00.000Z",
"updated_at": "2026-10-25T09:12:00.000Z"
}
}Change a script tag#
/script_tags/{id}.jsonwrite_script_tags{"script_tag":{"src":"https://reviews.example/storefront-v2.js","display_scope":"all"}}curl -X PUT "https://store.weftgrid.com/api/admin/2026-10/script_tags/$SCRIPT_TAG_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"script_tag":{"src":"https://reviews.example/storefront-v2.js","display_scope":"all"}}'Example responseShowHide
{
"script_tag": {
"id": "cm2scrp0001",
"src": "https://reviews.example/storefront.js",
"event": "onload",
"display_scope": "online_store",
"created_at": "2026-10-25T09:12:00.000Z",
"updated_at": "2026-10-25T09:12:00.000Z"
}
}Remove a script tag#
/script_tags/{id}.jsonwrite_script_tagscurl -X DELETE "https://store.weftgrid.com/api/admin/2026-10/script_tags/$SCRIPT_TAG_ID.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"Example responseShowHide
{}