Deals
Create, update, and manage deals including stage management and activity history.
|
Endpoints
| GET | /api/v1/crm/deals | List deals |
| POST | /api/v1/crm/deals | Create a deal |
| GET | /api/v1/crm/deals/{id} | Get deal details |
| PATCH | /api/v1/crm/deals/{id} | Update a deal |
| DELETE | /api/v1/crm/deals/{id} | Delete a deal |
| POST | /api/v1/crm/deals/{id}/stage | Update deal stage |
| GET | /api/v1/crm/deals/{id}/activities | Get deal activities |
GET
/api/v1/crm/dealsList deals
Retrieve deals within the organization with pagination. Supports search, sort, and stage filtering.
Authentication required— Include session cookie or Bearer token
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | Optional | Number of items per page (default: 50, max: 200) |
offset | integer | Optional | Number of items to skip |
search | string | Optional | Partial match search by deal name |
sort | string | Optional | Sort key (created_at, updated_at, name, amount) |
order | string | Optional | Sort order (asc / desc, default: desc) |
stage | string | Optional | Filter by stage |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Deal[] | Optional | Array of deals | |
total | number | Optional | Total count |
limit | number | Optional | Items per page |
offset | number | Optional | Number of items skipped |
Code Examples
curl "https://api.blueai.jp/api/v1/crm/deals" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"items": [
{
"id": "deal_11111111111111111111111111111111",
"name": "株式会社A 年間契約",
"amount": 1200000,
"stage": "proposal",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"assigned_member_id": "usr_99999999999999999999999999999999",
"expected_close_date": "2026-03-31",
"probability": 60,
"lost_reason": null,
"won_date": null,
"currency": "JPY",
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-10T14:30:00Z"
}
],
"total": 42,
"limit": 50,
"offset": 0
}POST
/api/v1/crm/dealsCreate a deal
Create a new deal.
Authentication required— Include session cookie or Bearer token
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Deal name |
amount | number | Optional | Amount (JPY) |
stage | string | Optional | Initial stage (default: lead) |
company_id | string | Optional | Associated company ID |
contact_id | string | Optional | Associated contact ID |
assigned_member_id | string | Optional | Assigned member ID |
expected_close_date | string | Optional | Expected close date (YYYY-MM-DD) |
probability | number | Optional | Win probability (0-100) |
currency | string | Optional | Currency code (default: JPY) |
note | string | Optional | Note |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Deal | Optional | Created deal |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/crm/deals" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"name": "株式会社A 年間契約",
"amount": 1200000,
"stage": "lead",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"expected_close_date": "2026-03-31"
}'Response Example
{
"deal": {
"id": "deal_11111111111111111111111111111111",
"name": "株式会社A 年間契約",
"amount": 1200000,
"stage": "proposal",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"assigned_member_id": "usr_99999999999999999999999999999999",
"expected_close_date": "2026-03-31",
"probability": 60,
"lost_reason": null,
"won_date": null,
"currency": "JPY",
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-10T14:30:00Z"
}
}GET
/api/v1/crm/deals/{id}Get deal details
Retrieve detailed information for the specified deal.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Deal ID |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Deal | Optional | Deal details |
Code Examples
curl "https://api.blueai.jp/api/v1/crm/deals/deal_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"deal": {
"id": "deal_11111111111111111111111111111111",
"name": "株式会社A 年間契約",
"amount": 1200000,
"stage": "proposal",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"assigned_member_id": "usr_99999999999999999999999999999999",
"expected_close_date": "2026-03-31",
"probability": 60,
"lost_reason": null,
"won_date": null,
"currency": "JPY",
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-10T14:30:00Z"
}
}PATCH
/api/v1/crm/deals/{id}Update a deal
Update information for the specified deal. Only submitted fields are updated.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Deal ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Optional | Deal name |
amount | number | Optional | Amount (JPY) |
stage | string | Optional | Stage |
company_id | string | Optional | Associated company ID |
contact_id | string | Optional | Associated contact ID |
assigned_member_id | string | Optional | Assigned member ID |
expected_close_date | string | Optional | Expected close date (YYYY-MM-DD) |
probability | number | Optional | Win probability (0-100) |
lost_reason | string | Optional | Lost reason |
won_date | string | Optional | Won date (ISO 8601) |
currency | string | Optional | Currency code (default: JPY) |
note | string | Optional | Note |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Deal | Optional | Updated deal |
Code Examples
curl -X PATCH "https://api.blueai.jp/api/v1/crm/deals/deal_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"name": "株式会社A 年間契約(更新)",
"amount": 1500000
}'Response Example
{
"deal": {
"id": "deal_11111111111111111111111111111111",
"name": "株式会社A 年間契約(更新)",
"amount": 1500000,
"stage": "proposal",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"assigned_member_id": "usr_99999999999999999999999999999999",
"expected_close_date": "2026-03-31",
"probability": 60,
"lost_reason": null,
"won_date": null,
"currency": "JPY",
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-10T14:30:00Z"
}
}DELETE
/api/v1/crm/deals/{id}Delete a deal
Delete the specified deal.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Deal 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/deals/deal_123e4567e89b12d3a456426614174000" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"success": true
}POST
/api/v1/crm/deals/{id}/stageUpdate deal stage
Change only the deal stage. Used for kanban board drag-and-drop operations.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Deal ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
stage | string | Required | Target stage (lead, qualification, proposal, negotiation, closed_won, closed_lost) |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Deal | Optional | Updated deal |
Code Examples
curl -X POST "https://api.blueai.jp/api/v1/crm/deals/deal_123e4567e89b12d3a456426614174000/stage" \
-H "Cookie: better-auth.session_token=<token>" \
-H "Content-Type: application/json" \
-d '{
"stage": "proposal"
}'Response Example
{
"deal": {
"id": "deal_11111111111111111111111111111111",
"name": "株式会社A 年間契約",
"amount": 1200000,
"stage": "proposal",
"company_id": "comp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"contact_id": "cont_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"assigned_member_id": "usr_99999999999999999999999999999999",
"expected_close_date": "2026-03-31",
"probability": 60,
"lost_reason": null,
"won_date": null,
"currency": "JPY",
"created_at": "2026-01-15T09:00:00Z",
"updated_at": "2026-02-10T14:30:00Z"
}
}GET
/api/v1/crm/deals/{id}/activitiesGet deal activities
Retrieve the activity history for the specified deal.
Authentication required— Include session cookie or Bearer token
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Deal ID |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | number | Optional | Page number (default: 1) |
limit | number | Optional | Items per page (default: 20) |
Response Fields
| Name | Type | Required | Description |
|---|---|---|---|
| Activity[] | Optional | Array of activities | |
total | number | Optional | Total count |
Code Examples
curl "https://api.blueai.jp/api/v1/crm/deals/deal_123e4567e89b12d3a456426614174000/activities" \
-H "Cookie: better-auth.session_token=<token>"Response Example
{
"activities": [
{
"id": "act_cccccccccccccccccccccccccccccccc",
"type": "note",
"content": "初回ヒアリング実施。予算感は1000万円前後。",
"deal_id": "deal_11111111111111111111111111111111",
"contact_id": null,
"created_by": "usr_99999999999999999999999999999999",
"created_at": "2026-02-10T14:30:00Z"
}
],
"total": 5
}