---
title: scriptTagUpdate - GraphQL Admin
description: |-
  <div class="note"><h4>Theme app extensions</h4>
    <p>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. <a
  href="/apps/online-store#what-integration-method-should-i-use"
  target="_blank">Learn more</a>.</p></div>


  Updates a script tag.
api_version: 2026-10
source_url:
  html: 'https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagUpdate'
  md: >-
    https://shopify.dev/docs/api/admin-graphql/latest/mutations/scriptTagUpdate.md
api_name: admin
api_type: graphql
type: mutation
---

# script​Tag​Update

mutation

Requires `write_script_tags` access scope. Also: Requires access to script tags.

**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).

Updates a script tag.

## Arguments

* id

  [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)

  required

  The ID of the script tag to update.

* input

  [Script​Tag​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/ScriptTagInput)

  required

  Specifies the input fields for a script tag.

***

## Script​Tag​Update​Payload returns

* script​Tag

  [Script​Tag](https://shopify.dev/docs/api/admin-graphql/latest/objects/ScriptTag)

  The script tag that was updated.

* user​Errors

  [\[User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/UserError)

  non-null

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Updates a script tag

  #### Query

  ```graphql
  mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
    scriptTagUpdate(id: $id, input: $input) {
      scriptTag {
        id
        cache
        createdAt
        displayScope
        src
        updatedAt
      }
      userErrors {
        field
        message
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/ScriptTag/421379493",
    "input": {
      "src": "https://js.example.org/updated.js",
      "displayScope": "ONLINE_STORE"
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) { scriptTagUpdate(id: $id, input: $input) { scriptTag { id cache createdAt displayScope src updatedAt } userErrors { field message } } }",
   "variables": {
      "id": "gid://shopify/ScriptTag/421379493",
      "input": {
        "src": "https://js.example.org/updated.js",
        "displayScope": "ONLINE_STORE"
      }
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
      scriptTagUpdate(id: $id, input: $input) {
        scriptTag {
          id
          cache
          createdAt
          displayScope
          src
          updatedAt
        }
        userErrors {
          field
          message
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/ScriptTag/421379493",
          "input": {
              "src": "https://js.example.org/updated.js",
              "displayScope": "ONLINE_STORE"
          }
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
      scriptTagUpdate(id: $id, input: $input) {
        scriptTag {
          id
          cache
          createdAt
          displayScope
          src
          updatedAt
        }
        userErrors {
          field
          message
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/ScriptTag/421379493",
    "input": {
      "src": "https://js.example.org/updated.js",
      "displayScope": "ONLINE_STORE"
    }
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
        scriptTagUpdate(id: $id, input: $input) {
          scriptTag {
            id
            cache
            createdAt
            displayScope
            src
            updatedAt
          }
          userErrors {
            field
            message
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/ScriptTag/421379493",
          "input": {
              "src": "https://js.example.org/updated.js",
              "displayScope": "ONLINE_STORE"
          }
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
    scriptTagUpdate(id: $id, input: $input) {
      scriptTag {
        id
        cache
        createdAt
        displayScope
        src
        updatedAt
      }
      userErrors {
        field
        message
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/ScriptTag/421379493",
    "input": {
      "src": "https://js.example.org/updated.js",
      "displayScope": "ONLINE_STORE"
    }
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        mutation ScriptTagUpdate($id: ID!, $input: ScriptTagInput!) {
          scriptTagUpdate(id: $id, input: $input) {
            scriptTag {
              id
              cache
              createdAt
              displayScope
              src
              updatedAt
            }
            userErrors {
              field
              message
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/ScriptTag/421379493",
          "input": {
              "src": "https://js.example.org/updated.js",
              "displayScope": "ONLINE_STORE"
          }
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "scriptTagUpdate": {
      "scriptTag": {
        "id": "gid://shopify/ScriptTag/421379493",
        "cache": false,
        "createdAt": "2024-12-18T11:35:33Z",
        "displayScope": "ONLINE_STORE",
        "src": "https://js.example.org/updated.js",
        "updatedAt": "2024-12-18T11:37:33Z"
      },
      "userErrors": []
    }
  }
  ```

* ### scriptTagUpdate reference
