---
title: "Creates a script."
method: POST
path: "/content/scripts"
tags: ["Script"]
---

# Creates a script.

`POST /content/scripts`

## Request body

- ScriptPost
  - `name` string, required — The user-friendly name.
  - `description` string — The user-friendly description.
  - `html` string — An html string containing exactly one `script` tag. Required if `kind` is `script_tag`.
  - `src` string — The `src` attribute of the script to load. Required if `kind` is `src`. Must be in `https` format.
  - `auto_uninstall` boolean — Whether to uninstall this script when the app associated with it is removed.
  - `load_method` 'default' | 'async' | 'defer' — The load method to use for the script. Acceptable values are `default`, `async`, or `defer`.
  - `location` 'head' | 'footer' — Where on the page to place the script. Acceptable values are `head` or `footer`.
  - `visibility` 'storefront' | 'all_pages' | 'checkout' | 'order_confirmation' — Which set of pages the script should load on. The values allowed for this parameter are `storefront`, `all_pages`, `checkout` and `order_confirmation`. Please note that you need to have `Checkout content` scope to use `all_pages` and `checkout`.
  - `kind` 'src' | 'html' — What type of script this is. Acceptable values are `src` - a `script` tag will be generated with its `src` attribute set to the value of `src`; `script_tag` - The value of `html` (which must contain a single `script` tag) will be injected directly onto the page.

## Response `200`

Success.

- ScriptResponse
  - `data` Script
    - `uuid` string, uuid — The primary identifier.
    - `name` string — The user-friendly name.
    - `description` string — The user-friendly description.
    - `html` string — An html string containing exactly one `script` tag. Only present if `kind` is `script_tag`
    - `src` string — The `src` attribute of the script to load. Only present if `kind` is `src`.
    - `auto_uninstall` boolean — Whether to uninstall this script when the app associated with it is removed.
    - `load_method` 'default' | 'async' | 'defer' — The load method to use for the script. Values are `default`, `async`, or `defer`.
    - `location` 'head' | 'footer' — Where on the page to place the script. Values are `head` or `footer`.
    - `visibility` 'storefront' | 'all_pages' | 'checkout' | 'order_confirmation' — Which set of pages the script should load on. The values allowed for this parameter are `storefront`, `all_pages`, `checkout` and `order_confirmation`. Please note that you need to have `Checkout content` scope to use `all_pages` and `checkout`.
    - `kind` 'src' | 'script_tag' — What type of script this is. Values are `src` - a `script` tag will be generated with its `src` attribute set to the value of `src`; `script_tag` - The value of `html` will be injected directly onto the page.
    - `api_client_id` string — The client id of the API user that created this script, or blank if created by other means.
    - `date_created` string, date-time — The date on which this object was initially created.
    - `date_modified` string, date-time — The date on which this object was last updated.

## Other responses

- `422` — This is the result of missing required fields, or of invalid data. See the response for more details.

---

[API](https://skmtc.net/bigcommerce/apis/bigcommerce-api.md) · [All operations](https://skmtc.net/bigcommerce/apis/bigcommerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bigcommerce/bigcommerce-api/revisions/90efb67b99f3/schema)
