Request

Creates a component.

Security
Bearer
Query
environmentIdstring

The environment identifier.

Example:environmentId=main
Bodyrequired

Details of the component to create.

categoryobject(ComponentCategoryInput)required

Details of the component category.

namestring, [ 0 .. 50 ] characters^(?![\s-])[a-zA-Z0-9_\s-]*(?<!\s)$required

The component name. Letters, numbers, spaces, underscores, and hyphens only.

Example:"Promo"
displayNamestring or null, [ 0 .. 50 ] characters

The component display name.

Example:"Promo"
iconUrlstring or null

The component icon URL.

Example:"Office/32x32/window_dialog.png"
modelIdstring or null

The content type ID.

Example:"dfed4457-d760-457a-bec1-c0dccdc44381"
renderingParametersArray of objects or null(RenderingParameterInput)

The component rendering parameters.

settingsobject or null

The component settings.

Example:
{ "IsRenderingsWithDynamicPlaceholders": "true", "RandomNumber": "10" }
descriptionstring or null

The component description.

Example:"This is a promo component."
availabilityobject(AvailabilityInput)

Represents the availability constraints for a component, specifying which sites, placeholders, and page models the component can be used with.

curl -i -X POST \
  'https://edge-platform.sitecorecloud.io/authoring/api/v1/components?environmentId=main' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Promo",
    "displayName": "Promo",
    "category": {
      "id": "ae070691-099d-4081-856c-4c4a7e3543df",
      "name": "Page Content"
    },
    "iconUrl": "Office/32x32/window_dialog.png",
    "modelId": "dfed4457-d760-457a-bec1-c0dccdc44381",
    "renderingParameters": [
      {
        "name": "Promo",
        "displayName": "Promo",
        "editingControl": {
          "type": "Single-Line Text",
          "value": "Placeholder text"
        }
      }
    ],
    "settings": {
      "IsRenderingsWithDynamicPlaceholders": "true",
      "RandomNumber": "10"
    },
    "description": "This is a promo component.",
    "availability": {
      "sites": [
        "4f2d7c8b9e1a4f0d8f3c2b176a4e9d22",
        "c1378a9fe2bd4e56a1c4d9f87b33a6c4"
      ],
      "placeholders": [
        "4f2d7c8b9e1a4f0d8f3c2b176a4e9d22",
        "c1378a9fe2bd4e56a1c4d9f87b33a6c4"
      ],
      "pageModels": [
        "4f2d7c8b9e1a4f0d8f3c2b176a4e9d22",
        "c1378a9fe2bd4e56a1c4d9f87b33a6c4"
      ]
    }
  }'

Responses

Successful operation. The variants array in the response body will be empty on create as no variants exist yet

Bodyapplication/json
idstring or null

The identifier of the component.

Example:"2492bac4-da07-4c86-87f0-9873d40e2276"
namestring or null

The name of the component.

Example:"Hero Banner"
displayNamestring or null

The component displayName.

Example:"Banner"
systemNamestring or null

The component system name.

Example:"HeroBanner"
descriptionstring or null

The component description.

Example:"A promo component is a content block designed to showcase promotions using a combination of text and visuals"
categoryobject(ComponentCategory)
iconstring or null

The component icon URL.

Example:"https://xmc-instance.sitecore-staging.cloud/-/icon/SXA_MDI/16x16/Promo.png"
datasourceTemplateFieldstring or null

Datasource template item path.

Example:"/sitecore/templates/Feature/Promos"
modelIdstring or null

The content type identifier.

Example:"/sitecore/templates/Feature/Promos"
renderingParametersobject or null

The component rendering parameters.

Example:
{ "ButtonText": "Click me!" }
settingsobject or null

The component settings.

Example:
{ "IsRenderingsWithDynamicPlaceholders": "true", "RandomNumber": "10" }
variantsArray of objects or null(ComponentVariant)

The component variants.

Example:
[ { "name": "Default", "id": "2492bac4-da07-4c86-87f0-9873d40e2276", "siteId": "497f6eca-6276-4993-bfeb-53cbbbba6f08" }, { "name": "Advanced", "id": "2f34355e-c52d-450e-b1b9-d4e9cbe64af2", "siteId": "497f6eca-6276-4993-bfeb-53cbbbba6f08" } ]
systemobject(System)
typestring(ComponentType)

Specifies the type of a component based on its rendering template.

Enum:"Code""Hosted"
Response
{ "id": "2492bac4-da07-4c86-87f0-9873d40e2276", "name": "Hero Banner", "displayName": "Banner", "systemName": "HeroBanner", "description": "A promo component is a content block designed to showcase promotions using a combination of text and visuals", "category": { "id": "ae070691-099d-4081-856c-4c4a7e3543df", "name": "Page Content", "path": "/sitecore/content/Tenant/Site/Home/Categories/Page-Content" }, "icon": "https://xmc-instance.sitecore-staging.cloud/-/icon/SXA_MDI/16x16/Promo.png", "datasourceTemplateField": "/sitecore/templates/Feature/Promos", "modelId": "/sitecore/templates/Feature/Promos", "renderingParameters": { "ButtonText": "Click me!" }, "settings": { "IsRenderingsWithDynamicPlaceholders": "true", "RandomNumber": "10" }, "variants": [ { … }, { … } ], "system": { "created": "2023-01-01T00:00:00Z", "createdBy": "sitecore admin", "updated": "2023-01-01T00:00:00Z", "updatedBy": "sitecore admin" }, "type": "Code" }