Organization API: Customers: Custom fields
The 3 Organization API operations for custom fields.
Part of Customers.
Operations
Section titled Operations| Method | Path | Summary |
|---|---|---|
| GET | /api/v1/orgs/{org_slug}/custom-fields |
List custom fields |
| POST | /api/v1/orgs/{org_slug}/custom-fields |
A field the brand keeps on its customers, services or products |
| DELETE | /api/v1/orgs/{org_slug}/custom-fields/{field_id} |
Delete a custom field |
List custom fields
Section titled List custom fieldsGET /api/v1/orgs/{org_slug}/custom-fields
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
org_slug |
path | string | yes |
applies_to |
query | string | no |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
A 200 response is a list; each item has these fields:
| Field | Type |
|---|---|
[].id |
integer |
[].org_id |
integer |
[].field_name |
string |
[].label |
string |
[].field_type |
string |
[].applies_to |
string |
[].validation_rules |
object or null |
[].options |
array of any or null |
[].default_value |
string or null |
[].required |
boolean |
[].is_indexed |
boolean |
[].sort_order |
integer |
[].created_at |
string (date-time) or null |
A field the brand keeps on its customers, services or products
Section titled A field the brand keeps on its customers, services or productsPOST /api/v1/orgs/{org_slug}/custom-fields
A field the brand keeps on its customers, services or products. Admins
and the owner. 400 Invalid field_type or Invalid applies_to value for a word outside the lists; 409 when the organization already
has a field of that name on the same records, since values are stored
under the name. Audited as custom_field.created.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
field_name |
string | yes |
label |
string | yes |
field_type |
string | yes |
applies_to |
string | yes |
validation_rules |
object or null | no |
options |
array of any or null | no |
default_value |
string or null | no |
required |
boolean | no |
Responses
Section titled Responses| Status | Meaning |
|---|---|
201 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 201 response:
| Field | Type |
|---|---|
id |
integer |
org_id |
integer |
field_name |
string |
label |
string |
field_type |
string |
applies_to |
string |
validation_rules |
object or null |
options |
array of any or null |
default_value |
string or null |
required |
boolean |
is_indexed |
boolean |
sort_order |
integer |
created_at |
string (date-time) or null |
Delete a custom field
Section titled Delete a custom fieldDELETE /api/v1/orgs/{org_slug}/custom-fields/{field_id}
Delete a custom field. The values records hold under its name stay,
and a field made again with that name shows them. Admins and the owner;
404 for another organization's field. Audited as
custom_field.deleted.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
field_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |