> ## Documentation Index
> Fetch the complete documentation index at: https://developer.onetrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish Script to Website

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).

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0",
    "title": "Consent & Preferences - Cookie Consent (Swagger)"
  },
  "tags": [
    {
      "name": "Scripts"
    }
  ],
  "paths": {
    "/v2/websites/publish": {
      "put": {
        "tags": [
          "Scripts"
        ],
        "summary": "Publish Script to Website",
        "operationId": "publishToSiteUsingPUT",
        "parameters": [
          {
            "name": "website",
            "in": "query",
            "description": "ID of the webiste or URL of the website.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scriptType",
            "in": "query",
            "description": "Type of the script. It can be test or prod/production. test publishes test script and prod/production - publishes production script. If nothing is provided by the user, both production and test scripts will be published.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScriptPublishRequestDto"
              }
            }
          },
          "description": "Publish Request Details",
          "x-examples": {
            "application/json": {
              "autoblockEnabled": true,
              "enableCommonTrackers": false,
              "languageDetectionEnabled": true,
              "languageDetectionHtml": true,
              "languageDetectionVisitor": false,
              "languages": [
                "English",
                "Spanish"
              ],
              "publishIndividualLanguages": false,
              "requireReconsent": false,
              "suppressBannerEnabled": false,
              "suppressPCEnabled": false
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishScriptDto"
                },
                "examples": {
                  "response": {
                    "value": {
                      "autoBlocking": false,
                      "consentPolicyName": "EU Georule",
                      "publishVersion": "6.8.0",
                      "publishedDate": "2002-05-31T14:17:26.598Z",
                      "reconsentRequired": false,
                      "responseMsg": "Publish initiated successfully",
                      "userName": "123e4567-e89b-12d3-a456-426614174000"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "429": {
            "description": "Too Many Requests\nFor more information, see [API Rate Limits](https://developer.onetrust.com/onetrust/reference/rate-limits-overview).",
            "headers": {
              "Retry-After": {
                "description": "The number of seconds after which requests will be allowed again.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "ot-ratelimit-event-id": {
                "description": "The unique identifier for the rate-limiting event.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "ot-requests-allowed": {
                "description": "The number of requests allowed within the specified period.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "ot-period": {
                "description": "The unit of time for which the rate limit applies.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HOUR",
                    "MINUTE"
                  ]
                }
              },
              "ot-request-made": {
                "description": "The number of requests made within the specified period.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": [
          {
            "apikey": []
          },
          {
            "oauth2": [
              "COOKIE"
            ]
          }
        ],
        "description": "Use this API to publish the script configuration options for the specified website.\n\n> 👍 \n> \n> For more information, see [Publishing and Implementing Cookie Consent Scripts](https://my.onetrust.com/s/article/UUID-7478d3b4-18eb-3ac0-a6fd-fb7ebff9f8dc)."
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "x-readme": {
    "explorer-enabled": false,
    "metrics-enabled": false,
    "proxy-enabled": true
  },
  "x-onetrust": {
    "spec-label": "Swagger 2",
    "links": {
      "Cookie Consent Knowledge Base": "https://my.onetrust.com/s/topic/0TO1Q000000ItRyWAK/cookie-compliance"
    }
  },
  "servers": [
    {
      "url": "https://customer.my.onetrust.com/api/cookiemanager"
    }
  ],
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://{$$.env.host}/api/access/v1/oauth/token",
            "scopes": {
              "COOKIE": "Cookie Scope gives the user access to read/write operations inside the Cookie Consent module.",
              "COOKIE_READ": "Cookie Read Scope gives the user read-only access to the Cookie Consent module.",
              "COOKIE_FREE": "Cookie free Scope gives free users access to apis having free scope associated to them inside the Cookie Consent module."
            }
          }
        }
      }
    },
    "schemas": {
      "PublishScriptDto": {
        "type": "object",
        "properties": {
          "autoBlocking": {
            "type": "boolean",
            "description": "Auto-blocking leverages an additional script that must be added to the website to block tracking technologies based on the source setting them.",
            "example": false
          },
          "consentPolicyName": {
            "type": "string",
            "description": "The consent policy that is assigned to the website being published.",
            "example": "EU GeoRule"
          },
          "publishVersion": {
            "type": "string",
            "description": "The last published version of the script.",
            "example": "6.8.0"
          },
          "publishedDate": {
            "type": "string",
            "format": "date-time",
            "description": "The date-time when the script was last published.",
            "example": "2002-05-31T14:17:26.598Z"
          },
          "reconsentRequired": {
            "type": "boolean",
            "description": "Indicates whether website visitors will be reprompted with the Consent Management Platform.",
            "example": false
          },
          "responseMsg": {
            "type": "string",
            "description": "Response message indicating whether the publish was initiated successfully or it failed.",
            "example": "Publish initiated successfully"
          },
          "userName": {
            "type": "string",
            "description": "The tenant GUID of the user which initiated the scan.",
            "example": "123e4567-e89b-12d3-a456-426614174000"
          }
        },
        "title": "PublishScriptDto",
        "description": "Gets the details of the published production or test script for the website that is passed."
      },
      "ScriptPublishRequestDto": {
        "type": "object",
        "properties": {
          "autoblockEnabled": {
            "type": "boolean",
            "description": "Auto-blocking leverages an additional script that must be added to the website to block tracking technologies based on the source setting them. Setting this flag to ’True’ will indicate this script should be published as well. If not specified, this is assumed ‘False’.",
            "example": false,
            "default": false
          },
          "enableCommonTrackers": {
            "type": "boolean",
            "description": "By default, this flag is ‘False’. Setting to ’True’ indicates to the auto-blocking script to automatically block known trackers.",
            "example": false,
            "default": false
          },
          "languageDetectionEnabled": {
            "type": "boolean",
            "description": "Indicates whether to automatically detect the language of the website visitor. By default this is ’True’. If not specified, this will default to the last time it was published.",
            "example": true,
            "default": true
          },
          "languageDetectionHtml": {
            "type": "boolean",
            "description": "Indicates the script should detect the website visitors langauge based on the webpages language.",
            "example": false,
            "default": false
          },
          "languageDetectionVisitor": {
            "type": "boolean",
            "description": "Indicates the script should detect the website visitors langauge based on their browser language. By default this is ’True’.",
            "example": true,
            "default": true
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Only required if ‘publishIndividualLanguages=’True’. Indicates which languages to publish.",
            "example": "English,Spanish",
            "default": null
          },
          "publishIndividualLanguages": {
            "type": "boolean",
            "description": "By default, this flag is ‘False’. Setting to ’True’ indicates you only wish to publish a subset of langauges.",
            "example": false,
            "default": false
          },
          "requireReconsent": {
            "type": "boolean",
            "description": "Indicates that website visitors should be reprompted with the Consent Management Platform. By default, this is set to ‘False’.",
            "example": false,
            "default": false
          },
          "suppressBannerEnabled": {
            "type": "boolean",
            "description": "Indicates the banner is manually invoked on the page and should be suppressed upon on initial load. Usually used for SPAs. By default, this flag is ‘False’.",
            "example": false,
            "default": false
          },
          "suppressPCEnabled": {
            "type": "boolean",
            "description": "Indicates the pref. Center is fetched only upon website visitor interaction with the banner. By default, this flag is ‘False’.",
            "example": false,
            "default": false
          }
        },
        "title": "ScriptPublishRequestDto",
        "description": "Publishes the production or test script for the website that is passed. All available settings for publishing will by default use the saved values from the last publish if not specified."
      }
    }
  }
}
```