会社(Companies)
取引先企業の登録・管理を行います。
|
エンドポイント
| GET | /api/v1/crm/companies | 会社一覧を取得 |
| POST | /api/v1/crm/companies | 会社を作成 |
| GET | /api/v1/crm/companies/{id} | 会社詳細を取得 |
| PATCH | /api/v1/crm/companies/{id} | 会社を更新 |
| DELETE | /api/v1/crm/companies/{id} | 会社を削除 |
GET
/api/v1/crm/companies会社一覧を取得
組織内の会社をページネーション付きで取得します。名前での検索に対応しています。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
クエリパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
limit | integer | 任意 | 1ページあたりの件数(デフォルト: 50、最大: 200) |
offset | integer | 任意 | スキップする件数 |
search | string | 任意 | 会社名での部分一致検索 |
sort | string | 任意 | ソートキー(created_at, name) |
order | string | 任意 | ソート順(asc / desc) |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| Company[] | 任意 | 会社の配列 | |
total | number | 任意 | 総件数 |
limit | number | 任意 | 1ページあたりの件数 |
offset | number | 任意 | スキップした件数 |
コード例
curl "https://api.blueai.jp/api/v1/crm/companies" \
-H "Cookie: better-auth.session_token=<token>"レスポンス例
{
"items": [
{
"id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"name": "株式会社サンプル",
"website": "https://example.com",
"phone": "03-1234-5678",
"address": "東京都渋谷区...",
"industry": "IT",
"email": "info@example.com",
"created_at": "2026-01-10T09:00:00Z",
"updated_at": "2026-02-01T12:00:00Z"
}
],
"total": 18,
"limit": 50,
"offset": 0
}POST
/api/v1/crm/companies会社を作成
新しい会社を登録します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
リクエストボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | string | 必須 | 会社名 |
website | string | 任意 | Webサイト URL |
phone | string | 任意 | 電話番号 |
address | string | 任意 | 住所 |
industry | string | 任意 | 業種 |
email | string | 任意 | 代表メールアドレス |
note | string | 任意 | 備考 |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| Company | 任意 | 作成された会社 |
コード例
curl -X POST "https://api.blueai.jp/api/v1/crm/companies" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"name": "株式会社サンプル",
"website": "https://example.com",
"phone": "03-1234-5678",
"address": "東京都渋谷区...",
"industry": "IT"
}'レスポンス例
{
"company": {
"id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"name": "株式会社サンプル",
"website": "https://example.com",
"phone": "03-1234-5678",
"address": "東京都渋谷区...",
"industry": "IT",
"email": "info@example.com",
"created_at": "2026-01-10T09:00:00Z",
"updated_at": "2026-02-01T12:00:00Z"
}
}GET
/api/v1/crm/companies/{id}会社詳細を取得
指定した会社の詳細情報を取得します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | 必須 | 会社 ID |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| Company | 任意 | 会社の詳細情報 |
コード例
curl "https://api.blueai.jp/api/v1/crm/companies/comp_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"レスポンス例
{
"company": {
"id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"name": "株式会社サンプル",
"website": "https://example.com",
"phone": "03-1234-5678",
"address": "東京都渋谷区...",
"industry": "IT",
"email": "info@example.com",
"created_at": "2026-01-10T09:00:00Z",
"updated_at": "2026-02-01T12:00:00Z"
}
}PATCH
/api/v1/crm/companies/{id}会社を更新
指定した会社の情報を更新します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | 必須 | 会社 ID |
リクエストボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
name | string | 任意 | 会社名 |
website | string | 任意 | Webサイト URL |
phone | string | 任意 | 電話番号 |
address | string | 任意 | 住所 |
industry | string | 任意 | 業種 |
email | string | 任意 | 代表メールアドレス |
note | string | 任意 | 備考 |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
| Company | 任意 | 更新後の会社 |
コード例
curl -X PATCH "https://api.blueai.jp/api/v1/crm/companies/comp_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"name": "株式会社サンプル(更新)",
"phone": "03-9876-5432"
}'レスポンス例
{
"company": {
"id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"name": "株式会社サンプル(更新)",
"website": "https://example.com",
"phone": "03-9876-5432",
"address": "東京都渋谷区...",
"industry": "IT",
"email": "info@example.com",
"created_at": "2026-01-10T09:00:00Z",
"updated_at": "2026-02-01T12:00:00Z"
}
}DELETE
/api/v1/crm/companies/{id}会社を削除
指定した会社を削除します。
認証が必要です— セッション Cookie または Bearer トークンを含めてください
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | 必須 | 会社 ID |
レスポンスフィールド
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
success | boolean | 任意 | 削除成功フラグ |
コード例
curl -X DELETE "https://api.blueai.jp/api/v1/crm/companies/comp_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"レスポンス例
{
"success": true
}