---
title: Create field
slug: data-platform/api/create-field
docTags: 
createdAt: 2026-09-02T14:41:00.110Z
---

{
  "id": "tOeSvH5MqxFnVRUIRXVFF",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields",
    "servers": [
      {
        "url": "https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields",
        "description": "United States"
      },
      {
        "url": "https://api.eu1.odp.optimizely.com/v3/schema/objects/{object_name}/fields",
        "description": "Europe"
      },
      {
        "url": "https://api.au1.odp.optimizely.com/v3/schema/objects/{object_name}/fields",
        "description": "Asia-Pacific"
      }
    ],
    "name": "Create field",
    "description": "<p>Create a field on an object in Optimizely Data Platform (ODP).</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "object_name",
          "type": "string",
          "description": "The name of the object."
        }
      ],
      "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": "",
          "customType": "Field",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "<p>The name of the field (for example, <code>ticket_id</code>).</p>"
            },
            {
              "name": "display_name",
              "kind": "required",
              "type": "string",
              "description": "<p>The human-readable name of the field (for example, Ticket ID).</p>"
            },
            {
              "name": "public_read",
              "kind": "optional",
              "type": "boolean",
              "description": "Enable access with the API public key.",
              "default": false
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "array",
              "description": "Detailed description of the field's purpose.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "type",
              "kind": "required",
              "type": "string<number | timestamp | string | boolean>",
              "description": "<p>An array of relations field data type. Options are <code>number</code>, <code>timestamp</code>, <code>string</code>, <code>boolean</code>.</p>",
              "enum": [
                "number",
                "timestamp",
                "string",
                "boolean"
              ]
            },
            {
              "name": "access_policies",
              "kind": "optional",
              "type": "object",
              "description": "<p>Set access policies, like PII, for the field.</p>",
              "example": "",
              "schema": [
                {
                  "name": "PII",
                  "kind": "optional",
                  "type": "object",
                  "description": "<p>Mark the field as Personally Identifiable Information (PII).</p>",
                  "example": "",
                  "schema": [
                    {
                      "name": "enable",
                      "kind": "optional",
                      "type": "boolean",
                      "description": "<p>Set to <code>true</code> to mark the field as Personally Identifiable Information (PII); <code>false</code> to indicate the field is not PII. Default is <code>true</code>.</p>"
                    },
                    {
                      "name": "suggestible",
                      "kind": "optional",
                      "type": "boolean",
                      "description": "<p>Set to <code>true</code> to enable autosuggestions for the field; <code>false</code> to disable autosuggestions. Default is <code>false</code>.</p>"
                    }
                  ]
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/Field",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "x-api-key",
          "name": "x-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"name\":\"field_name\",\"display_name\":\"Display Name\",\"description\":\"Description of field\",\"type\":\"number\"}",
            "description": "",
            "customType": "Field",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": "<p>The name of the field (for example, <code>ticket_id</code>).</p>"
              },
              {
                "name": "display_name",
                "kind": "required",
                "type": "string",
                "description": "<p>The human-readable name of the field (for example, Ticket ID).</p>"
              },
              {
                "name": "public_read",
                "kind": "optional",
                "type": "boolean",
                "description": "Enable access with the API public key.",
                "default": false
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "array",
                "description": "Detailed description of the field's purpose.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "type",
                "kind": "required",
                "type": "string<number | timestamp | string | boolean>",
                "description": "<p>An array of relations field data type. Options are <code>number</code>, <code>timestamp</code>, <code>string</code>, <code>boolean</code>.</p>",
                "enum": [
                  "number",
                  "timestamp",
                  "string",
                  "boolean"
                ]
              },
              {
                "name": "access_policies",
                "kind": "optional",
                "type": "object",
                "description": "<p>Set access policies, like PII, for the field.</p>",
                "example": "",
                "schema": [
                  {
                    "name": "PII",
                    "kind": "optional",
                    "type": "object",
                    "description": "<p>Mark the field as Personally Identifiable Information (PII).</p>",
                    "example": "",
                    "schema": [
                      {
                        "name": "enable",
                        "kind": "optional",
                        "type": "boolean",
                        "description": "<p>Set to <code>true</code> to mark the field as Personally Identifiable Information (PII); <code>false</code> to indicate the field is not PII. Default is <code>true</code>.</p>"
                      },
                      {
                        "name": "suggestible",
                        "kind": "optional",
                        "type": "boolean",
                        "description": "<p>Set to <code>true</code> to enable autosuggestions for the field; <code>false</code> to disable autosuggestions. Default is <code>false</code>.</p>"
                      }
                    ]
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/Field",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "t89tExZ5L-H9ezNEJgl5-",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"\",\n     \"display_name\": \"\",\n     \"type\": \"\"\n     }'"
        },
        {
          "id": "bnP_KtBNOBTtQ27vwe-X7",
          "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   \"name\": \"\",\n   \"display_name\": \"\",\n   \"type\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "DOKJ_8XuQ-7yUErE8AYF4",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields\")\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   \"name\": \"\",\n   \"display_name\": \"\",\n   \"type\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Rxg3sT0OcxFvHHagL2v6T",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.us1.odp.optimizely.com/v3/schema/objects/{object_name}/fields\"\n\npayload = json.dumps({\n   \"name\": \"\",\n   \"display_name\": \"\",\n   \"type\": \"\"\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": "t89tExZ5L-H9ezNEJgl5-"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"name\": \"\",\n  \"display_name\": \"\",\n  \"public_read\": false,\n  \"description\": [\n    \"\"\n  ],\n  \"type\": \"\",\n  \"access_policies\": {\n    \"PII\": {\n      \"enable\": false,\n      \"suggestible\": false\n    }\n  }\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n{}"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}