PUT /sites/{site_id}/custom_code
Apply registered scripts to a site. If you have multiple scripts your App needs to apply or maintain on a site, ensure they are always included in the request body for this endpoint. To remove individual scripts, simply call this endpoint without the script in the request body.
To apply a script to a site or page, the script must first be registered to a site via the [Register Script](/data/reference/custom-code/custom-code/register-hosted) endpoints. Once registered, the script can be applied to a Site or Page using the appropriate endpoints. See the documentation on [working with Custom Code](/data/docs/custom-code) for more information.Access to this endpoint requires a bearer token obtained from an OAuth Code Grant Flow.
Required scope | custom_code:write
Servers
- https://api.webflow.com/v2
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
site_id |
String | Yes |
Unique identifier for a Site |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
createdOn |
String | No |
Date when the Site's scripts were created |
scripts[] |
Array | No |
A list of scripts applied to a Site or a Page |
scripts[].id |
String | Yes |
ID of the registered custom code script |
scripts[].attributes |
Object | No |
Developer-specified key/value pairs to be applied as attributes to the script |
scripts[].location |
String | Yes |
Location of the script, either in the header or footer of the published site Valid values:
Default value: "header" |
scripts[].version |
String | Yes |
Semantic Version String for the registered script e.g. 0.0.1 |
lastUpdated |
String | No |
Date when the Site's scripts were last updated |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.