Custom Fields
Add user-defined fields to deals, companies, and contacts. Supports text, number, date, and select field types.
|
Endpoints
| GET | /api/v1/crm/custom-fields | List custom field definitions |
| POST | /api/v1/crm/custom-fields | Create a custom field definition |
| PATCH | /api/v1/crm/custom-fields/{id} | Update a custom field definition |
| DELETE | /api/v1/crm/custom-fields/{id} | Delete a custom field definition |
GET
/api/v1/crm/custom-fieldsList custom field definitions
Retrieve custom field definitions. Optionally filter by resource_type.
Authentication required— Include session cookie or Bearer token
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resource_type | string | Optional | Filter by resource type (deal / company / contact) |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| CustomFieldDefinition[] | Optional | Array of custom field definitions |
Code Examples
curl "https://api.blueai.jp/api/v1/crm/custom-fields" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"definitions": [
{
"id": "cfd_0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a",
"resource_type": "deal",
"name": "契約形態",
"field_type": "select",
"options_json": "[\"年間契約\",\"月額契約\",\"スポット\"]",
"is_required": false,
"sort_order": 0,
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-01-15T09:00:00Z"
},
{
"id": "cfd_0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"resource_type": "company",
"name": "従業員数",
"field_type": "number",
"options_json": null,
"is_required": false,
"sort_order": 1,
"created_at": "2026-01-20T10:00:00Z",
"updated_at": "2026-01-20T10:00:00Z"
}
]
}POST
/api/v1/crm/custom-fieldsCreate a custom field definition
Create a new custom field definition. For select / multi_select types, specify choices as a JSON array in options_json.
Authentication required— Include session cookie or Bearer token
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
resource_type | string | Required | Target resource type (deal / company / contact) |
name | string | Required | Field name |
field_type | string | Required | Field type (text, number, date, select, multi_select, url, email, phone) |
options_json | string | null | Optional | JSON array of options (required for select / multi_select types) |
is_required | boolean | Optional | Set as required field (default: false) |
sort_order | number | Optional | Sort order |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
definition | CustomFieldDefinition | Optional | Created custom field definition |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/crm/custom-fields" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"resource_type": "deal",
"name": "契約形態",
"field_type": "select",
"options_json": "[\"年間契約\",\"月額契約\",\"スポット\"]",
"is_required": false
}'Response Example
{
"definition": {
"id": "cfd_0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a",
"resource_type": "deal",
"name": "契約形態",
"field_type": "select",
"options_json": "[\"年間契約\",\"月額契約\",\"スポット\"]",
"is_required": false,
"sort_order": 0,
"created_at": "2026-02-20T09:00:00Z",
"updated_at": "2026-02-20T09:00:00Z"
}
}PATCH
/api/v1/crm/custom-fields/{id}Update a custom field definition
Update a custom field definition's name, options, required flag, etc. field_type and resource_type cannot be changed.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Custom field ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Optional | Field name |
options_json | string | null | Optional | JSON array of options (null to clear) |
is_required | boolean | Optional | Set as required field |
sort_order | number | Optional | Sort order |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
definition | CustomFieldDefinition | Optional | Updated custom field definition |
Code Examples
curl -X PATCH "https://api.blueai.jp/api/v1/crm/custom-fields/cfd_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"name": "契約タイプ",
"options_json": "[\"年間契約\",\"月額契約\",\"スポット\",\"トライアル\"]",
"is_required": true
}'Response Example
{
"definition": {
"id": "cfd_0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a",
"resource_type": "deal",
"name": "契約タイプ",
"field_type": "select",
"options_json": "[\"年間契約\",\"月額契約\",\"スポット\",\"トライアル\"]",
"is_required": true,
"sort_order": 0,
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-20T11:00:00Z"
}
}DELETE
/api/v1/crm/custom-fields/{id}Delete a custom field definition
Delete a custom field definition and all associated field values.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Custom field ID |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | Deletion success flag |
Code Examples
curl -X DELETE "https://api.blueai.jp/api/v1/crm/custom-fields/cfd_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"success": true
}