---
title: ScriptTag
description: >-
  Load remote JavaScript into the storefront and order status pages of an online
  store to add functionality without modifying the store's theme files.
api_version: 2026-07
source_url:
  html: 'https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag'
  md: 'https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md'
api_name: admin-rest
api_type: rest
---

The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql). For details and migration steps, visit our [migration guide](https://shopify.dev/docs/apps/build/graphql/migrate).

# Script​Tag

**Requires \`script\_tags\` access scope.:**

**Theme app extensions:**

If your app integrates with a Shopify theme and you plan to submit it to the Shopify App Store, you must use theme app extensions instead of Script tags. Script tags can only be used with vintage themes. [Learn more](https://shopify.dev/apps/online-store#what-integration-method-should-i-use).

The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.

Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.

\#

## Endpoints

* [post](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#post-script-tags)

  [/admin/api/latest/script\_​tags.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#post-script-tags)

  Creates a new script tag

  [scriptTagCreate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagCreate?example=creates-a-new-script-tag)

* [get](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags)

  [/admin/api/latest/script\_​tags.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags)

  Retrieves a list of all script tags

  [scriptTags](https://shopify.dev/docs/api/admin-graphql/latest/queries/scriptTags?example=retrieves-a-list-of-all-script-tags)

* [get](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags-script-tag-id)

  [/admin/api/latest/script\_​tags/{script\_​tag\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags-script-tag-id)

  Retrieves a single script tag

  [scriptTag](https://shopify.dev/docs/api/admin-graphql/latest/queries/scriptTag?example=retrieves-a-single-script-tag)

* [get](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags-count)

  [/admin/api/latest/script\_​tags/count.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#get-script-tags-count)

  Retrieves a count of all script tags

  **deprecated**

* [put](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#put-script-tags-script-tag-id)

  [/admin/api/latest/script\_​tags/{script\_​tag\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#put-script-tags-script-tag-id)

  Updates a script tag

  [scriptTagUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagUpdate?example=updates-a-script-tag)

* [del](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#delete-script-tags-script-tag-id)

  [/admin/api/latest/script\_​tags/{script\_​tag\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/scripttag.md#delete-script-tags-script-tag-id)

  Deletes a script tag

  [scriptTagDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagDelete?example=deletes-a-script-tag)

***

## The ScriptTag resource

### Properties

***

created\_at

**read-only**

->[createdAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.createdAt)

The date and time ([ISO 8601](http://en.wikipedia.org/wiki/ISO_8601)) when the script tag was created.

***

event

**deprecated**

The DOM event that triggers the loading of the script. Valid values: `onload`.

***

id

**read-only**

->[id](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.id)

The ID for the script tag.

***

src

->[src](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.src)

The URL of the remote script.

***

display\_scope

->[displayScope](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.displayScope)

The page or pages on the online store where the script should be included. Valid values:

* `online_store`: Include the script only on the web storefront.
* `order_status`: Include the script only on the order status page.
* `all`: Include the script on both the web storefront and the order status page.

***

cache

->[cache](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.cache)

Whether the Shopify CDN can cache and serve the script tag. Valid values:

* `true`: The script will be cached and served by the CDN. The cache expires 15 minutes after the script tag is successfully returned.
* `false`: The script will be served as is.

Default value: `false`.

***

updated\_at

**read-only**

->[updatedAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag#field-ScriptTag.fields.updatedAt)

The date and time ([ISO 8601](http://en.wikipedia.org/wiki/ISO_8601)) when the script tag was last updated.

***

{}

## The ScriptTag resource

```json
{
  "created_at": "2012-08-24T14:01:47-04:00",
  "event": "onload",
  "id": 596726825,
  "src": "https://js.example.org/foo.js",
  "display_scope": "online_store",
  "cache": true,
  "updated_at": "2012-08-24T14:01:47-04:00"
}
```

***

## postCreates a new script tag

[scriptTagCreate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagCreate?example=creates-a-new-script-tag)

Creates a new script tag

### Parameters

***

api\_version

**string**

**required**

***

### Examples

### Create a new script tag

### Request body

script\_​tag​

**Script\_tag resource**

script\_​tag.event:​"onload"

**deprecated**

The DOM event that triggers the loading of the script. Valid values: `onload`.

script\_​tag.src:​"https://example.com/my\_script.js"

->[src](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/ScriptTagInput#fields-src)

The URL of the remote script.

### Creating a script tag without a src and event will return an error

post

## /admin/api/2026-07/script\_​tags.​json

```bash
curl -d '{"script_tag":{"event":"onload","src":"https://example.com/my_script.js"}}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"
```

{}

## Response

JSON

```json
HTTP/1.1 201 Created
{
  "script_tag": {
    "id": 870402689,
    "src": "https://example.com/my_script.js",
    "event": "onload",
    "created_at": "2026-07-01T12:19:47-04:00",
    "updated_at": "2026-07-01T12:19:47-04:00",
    "display_scope": "online_store",
    "cache": false
  }
}
```

### examples

* #### Create a new script tag

  #####

  ```curl
  curl -d '{"script_tag":{"event":"onload","src":"https://example.com/my_script.js"}}' \
  -X POST "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json" \
  -H "X-Shopify-Access-Token: {access_token}" \
  -H "Content-Type: application/json"
  ```

  #### response

  ```json
  HTTP/1.1 201 Created{"script_tag":{"id":870402689,"src":"https://example.com/my_script.js","event":"onload","created_at":"2026-07-01T12:19:47-04:00","updated_at":"2026-07-01T12:19:47-04:00","display_scope":"online_store","cache":false}}
  ```

* #### Creating a script tag without a src and event will return an error

  #####

  ```curl
  curl -d '{"script_tag":{"body":"foobar"}}' \
  -X POST "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json" \
  -H "X-Shopify-Access-Token: {access_token}" \
  -H "Content-Type: application/json"
  ```

  #### response

  ```json
  HTTP/1.1 422 Unprocessable Entity{"errors":{"src":["can't be blank","must be secure (HTTPS)"],"event":["can't be blank","is invalid"]}}
  ```

***

## getRetrieves a list of all script tags

[scriptTags](https://shopify.dev/docs/api/admin-graphql/latest/queries/scriptTags?example=retrieves-a-list-of-all-script-tags)

Retrieves a list of all script tags. **Note:** This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to [Make paginated requests to the REST Admin API](https://shopify.dev/api/usage/pagination-rest).

### Parameters

***

api\_version

**string**

**required**

***

created\_at\_max

Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00)

***

created\_at\_min

Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00)

***

fields

A comma-separated list of fields to include in the response.

***

limit

**≤ 250**

**default 50**

The number of results to return.

***

since\_id

Restrict results to after the specified ID.

***

src

Show script tags with this URL.

***

updated\_at\_max

Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00)

***

updated\_at\_min

Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00)

***

### Examples

### Retrieve a list of all script tags

### Retrieve a list of all script tags after the specified ID

### Query parameters

since\_​id=​421379493

Restrict results to after the specified ID.

### Retrieve a list of all script tags with a particular URL

### Query parameters

src=​https://js.example.org/foo.js

Show script tags with this URL.

get

## /admin/api/2026-07/script\_​tags.​json

```bash
curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json" \
-H "X-Shopify-Access-Token: {access_token}"
```

{}

## Response

JSON

```json
HTTP/1.1 200 OK
{
  "script_tags": [
    {
      "id": 421379493,
      "src": "https://js.example.org/bar.js",
      "event": "onload",
      "created_at": "2026-07-01T12:17:28-04:00",
      "updated_at": "2026-07-01T12:17:28-04:00",
      "display_scope": "all",
      "cache": false
    },
    {
      "id": 596726825,
      "src": "https://js.example.org/foo.js",
      "event": "onload",
      "created_at": "2026-07-01T12:17:28-04:00",
      "updated_at": "2026-07-01T12:17:28-04:00",
      "display_scope": "all",
      "cache": false
    }
  ]
}
```

### examples

* #### Retrieve a list of all script tags

  #####

  ```curl
  curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

  #### response

  ```json
  HTTP/1.1 200 OK{"script_tags":[{"id":421379493,"src":"https://js.example.org/bar.js","event":"onload","created_at":"2026-07-01T12:17:28-04:00","updated_at":"2026-07-01T12:17:28-04:00","display_scope":"all","cache":false},{"id":596726825,"src":"https://js.example.org/foo.js","event":"onload","created_at":"2026-07-01T12:17:28-04:00","updated_at":"2026-07-01T12:17:28-04:00","display_scope":"all","cache":false}]}
  ```

* #### Retrieve a list of all script tags after the specified ID

  #####

  ```curl
  curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json?since_id=421379493" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

* #### Retrieve a list of all script tags with a particular URL

  #####

  ```curl
  curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags.json?src=https%3A%2F%2Fjs.example.org%2Ffoo.js" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

***

## getRetrieves a single script tag

[scriptTag](https://shopify.dev/docs/api/admin-graphql/latest/queries/scriptTag?example=retrieves-a-single-script-tag)

Retrieves a single script tag

### Parameters

***

api\_version

**string**

**required**

***

script\_tag\_id

**string**

**required**

***

fields

A comma-separated list of fields to include in the response.

***

### Examples

### Retrieve a single script tag by its ID

### Path parameters

script\_​tag\_​id=​596726825

**string**

**required**

get

## /admin/api/2026-07/script\_​tags/596726825.​json

```bash
curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
-H "X-Shopify-Access-Token: {access_token}"
```

{}

## Response

JSON

```json
HTTP/1.1 200 OK
{
  "script_tag": {
    "id": 596726825,
    "src": "https://js.example.org/foo.js",
    "event": "onload",
    "created_at": "2026-07-01T12:17:28-04:00",
    "updated_at": "2026-07-01T12:17:28-04:00",
    "display_scope": "all",
    "cache": false
  }
}
```

### examples

* #### Retrieve a single script tag by its ID

  #####

  ```curl
  curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

  #### response

  ```json
  HTTP/1.1 200 OK{"script_tag":{"id":596726825,"src":"https://js.example.org/foo.js","event":"onload","created_at":"2026-07-01T12:17:28-04:00","updated_at":"2026-07-01T12:17:28-04:00","display_scope":"all","cache":false}}
  ```

***

## getRetrieves a count of all script tags**deprecated**

Retrieves a count of all script tags

### Parameters

***

api\_version

**string**

**required**

***

src

Count only script tags with a given URL.

***

### Examples

### Retrieve a count of all script tags for your shop

get

## /admin/api/2026-07/script\_​tags/count.​json

```bash
curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/count.json" \
-H "X-Shopify-Access-Token: {access_token}"
```

{}

## Response

JSON

```json
HTTP/1.1 200 OK
{
  "count": 2
}
```

### examples

* #### Retrieve a count of all script tags for your shop

  #####

  ```curl
  curl -X GET "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/count.json" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

  #### response

  ```json
  HTTP/1.1 200 OK{"count":2}
  ```

***

## putUpdates a script tag

[scriptTagUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagUpdate?example=updates-a-script-tag)

Updates a script tag

### Parameters

***

api\_version

**string**

**required**

***

script\_tag\_id

**string**

**required**

***

### Examples

### Update a script tag's URL

### Path parameters

script\_​tag\_​id=​596726825

**string**

**required**

### Request body

script\_​tag​

**Script\_tag resource**

script\_​tag.id:​596726825

**read-only**

The ID for the script tag.

script\_​tag.src:​"https://somewhere-else.com/another.js"

->[src](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/ScriptTagInput#fields-src)

The URL of the remote script.

put

## /admin/api/2026-07/script\_​tags/596726825.​json

```bash
curl -d '{"script_tag":{"id":596726825,"src":"https://somewhere-else.com/another.js"}}' \
-X PUT "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"
```

{}

## Response

JSON

```json
HTTP/1.1 200 OK
{
  "script_tag": {
    "src": "https://somewhere-else.com/another.js",
    "display_scope": "all",
    "event": "onload",
    "cache": false,
    "id": 596726825,
    "created_at": "2026-07-01T12:17:28-04:00",
    "updated_at": "2026-07-01T12:19:46-04:00"
  }
}
```

### examples

* #### Update a script tag's URL

  #####

  ```curl
  curl -d '{"script_tag":{"id":596726825,"src":"https://somewhere-else.com/another.js"}}' \
  -X PUT "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
  -H "X-Shopify-Access-Token: {access_token}" \
  -H "Content-Type: application/json"
  ```

  #### response

  ```json
  HTTP/1.1 200 OK{"script_tag":{"src":"https://somewhere-else.com/another.js","display_scope":"all","event":"onload","cache":false,"id":596726825,"created_at":"2026-07-01T12:17:28-04:00","updated_at":"2026-07-01T12:19:46-04:00"}}
  ```

***

## delDeletes a script tag

[scriptTagDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagDelete?example=deletes-a-script-tag)

Deletes a script tag

### Parameters

***

api\_version

**string**

**required**

***

script\_tag\_id

**string**

**required**

***

### Examples

### Delete an existing script tag

### Path parameters

script\_​tag\_​id=​596726825

**string**

**required**

del

## /admin/api/2026-07/script\_​tags/596726825.​json

```bash
curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
-H "X-Shopify-Access-Token: {access_token}"
```

{}

## Response

JSON

```json
HTTP/1.1 200 OK
{}
```

### examples

* #### Delete an existing script tag

  #####

  ```curl
  curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2026-07/script_tags/596726825.json" \
  -H "X-Shopify-Access-Token: {access_token}"
  ```

  #### response

  ```json
  HTTP/1.1 200 OK{}
  ```
