カスタムフィールド(Custom Fields)
案件・会社・連絡先にユーザー定義のフィールドを追加します。テキスト・数値・日付・選択肢などの型をサポートします。
|
エンドポイント
| GET | /api/v1/crm/custom-fields | カスタムフィールド定義一覧を取得 |
| POST | /api/v1/crm/custom-fields | カスタムフィールドを定義 |
| PATCH | /api/v1/crm/custom-fields/{id} | カスタムフィールド定義を更新 |
| DELETE | /api/v1/crm/custom-fields/{id} | カスタムフィールド定義を削除 |
GET
/api/v1/crm/custom-fieldsカスタムフィールド定義一覧を取得
組織内のカスタムフィールド定義を取得します。resource_type で絞り込みが可能です。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
クエリパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
resource_type | string | 任意 | リソース種別で絞り込み(deal / company / contact) |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| CustomFieldDefinition[] | 任意 | カスタムフィールド定義の配列 |
コード例
curl "https://api.blueai.jp/api/v1/crm/custom-fields" \
-H "Cookie: better-auth.session_token=<token>"レスポンス例
{
"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-fieldsカスタムフィールドを定義
新しいカスタムフィールド定義を作成します。select / multi_select 型の場合は options_json に選択肢を JSON 配列で指定します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
リクエストボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
resource_type | string | 必須 | 対象リソース種別(deal / company / contact) |
name | string | 必須 | フィールド名 |
field_type | string | 必須 | フィールド型(text, number, date, select, multi_select, url, email, phone) |
options_json | string | null | 任意 | 選択肢の JSON 配列(select / multi_select 型の場合必須) |
is_required | boolean | 任意 | 必須フィールドに設定(デフォルト: false) |
sort_order | number | 任意 | 表示順 |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
definition | CustomFieldDefinition | 任意 | 作成されたカスタムフィールド定義 |
コード例
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
}'レスポンス例
{
"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}カスタムフィールド定義を更新
カスタムフィールド定義の名前・選択肢・必須設定などを更新します。field_type と resource_type は変更できません。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | 必須 | カスタムフィールド ID |
リクエストボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | string | 任意 | フィールド名 |
options_json | string | null | 任意 | 選択肢の JSON 配列(null でクリア) |
is_required | boolean | 任意 | 必須フィールドに設定 |
sort_order | number | 任意 | 表示順 |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
definition | CustomFieldDefinition | 任意 | 更新後のカスタムフィールド定義 |
コード例
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
}'レスポンス例
{
"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}カスタムフィールド定義を削除
カスタムフィールド定義と、それに紐づくすべての値データを削除します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | 必須 | カスタムフィールド ID |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
success | boolean | 任意 | 削除成功フラグ |
コード例
curl -X DELETE "https://api.blueai.jp/api/v1/crm/custom-fields/cfd_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"レスポンス例
{
"success": true
}