Request

Creates a site for the environment. Sites are created using site templates. Every site belongs to a site collection. You can either create a site inside an existing collection or create a new one. It is also possible to create a site by duplicating a site.

Security
Bearer
Query
environmentIdstring

The identifier of the environment

Example:environmentId=main
Bodyrequired

Input model

languagestringrequired

The language for the site. If you do not know what languages are available in the environment, first retrieve the list of languages. If the language you want is not available in the environment, add the language first. Example value: en

Example:"en"
siteNamestring, [ 0 .. 100 ] characters^(?![\s-])[a-zA-Z0-9_\s-]*(?<!\s)$required

The name of the site. Example value: skate-park

Default:"string"
Example:"skate-park"
templateIdstring, non-emptyrequired

The ID of the template used to create the site. If you don't know the template ID, first retrieve site templates. Example value: 5aae1eeaea2440bf96f11f43da82c77b

Example:"5aae1eeaea2440bf96f11f43da82c77b"
displayNamestring or null, [ 0 .. 100 ] characters

The display name for the site. Example value: Skate Park Site

Example:"Skate Park Site"
collectionIdstring or null(?i)^(?:[({][0-9A-F]{8}[-]?(?:[0-9A-F]{4}[-]?...

The ID of the collection you want the new site to belong to. If you don't know the collection ID, first retrieve collections. Required if Sitecore.XmApps.Sites.Models.REST.NewSiteInput.CollectionName is not provided. If left empty, you must provide collectionName instead and a new collection will be created along with the newly created site. If both collectionId and collectionName are provided, collectionName will be ignored. Example value: 5aae1eeaea2440bf96f11f43da82c77b

Example:"5aae1eeaea2440bf96f11f43da82c77b"
languagesArray of strings or null

The list of supported languages for the site. Example value: [ "en", "da" ]

Example:
[ "en", "da" ]
hostNamestring or null

Optional hostname for the new site. Default value: * Example value: dev.skate-park.com

Example:"dev.skate-park.com"
descriptionstring or null, [ 0 .. 200 ] characters

Optional text that provides a meaningful description of the site. Example value: New site for Brand A in English-speaking countries.

Example:"New site for Brand A in English-speaking countries."
collectionNamestring or null, [ 0 .. 100 ] characters^(?![\s-])[a-zA-Z0-9_\s-]*(?<!\s)$

The name of the new collection you want the new site to belong to. Required if Sitecore.XmApps.Sites.Models.REST.NewSiteInput.CollectionId is not provided. If left empty, you must provide collectionId of an existing collection you want the new site to belong to. If both collectionId and collectionName are provided, collectionName will be ignored. Example value: Brand A

Example:"Brand A"
collectionDisplayNamestring or null, [ 0 .. 100 ] characters

The display name for the collection. Example value: Skate Park Site

Example:"Skate Park Site"
collectionDescriptionstring or null, [ 0 .. 100 ] characters

If you want to create a new site collection while creating a new site, you can provide a collection description. Example value: Sample description for the site collection containing Sites for Brand A

Example:"Sample description for the site collection containing Sites for Brand A"
posMappingsArray of objects or null(AnalyticsIdentifier)

The site identifier for the site. This identifier lets you control analytics and personalization for the site.

curl -i -X POST \
  'https://xmapps-api.sitecorecloud.io/api/v1/sites?environmentId=main' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "siteName": "skate-park",
    "displayName": "Skate Park Site",
    "templateId": "5aae1eeaea2440bf96f11f43da82c77b",
    "collectionId": "5aae1eeaea2440bf96f11f43da82c77b",
    "language": "en",
    "languages": [
      "en",
      "da"
    ],
    "hostName": "dev.skate-park.com",
    "description": "New site for Brand A in English-speaking countries.",
    "collectionName": "Brand A",
    "collectionDisplayName": "Skate Park Site",
    "collectionDescription": "Sample description for the site collection containing Sites for Brand A",
    "posMappings": [
      {
        "name": "skate-park",
        "language": "en"
      }
    ]
  }'

Responses

Success

Bodyapplication/json
handlestring or null
Response
{ "handle": "string" }