---
title: Create content and a page using the REST API
slug: cms-saas/docs/create-content-and-a-page-using-the-api
docTags: 
createdAt: 2026-07-30T20:18:10.000Z
---

Setting up an Optimizely Content Management System (SaaS) instance through the REST API offers a flexible and programmatic approach to configuring your content structure. With the REST API, you can automate the creation of content types, define properties, and manage content items. This method is ideal for developers who want to integrate CMS (SaaS) configuration into their existing workflows or need to perform bulk operations.

The REST API lets you script and customize all aspects of your CMS (SaaS) instance, giving you full control over content model definition and deployment. This enables efficient configuration and integration with other systems through API calls.

The content resource is the primary resource type of CMS (SaaS). Content can represent webpages, components, media, and almost any other type. A content item holds data in a structured way described by a schema defined by the content type. Every content item is an instance of a content type.

Before creating your first content item, you define a [content type](docId\:IIrc48HRxDZe6C7wiVBVT). A content type describes a content item's characteristics and data model schema. Before you create your content types, you must develop a content model. Content modeling helps provide a framework for how your content is structured in CMS (SaaS). See [Content modeling](docId\:DxD5knGJxoI1rg9rI8rBb).

## Prerequisites

- Generate a token. See [Authentication and authorization](docId:2uVhCnJr4BdL9e5UNkN4L) for information.
- Run the following REST API calls using a REST client such as Postman or Insomnia.

## Create a content type

Use the [Create content type](docId\:WFhEMMql5Y0x5-zT_t6df) endpoint to create a `Page` [content type](docId\:IIrc48HRxDZe6C7wiVBVT).

```http
POST https://api.cms.optimizely.com/v1/contenttypes
Content-Type: application/json
```

```json
{
    "key": "examplePage",
    "baseType": "_page",
    "displayName": "Example page",
    "properties": {
        "heading": {
            "type": "string",
            "displayName": "Heading",
            "group": "Content"
        }
    }
}
```

## Create a page

Use the [Create content](docId\:p9XgSvFtr8nSot5JGYOq0) endpoint to create an example page using the `Page` content type you just created.

```http
POST https://api.cms.optimizely.com/v1/content
Content-Type: application/json
```

```json
{
    "key": "019003fe597f70c8b9b5f6231c74ed96",
    "contentType": "examplePage",
    "container": "43f936c99b234ea397b261c538ad07c9",
    "initialVersion": {
        "displayName": "Hello world!",
        "locale": "en",
        "properties": {
            "heading": {
                "value": "Hello, everyone!"
            }
        }
    }
}
```

- **Key** – Any universally unique identifier (UUID) with the same number of numbers.

:::hint{type="warning"}
**Important**
UUIDs include hyphens (-). Remove hyphens from the key when querying to avoid errors.
:::

- **Container** – UUID of the **Root** on the **Settings** tab of the [All Properties editing view](docId\:PNu5GCyhm3OF7lElAjY1Q).

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/T2nShgngLiOOKgvquPDsg_4ef8169c45d595a430df449163cefcaf12521c46a1484229abd0f033e13ec267-image.png)

## Define a website and host

1. Go to **Settings** > **Manage Websites**.
2. Click **Create Website** and add a name and the URL that you use for your frontend.
3. Select the **Hello World!** page you created as your start page.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/oTwNzfdOkmUTug3CccvmZ_36c447607b4276d38758f7c77a132225cc672a960b33cbdb21beb262ce0ea5ff-image.png)

4. Click **Add Host** and copy the hostname of your instance into the **Host Name** field. The value should not include the scheme (`https://`) or the path.
5. Select **Edit** for the **Type** and **HTTPS** for **Scheme**.
6. Click **Add Host**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/NDZpCJxYuBjXrD_mV_i6E_811f101-image.png)

7. Click **Save Website**.

## Run the Optimizely Graph sync job

:::hint{type="success"}
**Beta**
This step is currently required to ensure that indexing works. However, this requirement is expected to be removed during the beta phase.
:::

Before you can access the content externally, you must sync the content with Optimizely Graph.

Go to **Settings** > **Scheduled Jobs** and start the **Optimizely Graph Full Synchronization**.

## Retrieve content using Optimizely Graph

Go to **Optimizely Graph** to retrieve your page using a GraphQL query.

Add the following query in the **GraphiQL** interface:

```text
{
  examplePage
	{
    items
    {
      Name,
      Status,
      Heading
    }
  }
}
```

The result is similar to the following:

```text
{
  "data": {
    "examplePage": {
      "items": [
        {
          "Name": "Hello World!",
          "Status": "Published",
          "Heading": "Hello, everyone!"
        }
      ]
    }
  },
  "extensions": {
    "correlationId": "814a782fbff65d32",
    "cost": 23,
    "costSummary": [
      "examplePage(23) = limit(20) + fields(3)"
    ]
  }
}
```

See [Get started with Optimizely Graph](docId\:iUH263_KGLDrFGKRdWfrm).

## Create a complete site

After you see the basic components in play, you can build your frontend based on CMS (SaaS).

For demonstrations that use popular serverless platforms to host websites, see [Create a demo site using CMS (SaaS) and Vercel](https://github.com/episerver/cms-saas-vercel-demo) and [Create a demo site using CMS (SaaS) and Netlify](https://docs.developers.optimizely.com/content-management-system/v1.0.0-CMS-SaaS/docs/sample-site-with-netlify).
