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

# Create or Update Domain Group

Use this API to create a new domain group or update an existing domain group.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0",
    "title": "Consent & Preferences - Cookie Consent (Swagger)"
  },
  "paths": {
    "/v1/domains/{domainId}/domaingroup": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Create or Update Domain Group",
        "description": "Use this API to create a new domain group or update an existing domain group.",
        "operationId": "createDomainGroupUsingPOST",
        "parameters": [
          {
            "in": "path",
            "name": "domainId",
            "description": "ID of the domain in OneTrust Admin Portal. This string is obtained from the URL on the specific pages in OneTrust Admin Portal relating to that domain. (Example- The script page or the scan results page for that domain.)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "removeExisting": {
                    "type": "boolean",
                    "description": "Flag to remove all domains from an existing group. Passing False instructs the API to append the incoming URL list to the existing one."
                  },
                  "urls": {
                    "type": "array",
                    "default": [],
                    "description": "A list of urls to be added to the group.",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. \n\n**Possible reason**: Incorrect domain Id or if removeExisting flag is false and a url from the list is already there in the group"
          }
        },
        "security": [
          {
            "apikey": []
          },
          {
            "oauth2": [
              "COOKIE"
            ]
          }
        ]
      }
    }
  },
  "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."
            }
          }
        }
      }
    }
  }
}
```