Create a contact field

Request

POST https://api.connectif.cloud/contact-fields/

Request body

The request body takes a complete ContactFieldCreate resource, containing the following writable properties:

{
    "defaultCountryCode": "string",
    "defaultValue": {},
    "id": "string",
    "maxDate": "string",
    "maxLength": "number",
    "maxValue": "number",
    "minDate": "string",
    "minValue": "number",
    "name": "string",
    "options": [
        {
            "id": "string",
            "label": "string"
        }
    ],
    "required": "boolean",
    "type": "string"
}

Properties

Name Type Description Additional
defaultCountryCode string

The default country code of the phone field. Required when the field type is "phone". Not allowed for other field types. Must be a valid phone country code (e.g. "1", "34", "44").

Optional
defaultValue object

The default value of the field. Required when the field is required, and cannot be an empty string for required text fields. Not allowed for email and phone fields. The accepted type depends on the field type: string for text and radio, number for integer and decimal (must be an integer for integer fields), boolean for boolean, ISO 8601 date string for date, and an array of unique strings for checkbox. For radio fields, the value must match one of the provided option ids. For checkbox fields, all items must match valid option ids.

Optional
id string

The id of the field. Must start with a letter and contain only letters, numbers, hyphens, underscores, and brackets. The value "id" is reserved. Maximum length is 150 characters.

maxDate string

The maximum valid date of a date field. Only allowed when the field type is "date". Must be a UTC date in ISO 8601 format. Must be greater than or equal to minDate when both are provided. Not allowed for other field types.

Optional
maxLength number

The max length of the text field value. Only allowed when the field type is "text". Must be an integer between 1 and 5000. Not allowed for other field types.

Optional
maxValue number

The maximum valid value of the field. Only allowed when the field type is "integer" or "decimal". Must be an integer for integer fields. Must be greater than or equal to minValue when both are provided. Not allowed for other field types.

Optional
minDate string

The minimum valid date of a date field. Only allowed when the field type is "date". Must be a UTC date in ISO 8601 format. Must be less than or equal to maxDate when both are provided. Not allowed for other field types.

Optional
minValue number

The minimum valid value of the field. Only allowed when the field type is "integer" or "decimal". Must be an integer for integer fields. Must be less than or equal to maxValue when both are provided. Not allowed for other field types.

Optional
name string

The name of the field. Maximum length is 200 characters.

options[] array

The allowed options of the field. Required when the field type is "checkbox" or "radio". Must contain at least 1 and at most 120 options. Each option id must be unique and have a maximum length of 50 characters. Each option label has a maximum length of 320 characters. Not allowed for other field types.

Optional
options[].id string

The identifier of the option

options[].label string

The label of the option

required boolean

Indicates if the field is required. When a field is required, a contact must always have a value for that field and a default value must be provided. Must be true for boolean and checkbox fields. Must be false for email and phone fields.

type string

The type of the field

Possible values are:

  • text
  • integer
  • decimal
  • boolean
  • date
  • radio
  • checkbox
  • phone
  • email

Authorization

This request requires the use of one of following authorization methods: API key .

Response

The following HTTP status codes may be returned, optionally with a response resource.

Status code Description Resource
201 Created

Success.

ContactField
400 Bad Request

Bad request.

HttpError
401 Unauthorized

Not authorized to access API.

403 Forbidden

Permission not granted to the API Key or account has been blocked.

HttpError
409 Conflict

Contact field already exists.

HttpError
422 Unprocessable Entity

Resource contains validation errors.

HttpUnprocessableEntityError
429 Too Many Requests

Requests rate limit reached.