---
title: Create a Page
slug: feature-experimentation/api/create-a-page
docTags: 
createdAt: 2026-10-01T19:58:02.336Z
---

{
  "id": "UlB4a06G5Z3fQEI8d1UId",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.optimizely.com/v2/pages",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/pages"
      }
    ],
    "name": "Create a Page",
    "description": "Create a new Page in a provided Project",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "A string in JSON format that includes all the fields to create a Page",
          "customType": "Page",
          "schema": [
            {
              "name": "activation_code",
              "kind": "optional",
              "type": "string",
              "description": "<p>Stringified Javascript function that determines when the Page is activated. Only required when activation_type is 'polling' or 'callback'.</p>",
              "example": "function callbackFn(activate, options) { activate(); }"
            },
            {
              "name": "activation_type",
              "kind": "optional",
              "type": "string<immediate | manual | polling | callback | dom_changed | url_changed>",
              "description": "<p>Page activation type is a trigger that determines when the page is activated. Triggers tell Optimizely when to start checking whether certain conditions are true\n'Immediate' activation mode activates the page as soon as the snippet loads.\n'Polling' activation mode polls every 50ms until 'activation_code' evaluates to True, then activates the page.\n'Callback' activation mode activates the page when the event defined by 'activation_code' is triggered.\n'Manual' activation mode requires code within the subject app to explicitly trigger page activation.\n'DOM Changed' sets the page to trigger when the DOM changes <a href=\"https://help.optimizely.com/Build_Campaigns_and_Experiments/Support_for_dynamic_websites%3A_Use_Optimizely_on_single_page_applications#Triggers\" target=\"_blank\">Learn more</a>.\n'URL Changed' sets the page to trigger when the URL changes <a href=\"https://help.optimizely.com/Build_Campaigns_and_Experiments/Support_for_dynamic_websites%3A_Use_Optimizely_on_single_page_applications#Triggers\">Learn more</a>.</p>",
              "example": "callback",
              "enum": [
                "immediate",
                "manual",
                "polling",
                "callback",
                "dom_changed",
                "url_changed"
              ]
            },
            {
              "name": "archived",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether the Page has been archived",
              "default": false
            },
            {
              "name": "category",
              "kind": "optional",
              "type": "string<article | cart | category | checkout | home | landing_page | pricing | product_detail | search_results | other>",
              "description": "The category this Page is grouped under",
              "default": "other",
              "enum": [
                "article",
                "cart",
                "category",
                "checkout",
                "home",
                "landing_page",
                "pricing",
                "product_detail",
                "search_results",
                "other"
              ]
            },
            {
              "name": "conditions",
              "kind": "optional",
              "type": "string",
              "description": "<p>Stringified array of the conditions that activate the Page. The array contains Page Condition JSON dicts joined by \"and\" and \"or\".\nEach individual Page Condition dict has format {\"type\": \"url\", \"match_type\": &#x3C;match_type>, \"value\": } where match_types are:\n\"simple\" match type will match if \"value\" matches the hostname and path of the Page URL.\n\"exact\" match type will match only an exact string match between \"value\" and the Page URL.\n\"substring\" match type will match if \"value\" is a substring of the Page URL.\n\"regex\" match type will match if \"value\" is a regular expression match for the Page URL.</p>",
              "example": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]"
            },
            {
              "name": "edit_url",
              "kind": "required",
              "type": "string",
              "description": "URL of the Page",
              "example": "https://www.optimizely.com"
            },
            {
              "name": "key",
              "kind": "optional",
              "type": "string",
              "description": "Unique string identifier for this Page within the Project",
              "example": "home_page",
              "maxLength": 500,
              "pattern": "^[a-zA-Z0-9_]+$"
            },
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "Name of the Page",
              "example": "Home Page"
            },
            {
              "name": "page_type",
              "kind": "optional",
              "type": "string<single_url | url_set | global>",
              "description": "Type of Page",
              "enum": [
                "single_url",
                "url_set",
                "global"
              ]
            },
            {
              "name": "project_id",
              "kind": "required",
              "type": "integer<int64>",
              "description": "ID of the Page's Project",
              "example": 1000,
              "format": "int64"
            }
          ],
          "modelRef": "#/components/schemas/Page",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Return the created Page",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Page",
            "schema": [
              {
                "name": "activation_code",
                "kind": "optional",
                "type": "string",
                "description": "<p>Stringified Javascript function that determines when the Page is activated. Only required when activation_type is 'polling' or 'callback'.</p>",
                "example": "function callbackFn(activate, options) { activate(); }"
              },
              {
                "name": "activation_type",
                "kind": "optional",
                "type": "string<immediate | manual | polling | callback | dom_changed | url_changed>",
                "description": "<p>Page activation type is a trigger that determines when the page is activated. Triggers tell Optimizely when to start checking whether certain conditions are true\n'Immediate' activation mode activates the page as soon as the snippet loads.\n'Polling' activation mode polls every 50ms until 'activation_code' evaluates to True, then activates the page.\n'Callback' activation mode activates the page when the event defined by 'activation_code' is triggered.\n'Manual' activation mode requires code within the subject app to explicitly trigger page activation.\n'DOM Changed' sets the page to trigger when the DOM changes <a href=\"https://help.optimizely.com/Build_Campaigns_and_Experiments/Support_for_dynamic_websites%3A_Use_Optimizely_on_single_page_applications#Triggers\" target=\"_blank\">Learn more</a>.\n'URL Changed' sets the page to trigger when the URL changes <a href=\"https://help.optimizely.com/Build_Campaigns_and_Experiments/Support_for_dynamic_websites%3A_Use_Optimizely_on_single_page_applications#Triggers\">Learn more</a>.</p>",
                "example": "callback",
                "enum": [
                  "immediate",
                  "manual",
                  "polling",
                  "callback",
                  "dom_changed",
                  "url_changed"
                ]
              },
              {
                "name": "archived",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the Page has been archived",
                "default": false
              },
              {
                "name": "category",
                "kind": "optional",
                "type": "string<article | cart | category | checkout | home | landing_page | pricing | product_detail | search_results | other>",
                "description": "The category this Page is grouped under",
                "default": "other",
                "enum": [
                  "article",
                  "cart",
                  "category",
                  "checkout",
                  "home",
                  "landing_page",
                  "pricing",
                  "product_detail",
                  "search_results",
                  "other"
                ]
              },
              {
                "name": "conditions",
                "kind": "optional",
                "type": "string",
                "description": "<p>Stringified array of the conditions that activate the Page. The array contains Page Condition JSON dicts joined by \"and\" and \"or\".\nEach individual Page Condition dict has format {\"type\": \"url\", \"match_type\": &#x3C;match_type>, \"value\": } where match_types are:\n\"simple\" match type will match if \"value\" matches the hostname and path of the Page URL.\n\"exact\" match type will match only an exact string match between \"value\" and the Page URL.\n\"substring\" match type will match if \"value\" is a substring of the Page URL.\n\"regex\" match type will match if \"value\" is a regular expression match for the Page URL.</p>",
                "example": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]"
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Date created",
                "format": "date-time"
              },
              {
                "name": "edit_url",
                "kind": "required",
                "type": "string",
                "description": "URL of the Page",
                "example": "https://www.optimizely.com"
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The unique identifier of the Page",
                "example": 4000,
                "format": "int64"
              },
              {
                "name": "key",
                "kind": "optional",
                "type": "string",
                "description": "Unique string identifier for this Page within the Project",
                "example": "home_page",
                "maxLength": 500,
                "pattern": "^[a-zA-Z0-9_]+$"
              },
              {
                "name": "last_modified",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Date last modified",
                "format": "date-time"
              },
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": "Name of the Page",
                "example": "Home Page"
              },
              {
                "name": "page_type",
                "kind": "optional",
                "type": "string<single_url | url_set | global>",
                "description": "Type of Page",
                "enum": [
                  "single_url",
                  "url_set",
                  "global"
                ]
              },
              {
                "name": "project_id",
                "kind": "required",
                "type": "integer<int64>",
                "description": "ID of the Page's Project",
                "example": 1000,
                "format": "int64"
              },
              {
                "name": "single_use",
                "kind": "optional",
                "type": "boolean",
                "readOnly": true,
                "description": "<p>Whether the Page is a single-use page created for URL targeting</p>"
              }
            ],
            "modelRef": "#/components/schemas/Page",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "pAFW6K-8DaCi7Fzx-j3Rs",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.optimizely.com/v2/pages \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"category\": \"other\",\n     \"edit_url\": \"https://www.optimizely.com\",\n     \"name\": \"Home Page\",\n     \"project_id\": 1000\n     }'"
        },
        {
          "id": "tgJpVMwx7weNKCQds58WR",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"category\": \"other\",\n   \"edit_url\": \"https://www.optimizely.com\",\n   \"name\": \"Home Page\",\n   \"project_id\": 1000\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/pages\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "AKhXLkYZ6mDAEQY5Lci5W",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/pages\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"category\": \"other\",\n   \"edit_url\": \"https://www.optimizely.com\",\n   \"name\": \"Home Page\",\n   \"project_id\": 1000\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "-z4IShWDAII8nchFJq5fZ",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/pages\"\n\npayload = json.dumps({\n   \"category\": \"other\",\n   \"edit_url\": \"https://www.optimizely.com\",\n   \"name\": \"Home Page\",\n   \"project_id\": 1000\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "pAFW6K-8DaCi7Fzx-j3Rs"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Return the created Page\n{\n  \"activation_code\": \"function callbackFn(activate, options) { activate(); }\",\n  \"activation_type\": \"callback\",\n  \"archived\": false,\n  \"category\": \"\",\n  \"conditions\": \"[\\\"and\\\", {\\\"type\\\": \\\"url\\\", \\\"match_type\\\": \\\"substring\\\", \\\"value\\\": \\\"optimize\\\"}]\",\n  \"created\": \"\",\n  \"edit_url\": \"https://www.optimizely.com\",\n  \"id\": 4000,\n  \"key\": \"home_page\",\n  \"last_modified\": \"\",\n  \"name\": \"Home Page\",\n  \"page_type\": \"\",\n  \"project_id\": 1000,\n  \"single_use\": false\n}"
        },
        {
          "id": "response-1-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}