---
title: "Create a custom field definition"
method: POST
path: "/v1/custom_field_definitions"
tags: ["Custom Field Definitions"]
---

# Create a custom field definition

`POST /v1/custom_field_definitions`

## Request

- Base URL: `https://api.capacity.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.capacity.com/v1/custom_field_definitions`
- Auth: one of:
  - API key in header `x-capacity-id`
  - HTTP bearer

Create a custom field definition.

## Request body

- object
  - `name` string
  - `custom_field_type_id` integer
  - `custom_field_definition_type_id` integer
  - `is_enabled` boolean
  - `parent_id` integer, nullable
  - `resource_types` object[]: List of resource type configurations
    - `resource_parent_type_id` integer, required: ID of the parent resource type
    - `custom_field_required_event_type_ids` integer[]: List of event type IDs (variant 1)
    - `required_custom_field_event_ids` integer[]: List of event type IDs (variant 2)
  - `choices` object[]: List of key value pairs of custom field definition choices
    - `label` string
    - `value` string
  - `json_schema` object: Schema that allows default value to be overwritten, specifically ranges for numeric and decimal types
  - `placeholder` string
  - `future_only` boolean: Used for datetime types to force future dates only
  - `is_sensitive` boolean
  - `is_value_dependency_enabled` boolean: Denotes whether a child will have values dependent on the parent

## Response `201`

The created custom field definition

- object
  - `body` object: Json body data in the request
  - `parameters` object: Query parameters in the request
  - `result` CustomFieldDefinitionReadSchema
    - `custom_field_name` string: Formatted name of the custom field
    - `custom_field_uuid` string: Formatted UUID of the custom field
    - `custom_field_values` string[]: List of possible values for the custom field
    - `custom_field_type` string: Display name of the custom field type
    - `is_dependent` boolean: Whether this field depends on another custom field
    - `parent_custom_field` object, nullable: Information about the parent custom field (present if dependent)
      - `id` string
      - `name` string
      - `uuid` string
    - `resources` object[]: Grouped resource types to which the field applies
      - `name` string
      - `resource_parent_id` integer
      - `resource_child_ids` integer[]
      - `is_required` boolean

## Other responses

- `400`: The request contains malformed data or violates data integrity

---

[API](https://skmtc.dev/capacity/apis/capacity-api-docs.md) - [All operations](https://skmtc.dev/capacity/apis/capacity-api-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/capacity/apis/capacity-api-docs/revisions/74c85bb61004?raw)
