---
title: "Publish Script to Website"
method: PUT
path: "/api/cmp/v1/domains/publish"
tags: ["Scripts"]
---

# Publish Script to Website

`PUT /api/cmp/v1/domains/publish`

## Request

- Base URL: `https://hostname`
- URL: `https://hostname/api/cmp/v1/domains/publish`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://{hostname}/api/access/v1/oauth/token` scopes: `COOKIE`, `COOKIE_READ`

Use this API to publish the script configuration options for the specified website.

> 👍 
>
> For more information, see [Publishing and Implementing Cookie Consent Scripts](https://my.onetrust.com/s/article/UUID-7478d3b4-18eb-3ac0-a6fd-fb7ebff9f8dc).

## Query parameters

- `scriptType` 'production' | 'test'
- `website` string, required

## Request body

- ScriptPublishRequestDto
  - `scriptVersion` string: (Optional) The SDK version to publish to. If not provided, the previously configured SDK version will be used.
  - `languages` string[]: The list of language codes for localized content.
  - `publishIndividualLanguages` boolean: This flag indicates whether to publish scripts for individual languages separately.
  - `requireReconsent` boolean: This flag indicates whether user reconsent is required.
  - `regionRules` PublishRegionRuleDto[]: (Optional) Individual geolocation rules to apply require reconsent to.
    - `ruleId` string, uuid: Unique identifier of the geo rule.
    - `ruleName` string: Name of a Geolocation rule
  - `suppressBannerEnabled` boolean: This flag indicates whether the consent banner display is suppressed.
  - `suppressPCEnabled` boolean: This flag indicates whether the preference center display is suppressed.
  - `ccpaOptOutEnabled` boolean: When the toggle is ON, the CCPA/CPRA opt-out icon will display next to the "Do Not Sell or Share" button whenever it is shown to site visitors.
  - `gaTrackingEnabled` boolean: When toggle is ON, Google Analytics events will be created and passed based on user interaction. You can also choose for gaEvent tracking on the banner to be associated with the acceptance of a category. The data-ignore-ga='true' attribute will override this configuration. Google Analytics integration also required.
  - `gaAssignCategory` string: Name of the category to assign to Google Analytics events. Use 'AS' for always send. Unnecessary unless gaTrackingEnabled is true.
  - `autoblockEnabled` boolean: This flag indicates whether automatic blocking of cookies is enabled.
  - `enableCommonTrackers` boolean: This flag indicates whether common tracking technologies are enabled.
  - `commonTrackers` string[]: Select the hosts that you want to autoblock. Only applicable when autoblockEnabled and enableCommonTrackers are true.
  - `sameSiteNone` boolean: Sets the cookies used SameSite attribute to 'None'
  - `separateCookieByDomain` boolean: Only applicable when sameSiteNone is true.When cookies are created with partitioned state from an iframe, they are created specific to their top level site domain and are not shared with other top-level domains using the same iframe. This setting is ignored if sameSiteNone is false.
  - `supportSPA` boolean: Enabling this allows you to force the banner to reload, the same as it would on an actual page change.
  - `supportCSP` boolean: If enabled, the polyfill allows us to add inline styles, style tags with a nonce are allowed by the CSP
  - `languageDetectionEnabled` boolean: This flag indicates whether automatic language detection is enabled.
  - `languageDetectionVisitor` boolean: This flag indicates whether visitor-based language detection is enabled.
  - `languageDetectionHtml` boolean: This flag indicates whether HTML-based language detection is enabled.
  - `autoRefreshEnabled` boolean: When a user makes any consent choice, the web page and consent banner will refresh automatically. This setting can further prevent unauthorized cookies from dropping without consent.

## Response `200`

OK

- PublishScriptDto
  - `responseMsg` string: The response message returned from the operation.
  - `publishVersion` string: The version number of the published script.
  - `consentPolicyName` string: The name of the consent policy that is applied.
  - `autoBlocking` boolean: This flag indicates whether automatic cookie blocking is enabled.
  - `reconsentRequired` boolean: This flag indicates whether user reconsent is required.
  - `publishedDate` string, date-time: The date and time when the script was published.
  - `userName` string: The name of the user who performed the operation.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `429`: Too Many Requests. For more information, see [API Rate Limits](https://developer.onetrust.com/onetrust/reference/rate-limits-overview).
- `500`: Internal Server Error

---

[API](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent.md) - [All operations](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent/llms.txt) - [OpenAPI document](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent/revisions/b4fb4606f973?raw)
