---
title: /form
slug: cms-12/api/form
docTags: 
createdAt: 2026-08-28T13:16:06.833Z
---

{
  "id": "DlvmA4z4AhlLRA-DUCuqt",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/_form/v1/form",
    "servers": [
      {
        "url": "/_form/v1/form",
        "description": "Optimizely Headless Form API"
      }
    ],
    "name": "",
    "description": "",
    "contentType": "multipart/form-data",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json",
            "application/problem+json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [
        {
          "name": "formKey",
          "kind": "required",
          "type": "string",
          "writeOnly": true,
          "description": "",
          "minLength": 1
        },
        {
          "name": "locale",
          "kind": "optional",
          "type": "string",
          "description": ""
        },
        {
          "name": "isFinalized",
          "kind": "optional",
          "type": "boolean",
          "description": ""
        },
        {
          "name": "hostedPageUrl",
          "kind": "optional",
          "type": "string",
          "description": ""
        },
        {
          "name": "submissionKey",
          "kind": "optional",
          "type": "string",
          "nullable": true,
          "description": ""
        },
        {
          "name": "currentStep",
          "kind": "optional",
          "type": "integer<int32>",
          "writeOnly": true,
          "nullable": true,
          "description": "",
          "format": "int32"
        },
        {
          "name": "submittedTime",
          "kind": "optional",
          "type": "string<date-time>",
          "readOnly": true,
          "description": "",
          "format": "date-time"
        },
        {
          "name": "submittedUser",
          "kind": "optional",
          "type": "string",
          "readOnly": true,
          "description": ""
        },
        {
          "name": "submissionData",
          "kind": "optional",
          "type": "map",
          "readOnly": true,
          "description": "",
          "example": "",
          "default": "\r\n        {\r\n            \"__field_uploadFileKey\":\"filename.png, filename1.png\",\r\n            \"__field_textBoxKey\":\"sampleText\",\r\n            \"__field_dateTimeKey\":\"01/01/2024\"\r\n        }\r\n    ",
          "customType": "map<string, string>",
          "schema": []
        },
        {
          "name": "__field_{elementGuid}",
          "kind": "optional",
          "type": "array",
          "writeOnly": true,
          "description": "",
          "example": "",
          "itemType": "string",
          "customType": "string[]",
          "itemExample": "",
          "itemDefault": ""
        },
        {
          "name": "__field_{elementGuid}_file_{fileIndex}",
          "kind": "optional",
          "type": "array",
          "writeOnly": true,
          "description": "",
          "example": "",
          "itemType": "string",
          "customType": "string[]",
          "itemExample": "",
          "itemDefault": ""
        }
      ],
      "oAuthParameters": [
        {
          "id": "Http",
          "name": "Http",
          "kind": "optional",
          "type": "http",
          "description": "Use this scheme if you already have an access token.",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Success",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "SubmitFormResult",
            "schema": [
              {
                "name": "success",
                "kind": "optional",
                "type": "boolean",
                "description": ""
              },
              {
                "name": "submissionKey",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "validationFail",
                "kind": "optional",
                "type": "boolean",
                "description": "",
                "default": false
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "array",
                "description": "",
                "modelRef": "#/components/schemas/SubmitFormMessage",
                "customType": "SubmitFormMessage[]",
                "schema": [
                  {
                    "name": "section",
                    "kind": "optional",
                    "type": "string",
                    "readOnly": true,
                    "nullable": true,
                    "description": ""
                  },
                  {
                    "name": "message",
                    "kind": "optional",
                    "type": "string",
                    "readOnly": true,
                    "description": ""
                  },
                  {
                    "name": "identifier",
                    "kind": "optional",
                    "type": "string",
                    "readOnly": true,
                    "nullable": true,
                    "description": ""
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/SubmitFormResult",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Up7FN592jMhtL3DDkIC2u",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /_form/v1/form \\\n     --header 'accept: application/json' \\\n     --header 'content-type: multipart/form-data' \\\n     --form 'formKey=\"string\"' \\\n     --form 'submissionData=\"{\n     \\\"__field_uploadFileKey\\\":\\\"filename.png, filename1.png\\\",\n     \\\"__field_textBoxKey\\\":\\\"sampleText\\\",\n     \\\"__field_dateTimeKey\\\":\\\"01/01/2024\\\"\n     }\"'"
        },
        {
          "id": "KBXpmk8HLekP2xGdFjoQm",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"multipart/form-data\");\n\nvar formdata = new FormData();\nformdata.append(\"formKey\", \"string\");\nformdata.append(\"submissionData\", \"\\r\\n        {\\r\\n            \\\"__field_uploadFileKey\\\":\\\"filename.png, filename1.png\\\",\\r\\n            \\\"__field_textBoxKey\\\":\\\"sampleText\\\",\\r\\n            \\\"__field_dateTimeKey\\\":\\\"01/01/2024\\\"\\r\\n        }\\r\\n\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: formdata,\n   redirect: 'follow'\n};\n\nfetch(\"/_form/v1/form\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "mkXTh-XoZJE2XbqjZ93ai",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"/_form/v1/form\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"multipart/form-data\"\nform_data = [['formKey', File.open('undefined')],['submissionData', File.open('undefined')]]\nrequest.set_form form_data, 'multipart/form-data'\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "s_O37nEBg7eFDyEuE_55j",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"/_form/v1/form\"\n\npayload = {}\nfiles=[\n\n]\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'multipart/form-data'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload, files=files)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Up7FN592jMhtL3DDkIC2u"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Success\n{\n  \"success\": false,\n  \"submissionKey\": \"\",\n  \"validationFail\": false,\n  \"messages\": [\n    {\n      \"section\": \"\",\n      \"message\": \"\",\n      \"identifier\": \"\"\n    }\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}