Register a hosted script to a site.
<Note title="Script Registration">
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.
</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`
Request
A registered external script
hostedLocationstringRequired
URI for an externally hosted script location
integrityHashstringRequiredformat: "hash"
Sub-Resource Integrity Hash
versionstringRequired
A Semantic Version (SemVer) string, denoting the version of the script
displayNamestringRequired
User-facing name for the script. Must be between 1 and 50 alphanumeric characters
canCopybooleanOptionalDefaults to false
Define whether the script can be copied on site duplication and transfer
Response
Request was successful
idstringOptionalRead-only
Human readable id, derived from the user-specified display name
canCopybooleanOptionalDefaults to false
Define whether the script can be copied on site duplication and transfer
displayNamestringOptional
User-facing name for the script. Must be between 1 and 50 alphanumeric characters
hostedLocationstringOptional
URI for an externally hosted script location
integrityHashstringOptionalformat: "hash"
Sub-Resource Integrity Hash. Only required for externally hosted scripts (passed via hostedLocation)
createdOnstringOptionalRead-onlyformat: "date-string"
Timestamp when the script version was created
lastUpdatedstringOptionalRead-onlyformat: "date-string"
Timestamp when the script version was last updated
versionstringOptional
A Semantic Version (SemVer) string, denoting the version of the script