> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zixflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Custom Attribute

> This endpoint creates a new attribute for a specified target (collection or list).

#### Description

This API endpoint allows the creation of a new attribute within a specified target, either a collection or a list. Attributes define the nature and characteristics of the data stored within the target.

#### Path

<ParamField path="target" type="string" required>
  Specifies the target type, which can be either "collection" or "list."
</ParamField>

<ParamField path="targetId" type="string" required>
  A unique identifier for the target, either a collection ID or a list ID, depending on the target type.
</ParamField>

#### Body

<ParamField body="apiKeyName" type="string" required>
  The API key name used to store data in the collection or list for this field.
</ParamField>

<ParamField body="inputType" type="string" required>
  Defines the input type or nature of the field. Possible values include text, number, checkbox, currency, date, timestamp, rating, status, select, multiselect, record-reference, actor-reference, domain, file, ai-wizard, email-address, phone-number.
</ParamField>

<ParamField body="name" type="string" required>
  The human-readable name of the field.
</ParamField>

<ParamField body="config" type="object" required>
  Configuration settings for the attribute, including currency display type, currency code, record reference, AI wizard, and date display type.

  <Expandable title="config">
    <ParamField body="currencyDisplayType" type="string">
      Accepted values: "code," "name," "narrowSymbol," "symbol." Specifies how currency should be displayed.
    </ParamField>

    <ParamField body="currencyCode" type="string">
      The currency code (e.g., "EUR," "GBP," "USD," "CAD," "AUD").
    </ParamField>

    <ParamField body="recordReference" type="array_string">
      An array of collection IDs connected to this attribute.
    </ParamField>

    <ParamField body="aiWizard" type="string">
      The AI wizard field prompt.
    </ParamField>

    <ParamField body="dateDisplayType" type="string">
      Defines how to display the date field.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="defaultValue" type="string">
  The default value for the attribute.
</ParamField>

<ParamField body="description" type="string">
  A description providing additional information about the attribute.
</ParamField>

<ParamField body="isEditable" type="boolean">
  Indicates whether the attribute is editable (true/false).
</ParamField>

<ParamField body="isMultiSelect" type="boolean">
  Indicates whether the attribute supports multiple selections (true/false).
</ParamField>

<ParamField body="isRequired" type="boolean">
  Indicates whether the attribute is required (true/false).
</ParamField>

<ParamField body="isUnique" type="boolean">
  Indicates whether the attribute values must be unique (true/false).
</ParamField>

<ParamField body="validation" type="string">
  The validation type for the attribute. Possible values include "none," "email," "url," "phone," "customRegex."
</ParamField>

#### Response

<ResponseField name="status" type="boolean">
  Indicates the success or failure of the attribute creation. In this case,
  true signifies a successful operation.
</ResponseField>

<ResponseField name="message" type="string">
  Provides a human-readable message accompanying the response. In this instance,
  it confirms the successful creation of the attribute.
</ResponseField>

<ResponseField name="data" type="object">
  An object containing details of the newly created attribute:

  <Expandable title="data">
    <ResponseField name="_id" type="string">
      A unique identifier for the attribute, allowing for precise referencing.
    </ResponseField>

    <ResponseField name="apiKeyName" type="string">
      The API key name used to store data in the collection or list for this field.
    </ResponseField>

    <ResponseField name="inputType" type="string">
      Defines the input type or nature of the field.
    </ResponseField>

    <ResponseField name="name" type="string">
      The human-readable name of the field.
    </ResponseField>

    <ResponseField name="config" type="object">
      Configuration settings for the attribute.
    </ResponseField>

    <ResponseField name="defaultValue" type="string">
      The default value for the attribute.
    </ResponseField>

    <ResponseField name="description" type="string">
      A description providing additional information about the attribute.
    </ResponseField>

    <ResponseField name="isEditable" type="boolean">
      Indicates whether the attribute is editable.
    </ResponseField>

    <ResponseField name="isMultiSelect" type="boolean">
      Indicates whether the attribute supports multiple selections.
    </ResponseField>

    <ResponseField name="isRequired" type="boolean">
      Indicates whether the attribute is required.
    </ResponseField>

    <ResponseField name="isUnique" type="boolean">
      Indicates whether the attribute values must be unique.
    </ResponseField>

    <ResponseField name="validation" type="string">
      The validation type for the attribute.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200-Success theme={null}
  {
      "status": true,
      "message": "success",
      "data": {
          "_id": "64ad815b273e66dae1afe10f",
          "apiKeyName": "name",
          "inputType": "text",
          "name": "Name",
          "config": {
              "currencyDisplayType": null,
              "currencyCode": null,
              "recordReference": [],
              "aiWizard": null,
              "dateDisplayType": null
          },
          "defaultValue": null,
          "description": "",
          "isEditable": true,
          "isMultiSelect": false,
          "isRequired": false,
          "isUnique": false,
          "validation": "none"
      }
  }
  ```

  ```json 401-Unauthorised theme={null}
  {
    "status": false,
    "message": "No token provided"
  }
  ```
</ResponseExample>
