Browse the API docs

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#

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.

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#

GET/script_tags.jsonread_script_tags
Query parameters
ParameterDescription
srcOnly the script tag with this URL.
since_idOnly script tags after this id.
limitUp to 250 (default 50).
Request
curl "https://store.weftgrid.com/api/admin/2026-10/script_tags.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{
  "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#

GET/script_tags/count.jsonread_script_tags
Request
curl "https://store.weftgrid.com/api/admin/2026-10/script_tags/count.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "count": 1 }

Get a script tag#

GET/script_tags/{id}.jsonread_script_tags
Request
curl "https://store.weftgrid.com/api/admin/2026-10/script_tags/$SCRIPT_TAG_ID.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{
  "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#

POST/script_tags.jsonwrite_script_tags

Loads 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.

Request body
{"script_tag":{"event":"onload","src":"https://reviews.example/storefront.js","display_scope":"online_store"}}
Request with curl
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 responseShow
{
  "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#

PUT/script_tags/{id}.jsonwrite_script_tags
Request body
{"script_tag":{"src":"https://reviews.example/storefront-v2.js","display_scope":"all"}}
Request with curl
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 responseShow
{
  "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#

DELETE/script_tags/{id}.jsonwrite_script_tags
Request
curl -X DELETE "https://store.weftgrid.com/api/admin/2026-10/script_tags/$SCRIPT_TAG_ID.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{}