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.
Resources
Get started
ReferenceGuidesChangelog
ReferenceGuidesChangelog
  • Token
    • GETGet Authorization User Info
    • GETGet Authorization Info
    • POSTResolve ID Token
  • Sites
    • GETList Sites
    • GETGet Site
    • GETGet Custom Domains
    • POSTPublish Site
  • Pages and Components
  • CMS
  • Forms
  • Custom Code
      • GETGet Custom Code
      • PUTAdd/Update Custom Code
      • DELDelete Custom Code
  • Assets
  • Comments
    • GETSearch Users by Email
    • GETList Comment Threads
    • GETGet Comment Thread
    • GETList Comment Replies
    • POSTCreate Comment Reply
  • Ecommerce
  • Webhooks
  • Site Configuration
  • Enterprise
  • App Subscriptions
    • GETGet app subscriptions
LogoLogo
Resources
Get started
Custom CodeCustom Code - Pages

Add/Update Custom Code

PUT
https://api.webflow.com/beta/pages/:page_id/custom_code
PUT
/beta/pages/:page_id/custom_code
$curl -X PUT https://api.webflow.com/beta/pages/63c720f9347c2139b248e552/custom_code \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "scripts": [
> {
> "id": "cms_slider",
> "location": "header",
> "version": "1.0.0",
> "attributes": {
> "my-attribute": "some-value"
> }
> },
> {
> "id": "alert",
> "location": "header",
> "version": "0.0.1"
> }
> ]
>}'
1{
2 "scripts": [
3 {
4 "id": "cms_slider",
5 "location": "header",
6 "version": "1.0.0",
7 "attributes": {
8 "my-attribute": "some-value"
9 }
10 },
11 {
12 "id": "alert",
13 "location": "header",
14 "version": "0.0.1",
15 "attributes": {}
16 }
17 ],
18 "lastUpdated": "2022-10-26T00:28:54.191Z",
19 "createdOn": "2022-10-26T00:28:54.191Z"
20}
Apply registered scripts to a page. If you have multiple scripts your App needs to apply or maintain on a page, 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. <Note title="Script Registration"> To apply a script to a 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. </Note> <Note>Access to this endpoint requires a bearer token obtained from an [OAuth Code Grant Flow](/data/reference/oauth-app).</Note> Required scope | `custom_code:write`
Was this page helpful?
Previous

Delete Custom Code

Next
Built with

Apply registered scripts to a page. If you have multiple scripts your App needs to apply or maintain on a page, 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.

Script Registration

To apply a script to a page, the script must first be registered to a Site via the Register Script 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 for more information.

Access to this endpoint requires a bearer token obtained from an OAuth Code Grant Flow.

Required scope | custom_code:write

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

page_idstringRequiredformat: "objectid"
Unique identifier for a Page

Request

This endpoint expects an object.
scriptslist of objectsOptional
A list of scripts applied to a Site or a Page

Response

Request was successful
scriptslist of objects
A list of scripts applied to a Site or a Page
lastUpdatedstringRead-onlyformat: "date-string"
Date when the Site's scripts were last updated
createdOnstringRead-onlyformat: "date-string"
Date when the Site's scripts were created

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error