For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
  • Overview
    • Quick Start
    • Sandboxes
    • Tools & SDKs
    • Support
  • Docs
      • Getting Started
          • Overview
          • Authentication
          • Best Practices
          • Analytics
          • B2B
          • Cart and Checkout
          • Customers
          • Orders
          • Routes and Content
          • Storefront Scripts
    • Archive
    • Closed Beta Programs
Dev Portal
LogoLogo
On this page
  • GraphQL Storefront API: Scripts overview
  • Introduction
  • What is a storefront script
  • Prerequisites
  • Getting started
  • Resources
DocsStorefrontGuidesGraphQL Storefront

GraphQL Storefront API Scripts overview

Was this page helpful?
Previous

Multi-Language Support

Next

Getting Started

Built with

GraphQL Storefront API: Scripts overview

Introduction

The GraphQL Storefront API’s scripts query allows you to fetch storefront scripts configured in your BigCommerce control panel. This feature is designed to help merchants and developers programmatically retrieve both inline and external scripts that are executed on the storefront, providing visibility and control over scripts used for analytics, integrations, and custom storefront functionality.

What is a storefront script

A storefront script is a snippet of JavaScript or an external script URL that can be injected into your storefront pages. Storefront scripts are managed per storefront through the BigCommerce control panel and can be used for a wide variety of purposes, such as analytics tracking, integrations with third-party services, or adding custom functionality to storefront pages.

Prerequisites

Before using the scripts query, ensure you have the following:

  • A BigCommerce store with scripts configured via the control panel
  • A valid Storefront API access token with sufficient permissions to query storefront data

To learn more about authenticating GraphQL Storefront API requests, see the Authentication and Example Requests.

Getting started

The scripts query provides a simple way to retrieve all scripts set up for your storefront. You can use this query to audit which scripts are currently active, fetch metadata such as consent category and visibility, and distinguish between inline and external scripts. The API supports filtering, pagination, and provides detailed information about each script, including its location on the page (e.g., <head>, <footer>), integrity hashes, and type.

Begin with the following steps:

  1. Obtain a Storefront API access token from the control panel.
  2. Use a GraphQL client such as Altair.
  3. Set the request URL to your store’s GraphQL endpoint (e.g., https://store-{store_hash}.mybigcommerce.com/graphql).
  4. Send an Authorization header with your Storefront API token.
  5. Use the request body to send the scripts query.
Request
Response

The following example query will fetch the full set of storefront scripts.

Example query: Get storefront scripts
query Scripts {
site {
content {
scripts {
edges {
node {
... on InlineScript {
scriptTag
entityId
consentCategory
visibility
integrityHashes {
hash
}
location
}
... on SrcScript {
src
entityId
consentCategory
visibility
integrityHashes {
hash
}
location
}
}
}
}
}
}
}

Resources

  • BigCommerce GraphQL Storefront API Reference - Official API reference for the Storefront GraphQL API
  • Scripts REST API - BigCommerce REST API endpoints for storefront script management
  • Storefront Scripts Overview (Help Center) - BigCommerce Support documentation on Script Manager
  • Storefront API Authentication - Instructions for authenticating requests to the Storefront GraphQL API
  • GraphQL Playground - Interactive GraphQL IDE for testing queries against the Storefront API