---
title: Create custom field
slug: project-api/create-custom-field
docTags: 
createdAt: 2024-06-10T16:48:55.566Z
---

{
  "id": "6lXAwyKXprA4l2Wx9f1qP",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.catenda.com/v2/projects/{project-id}/custom-fields",
    "servers": [
      {
        "url": "https://api.catenda.com/v2/projects/{project-id}/custom-fields"
      }
    ],
    "name": "Create custom field",
    "description": "Add a new custom field.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project-id",
          "type": "string",
          "example": "af2d8af0fa54465b89bf26dd3d92cfd0",
          "description": "Catenda project id"
        }
      ],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "The name of the custom field.",
              "example": "Custom field 1"
            },
            {
              "name": "description",
              "kind": "required",
              "type": "string",
              "description": "Description of the custom field.",
              "example": "Custom field description"
            },
            {
              "name": "type",
              "kind": "required",
              "type": "string<text | integer | double | enumeration | date>",
              "description": "Type of the custom field. Valid values are \"text\", \"integer\", \"double\", \"enumeration\" or \"date\".",
              "example": "text"
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Represents a single custom field.",
            "customType": "custom-field",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "description": "Id of the custom field, represented as compacted UUID using 32 hexadecimal characters.",
                "example": "324409076a694255b589d236517a55da"
              },
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "The name of the custom field.",
                "example": "Custom field name"
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "Description of the custom field.",
                "example": "Custom field description"
              },
              {
                "name": "type",
                "kind": "optional",
                "type": "string<text | integer | double | enumeration | date>",
                "description": "Type of the custom field. Valid values are \"text\", \"integer\", \"double\", \"enumeration\" or \"date\".",
                "example": "text"
              },
              {
                "name": "createdAt",
                "kind": "optional",
                "type": "string",
                "description": "The date and time the custom field was created in ISO 8601 format.",
                "example": "2023-03-06T11:52:45.000Z"
              },
              {
                "name": "createdBy",
                "kind": "optional",
                "type": "string",
                "description": "Id of the user that created the custom field.",
                "example": "624809076a694255b989d236517a55da"
              },
              {
                "name": "archived",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the custom field is archived.",
                "example": false
              },
              {
                "name": "dropdownItems",
                "kind": "optional",
                "type": "array",
                "description": "List of dropdown items for custom fields of type enumeration. Value is null for other custom field types.",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "string",
                    "description": "Id of the custom field, represented as compacted UUID using 32 hexadecimal characters.",
                    "example": ""
                  },
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "description": "Name of the dropdown item",
                    "example": "Dropdown item 1"
                  },
                  {
                    "name": "code",
                    "kind": "optional",
                    "type": "string",
                    "description": "The code of the enumeration item, value is unique for a custom field.",
                    "example": "Item name"
                  },
                  {
                    "name": "disabled",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "Whether the enumeration item is disabled.",
                    "example": false
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/custom-field",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "mOzSQ3oftvsFADhByMrrG",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.catenda.com/v2/projects/{project-id}/custom-fields \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"Custom field 1\",\n     \"description\": \"Custom field description\",\n     \"type\": \"text\"\n     }'"
        },
        {
          "id": "ldG5VSYcSGL76zH1-_jr5",
          "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\": \"Custom field 1\",\n   \"description\": \"Custom field description\",\n   \"type\": \"text\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.catenda.com/v2/projects/{project-id}/custom-fields\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "wFqOVUrGFpa0kZW5jnaEo",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.catenda.com/v2/projects/{project-id}/custom-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\": \"Custom field 1\",\n   \"description\": \"Custom field description\",\n   \"type\": \"text\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ZJhOuYhva97LGHuwOCcET",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.catenda.com/v2/projects/{project-id}/custom-fields\"\n\npayload = json.dumps({\n   \"name\": \"Custom field 1\",\n   \"description\": \"Custom field description\",\n   \"type\": \"text\"\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": "mOzSQ3oftvsFADhByMrrG"
    },
    "results": {
      "languages": [
        {
          "id": "VxGr6eZNBHeHl9uMq9wKm",
          "language": "200",
          "code": "// OK\n{\n  \"id\": \"324409076a694255b589d236517a55da\",\n  \"name\": \"Custom field name\",\n  \"description\": \"Custom field description\",\n  \"type\": \"text\",\n  \"createdAt\": \"2023-03-06T11:52:45.000Z\",\n  \"createdBy\": \"624809076a694255b989d236517a55da\",\n  \"archived\": false,\n  \"dropdownItems\": [\n    {\n      \"id\": \"\",\n      \"name\": \"Dropdown item 1\",\n      \"code\": \"Item name\",\n      \"disabled\": false\n    }\n  ]\n}"
        }
      ],
      "selectedLanguageId": "VxGr6eZNBHeHl9uMq9wKm"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}