CRM API
Contacts, companies, deals and activities. Every endpoint below is part of the stable v1 contract. Base URL https://app.aio.opexcg.com; send your key in X-API-Key.
GET /api/crm/contacts: List contactsGET /api/crm/contacts/:id: Get a contactPOST /api/crm/contacts: Create a contactPATCH /api/crm/contacts/:id: Update a contactGET /api/crm/companies: List companiesGET /api/crm/companies/:id: Get a companyPOST /api/crm/companies: Create a companyPATCH /api/crm/companies/:id: Update a companyGET /api/crm/deals: List dealsGET /api/crm/deals/:id: Get a dealPOST /api/crm/deals: Create a dealPATCH /api/crm/deals/:id: Update a dealPOST /api/crm/deals/:id/move: Move a deal to another stageGET /api/crm/activities: List activitiesPOST /api/crm/activities: Log an activity
List contacts
GET /api/crm/contacts
Contacts, newest first by default. search matches name, email and company.
Sort keys: created (default), name, email, status.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
page |
string |
no | 1-based page number. Default 1. |
pageSize |
string |
no | Rows per page, 1 to 100. Larger values are clamped. Default 20. |
search |
string |
no | Free-text filter (trimmed, first 200 characters). |
sort |
string |
no | Sort key. Unknown keys fall back to the endpoint’s default sort. |
dir |
string |
no | asc or desc (default). |
status |
string |
no | lead, active or churned. |
companyId |
string |
no | Only contacts of this company. |
Response 200
One page of contacts.
| Field | Type | Description |
|---|---|---|
items |
object[] |
|
items[].id |
string |
|
items[].email |
string |
|
items[].name |
string | null |
|
items[].company |
string | null |
Company name as typed (free text). |
items[].company_id |
string | null |
Linked company record. |
items[].title |
string | null |
|
items[].phone |
string | null |
|
items[].address |
string | null |
|
items[].status |
"lead" | "active" | "churned" |
|
items[].source |
string | null |
|
items[].notes |
string | null |
|
items[].created_at |
number |
|
items[].modified_at |
number |
|
total |
number |
|
page |
number |
|
pageSize |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/contacts?pageSize=2&search=Sari' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "items": [ { "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 1, "page": 1, "pageSize": 2}Get a contact
GET /api/crm/contacts/:id
One contact with its company link and status.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Contact id. |
Response 200
The contact.
| Field | Type | Description |
|---|---|---|
id |
string |
|
email |
string |
|
name |
string | null |
|
company |
string | null |
Company name as typed (free text). |
company_id |
string | null |
Linked company record. |
title |
string | null |
|
phone |
string | null |
|
address |
string | null |
|
status |
"lead" | "active" | "churned" |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, plus the shared ones. Meanings: error codes.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/contacts/f611c550-75fd-452d-8de3-8ab46f9f1823' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Create a contact
POST /api/crm/contacts
Creates a contact. Contacts are unique by email: posting an email that already exists answers 200 with the existing contact, filling only its blank fields from the request (nothing set is overwritten). Safe to retry.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
email |
string |
yes | |
name |
string |
no | max length 200 |
company |
string |
no | max length 200 |
title |
string |
no | max length 120 |
phone |
string |
no | max length 60 |
address |
string |
no | max length 500 |
source |
string |
no | max length 120 |
notes |
string |
no | max length 2000 |
companyId |
string |
no |
Response 201
The new contact.
| Field | Type | Description |
|---|---|---|
id |
string |
|
email |
string |
|
name |
string | null |
|
company |
string | null |
Company name as typed (free text). |
company_id |
string | null |
Linked company record. |
title |
string | null |
|
phone |
string | null |
|
address |
string | null |
|
status |
"lead" | "active" | "churned" |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: company_not_found, plus the shared ones. Meanings: error codes.
Example
curl -X POST 'https://app.aio.opexcg.com/api/crm/contacts' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"email":"[email protected]","name":"Sari Wulandari","title":"Head of Operations","companyId":"c5615616-096f-4886-9894-58e10bb0482a","source":"api"}'Response 201:
{ "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": null, "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "lead", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050080, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Update a contact
PATCH /api/crm/contacts/:id
Changes any of the given fields. companyId: null unlinks the company.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Contact id. |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
email |
string |
no | |
name |
string |
no | max length 200 |
company |
string |
no | max length 200 |
title |
string |
no | max length 120 |
phone |
string |
no | max length 60 |
address |
string |
no | max length 500 |
source |
string |
no | max length 120 |
notes |
string |
no | max length 2000 |
companyId |
string | null |
no | |
status |
"lead" | "active" | "churned" |
no |
Response 200
The updated contact.
| Field | Type | Description |
|---|---|---|
id |
string |
|
email |
string |
|
name |
string | null |
|
company |
string | null |
Company name as typed (free text). |
company_id |
string | null |
Linked company record. |
title |
string | null |
|
phone |
string | null |
|
address |
string | null |
|
status |
"lead" | "active" | "churned" |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, company_not_found, plus the shared ones. Meanings: error codes.
Example
curl -X PATCH 'https://app.aio.opexcg.com/api/crm/contacts/f611c550-75fd-452d-8de3-8ab46f9f1823' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"status":"active","phone":"+62 21 555 0100"}'Response 200:
{ "id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "tenant_id": "opexcg-tenant", "user_id": null, "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "name": "Sari Wulandari", "company": "Kencana Logistik Tbk", "title": "Head of Operations", "phone": "+62 21 555 0100", "address": null, "avatar_url": null, "custom_fields_json": "{}", "status": "active", "source": "api", "notes": null, "created_at": 1794052050080, "created_by": "usr-fitri-handayani", "modified_at": 1794052050163, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}List companies
GET /api/crm/companies
Companies (your clients and your own organisation), with their contact and deal counts.
Sort keys: name (default), created, type.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
page |
string |
no | 1-based page number. Default 1. |
pageSize |
string |
no | Rows per page, 1 to 100. Larger values are clamped. Default 20. |
search |
string |
no | Free-text filter (trimmed, first 200 characters). |
sort |
string |
no | Sort key. Unknown keys fall back to the endpoint’s default sort. |
dir |
string |
no | asc or desc (default). |
type |
string |
no | client or internal. |
Response 200
One page of companies.
| Field | Type | Description |
|---|---|---|
items |
object[] |
|
items[].id |
string |
|
items[].name |
string |
|
items[].type |
"client" | "internal" |
|
items[].created_at |
number |
|
items[].contactCount |
number |
|
items[].dealCount |
number |
|
total |
number |
|
page |
number |
|
pageSize |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/companies?pageSize=5' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "items": [ { "id": "comp-xyzind", "tenant_id": "opexcg-tenant", "name": "XYZ Industries", "type": "client", "settings_json": "{}", "created_at": 1768132020883, "created_by": null, "modified_at": 1768132020883, "modified_by": null, "deleted_at": null, "deleted_by": null, "contactCount": 0, "dealCount": 0 }, { "id": "comp-opexcg", "tenant_id": "opexcg-tenant", "name": "OpexCG", "type": "internal", "settings_json": "{}", "created_at": 1759492020883, "created_by": null, "modified_at": 1759492020883, "modified_by": null, "deleted_at": null, "deleted_by": null, "contactCount": 0, "dealCount": 0 } ], "total": 5, "page": 1, "pageSize": 5}Get a company
GET /api/crm/companies/:id
One company with its contact count, deal count and pipeline totals.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Company id. |
Response 200
The company.
| Field | Type | Description |
|---|---|---|
company |
object |
|
company.id |
string |
|
company.name |
string |
|
company.type |
"client" | "internal" |
|
company.created_at |
number |
|
rollups |
object |
|
rollups.contactCount |
number |
|
rollups.dealCount |
number |
|
rollups.totals |
any |
Pipeline totals per currency. |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, plus the shared ones. Meanings: error codes.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/companies/c5615616-096f-4886-9894-58e10bb0482a' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "company": { "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052049968, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null }, "rollups": { "contactCount": 0, "dealCount": 0, "totals": [] }}Create a company
POST /api/crm/companies
Creates a company. Needs crm:company:create as well as crm:record:write.
- Product: CRM (
crm) - Permission (any of):
crm:company:create
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
yes | min length 1, max length 200 |
type |
"client" | "internal" |
no |
Response 201
The new company.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
type |
"client" | "internal" |
|
created_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: forbidden, plus the shared ones. Meanings: error codes.
Example
curl -X POST 'https://app.aio.opexcg.com/api/crm/companies' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Kencana Logistik","type":"client"}'Response 201:
{ "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052049968, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Update a company
PATCH /api/crm/companies/:id
Renames a company or changes its type. Needs crm:company:update as well as crm:record:write.
- Product: CRM (
crm) - Permission (any of):
crm:company:update
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Company id. |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
no | min length 1, max length 200 |
type |
"client" | "internal" |
no |
Response 200
The updated company.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
type |
"client" | "internal" |
|
created_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, forbidden, plus the shared ones. Meanings: error codes.
Example
curl -X PATCH 'https://app.aio.opexcg.com/api/crm/companies/c5615616-096f-4886-9894-58e10bb0482a' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Kencana Logistik Tbk"}'Response 200:
{ "id": "c5615616-096f-4886-9894-58e10bb0482a", "tenant_id": "opexcg-tenant", "name": "Kencana Logistik Tbk", "type": "client", "settings_json": null, "support_package": null, "email_domains_json": null, "website": null, "domain": null, "industry": null, "description": null, "created_at": 1794052049968, "created_by": "usr-fitri-handayani", "modified_at": 1794052050044, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}List deals
GET /api/crm/deals
Deals, newest first by default. Amounts are integer minor units (amount_cents) in the deal’s currency.
Sort keys: created (default), name, amount, stage, expected_close.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
page |
string |
no | 1-based page number. Default 1. |
pageSize |
string |
no | Rows per page, 1 to 100. Larger values are clamped. Default 20. |
search |
string |
no | Free-text filter (trimmed, first 200 characters). |
sort |
string |
no | Sort key. Unknown keys fall back to the endpoint’s default sort. |
dir |
string |
no | asc or desc (default). |
stage |
string |
no | lead, qualified, demo_poc, proposal, negotiation, won or lost. |
contactId |
string |
no | Only deals of this contact. |
companyId |
string |
no | Only deals of this company. |
Response 200
One page of deals.
| Field | Type | Description |
|---|---|---|
items |
object[] |
|
items[].id |
string |
|
items[].name |
string |
|
items[].contact_id |
string | null |
|
items[].company_id |
string | null |
|
items[].project_id |
string | null |
|
items[].sales_owner_id |
string | null |
|
items[].stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
|
items[].amount_cents |
number |
Integer minor units of currency. |
items[].currency |
string |
|
items[].win_probability |
number | null |
0 to 100; null follows the stage default. |
items[].expected_close_at |
number | null |
Epoch milliseconds. |
items[].closed_at |
number | null |
|
items[].lost_reason |
string | null |
|
items[].source |
string | null |
|
items[].notes |
string | null |
|
items[].created_at |
number |
|
items[].modified_at |
number |
|
total |
number |
|
page |
number |
|
pageSize |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/deals?pageSize=2' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "items": [ { "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 1, "page": 1, "pageSize": 2}Get a deal
GET /api/crm/deals/:id
One deal with its stage, amount and linked contact, company and project.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Deal id. |
Response 200
The deal.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
contact_id |
string | null |
|
company_id |
string | null |
|
project_id |
string | null |
|
sales_owner_id |
string | null |
|
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
|
amount_cents |
number |
Integer minor units of currency. |
currency |
string |
|
win_probability |
number | null |
0 to 100; null follows the stage default. |
expected_close_at |
number | null |
Epoch milliseconds. |
closed_at |
number | null |
|
lost_reason |
string | null |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, plus the shared ones. Meanings: error codes.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Create a deal
POST /api/crm/deals
Creates a deal, by default in the lead stage. amountCents is in minor units of currency. A deal created as lost needs a lostReason.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
yes | |
contactId |
string |
no | |
companyId |
string | null |
no | |
projectId |
string |
no | |
notes |
string | null |
no | |
salesOwnerId |
string | null |
no | |
source |
string |
no | max length 120 |
amountCents |
integer |
no | min 0 |
currency |
string |
no | max length 8 |
expectedCloseAt |
integer | null |
no | |
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
no | |
winProbability |
integer | null |
no | |
lostReason |
"price" | "scope" | "no_budget" | "competitor" | "stalled" | null |
no | |
competitorName |
string | null |
no | |
demandRole |
"SE" | "FC" | "TC" | "PM" | null |
no | |
demandHoursPerDay |
integer | null |
no | |
demandStartAt |
integer | null |
no | |
demandWeeks |
integer | null |
no |
Response 201
The new deal.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
contact_id |
string | null |
|
company_id |
string | null |
|
project_id |
string | null |
|
sales_owner_id |
string | null |
|
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
|
amount_cents |
number |
Integer minor units of currency. |
currency |
string |
|
win_probability |
number | null |
0 to 100; null follows the stage default. |
expected_close_at |
number | null |
Epoch milliseconds. |
closed_at |
number | null |
|
lost_reason |
string | null |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: company_not_found, missing_lost_reason, plus the shared ones. Meanings: error codes.
Example
curl -X POST 'https://app.aio.opexcg.com/api/crm/deals' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"name":"Fleet maintenance rollout","contactId":"f611c550-75fd-452d-8de3-8ab46f9f1823","companyId":"c5615616-096f-4886-9894-58e10bb0482a","amountCents":4500000000,"currency":"IDR","stage":"qualified","expectedCloseAt":1796644050172}'Response 201:
{ "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": null, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050203, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Update a deal
PATCH /api/crm/deals/:id
Changes any of the given fields. Use the move endpoint to change the stage with a timeline entry.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Deal id. |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
no | |
contactId |
string | null |
no | |
companyId |
string | null |
no | |
projectId |
string | null |
no | |
notes |
string | null |
no | |
salesOwnerId |
string | null |
no | |
source |
string | null |
no | |
amountCents |
integer |
no | min 0 |
currency |
string |
no | max length 8 |
expectedCloseAt |
integer | null |
no | |
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
no | |
winProbability |
integer | null |
no | |
lostReason |
"price" | "scope" | "no_budget" | "competitor" | "stalled" | null |
no | |
competitorName |
string | null |
no | |
demandRole |
"SE" | "FC" | "TC" | "PM" | null |
no | |
demandHoursPerDay |
integer | null |
no | |
demandStartAt |
integer | null |
no | |
demandWeeks |
integer | null |
no |
Response 200
The updated deal.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
contact_id |
string | null |
|
company_id |
string | null |
|
project_id |
string | null |
|
sales_owner_id |
string | null |
|
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
|
amount_cents |
number |
Integer minor units of currency. |
currency |
string |
|
win_probability |
number | null |
0 to 100; null follows the stage default. |
expected_close_at |
number | null |
Epoch milliseconds. |
closed_at |
number | null |
|
lost_reason |
string | null |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, company_not_found, missing_lost_reason, plus the shared ones. Meanings: error codes.
Example
curl -X PATCH 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"winProbability":60}'Response 200:
{ "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "qualified", "stage_sort": 1, "expected_close_at": 1796644050172, "source": null, "win_probability": 60, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050299, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}Move a deal to another stage
POST /api/crm/deals/:id/move
Moves a deal along the pipeline and records the move on its timeline. Moving to won or lost stamps closed_at (and lost needs a lostReason); moving back to an open stage clears it.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | Deal id. |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
yes | |
lostReason |
"price" | "scope" | "no_budget" | "competitor" | "stalled" |
no | |
competitorName |
string |
no | max length 200 |
Response 200
The moved deal.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
contact_id |
string | null |
|
company_id |
string | null |
|
project_id |
string | null |
|
sales_owner_id |
string | null |
|
stage |
"lead" | "qualified" | "demo_poc" | "proposal" | "negotiation" | "won" | "lost" |
|
amount_cents |
number |
Integer minor units of currency. |
currency |
string |
|
win_probability |
number | null |
0 to 100; null follows the stage default. |
expected_close_at |
number | null |
Epoch milliseconds. |
closed_at |
number | null |
|
lost_reason |
string | null |
|
source |
string | null |
|
notes |
string | null |
|
created_at |
number |
|
modified_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: not_found, missing_lost_reason, plus the shared ones. Meanings: error codes.
Example
curl -X POST 'https://app.aio.opexcg.com/api/crm/deals/c80cad76-7ec0-4641-a5f2-30ea2aaa4561/move' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"stage":"proposal"}'Response 200:
{ "id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "tenant_id": "opexcg-tenant", "contact_id": "f611c550-75fd-452d-8de3-8ab46f9f1823", "company_id": "c5615616-096f-4886-9894-58e10bb0482a", "project_id": null, "sales_owner_id": null, "name": "Fleet maintenance rollout", "amount_cents": 4500000000, "currency": "IDR", "stage": "proposal", "stage_sort": 3, "expected_close_at": 1796644050172, "source": null, "win_probability": 60, "lost_reason": null, "competitor_name": null, "demand_role": null, "demand_hours_per_day": null, "demand_start_at": null, "demand_weeks": null, "win_reason": null, "loss_reason": null, "closed_at": null, "notes": null, "created_at": 1794052050203, "created_by": "usr-fitri-handayani", "modified_at": 1794052050329, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}List activities
GET /api/crm/activities
Calls, emails, meetings and notes, most recent first. Pass subjectType and subjectId for one contact’s or deal’s timeline.
- Product: CRM (
crm) - Permission (any of):
crm:record:read
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
page |
string |
no | 1-based page number. Default 1. |
pageSize |
string |
no | Rows per page, 1 to 100. Larger values are clamped. Default 20. |
search |
string |
no | Free-text filter (trimmed, first 200 characters). |
sort |
string |
no | Sort key. Unknown keys fall back to the endpoint’s default sort. |
dir |
string |
no | asc or desc (default). |
subjectType |
string |
no | contact or deal. |
subjectId |
string |
no | With subjectType: one contact’s or deal’s timeline. |
kind |
string |
no | call, email, meeting, note or system. |
done |
string |
no | true for completed follow-ups, false for open ones. |
Response 200
One page of activities.
| Field | Type | Description |
|---|---|---|
items |
object[] |
|
items[].id |
string |
|
items[].subject_type |
"contact" | "deal" |
|
items[].subject_id |
string |
|
items[].kind |
"call" | "email" | "meeting" | "note" | "system" |
|
items[].title |
string | null |
|
items[].body |
string | null |
|
items[].occurred_at |
number |
Epoch milliseconds. |
items[].due_at |
number | null |
|
items[].done_at |
number | null |
|
items[].created_by |
string | null |
|
items[].created_at |
number |
|
total |
number |
|
page |
number |
|
pageSize |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: invalid_subject_type, plus the shared ones. Meanings: error codes.
Example
curl -X GET 'https://app.aio.opexcg.com/api/crm/activities?subjectType=deal&subjectId=c80cad76-7ec0-4641-a5f2-30ea2aaa4561&pageSize=2' \ -H "X-API-Key: $OPEX_API_KEY"Response 200:
{ "items": [ { "id": "b5c5c795-91da-4d91-b53d-fe7bd8b48d91", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "meeting", "title": "Proposal walkthrough", "body": null, "occurred_at": 1794052050341, "due_at": null, "done_at": null, "created_at": 1794052050369, "created_by": "usr-fitri-handayani", "modified_at": 1794052050369, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null }, { "id": "abef4b47-4708-4a32-b00f-d60262d580eb", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "system", "title": "Stage → Proposal sent", "body": null, "occurred_at": 1794052050335, "due_at": null, "done_at": null, "created_at": 1794052050335, "created_by": "usr-fitri-handayani", "modified_at": 1794052050335, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null } ], "total": 2, "page": 1, "pageSize": 2}Log an activity
POST /api/crm/activities
Logs a call, email, meeting or note on a contact’s or deal’s timeline. occurredAt defaults to now; dueAt makes it a follow-up. Times are epoch milliseconds.
- Product: CRM (
crm) - Permission (any of):
crm:record:write
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
subjectType |
"contact" | "deal" |
yes | |
subjectId |
string |
yes | |
kind |
"call" | "email" | "meeting" | "note" | "system" |
yes | |
title |
string |
no | max length 300 |
body |
string |
no | max length 5000 |
occurredAt |
integer |
no | |
dueAt |
integer | null |
no |
Response 201
The new activity.
| Field | Type | Description |
|---|---|---|
id |
string |
|
subject_type |
"contact" | "deal" |
|
subject_id |
string |
|
kind |
"call" | "email" | "meeting" | "note" | "system" |
|
title |
string | null |
|
body |
string | null |
|
occurred_at |
number |
Epoch milliseconds. |
due_at |
number | null |
|
done_at |
number | null |
|
created_by |
string | null |
|
created_at |
number |
Objects may carry more fields than listed; only the listed ones are part of the contract.
Errors: invalid_subject_type, subject_not_found, plus the shared ones. Meanings: error codes.
Example
curl -X POST 'https://app.aio.opexcg.com/api/crm/activities' \ -H "X-API-Key: $OPEX_API_KEY" \ -H "content-type: application/json" \ -d '{"subjectType":"deal","subjectId":"c80cad76-7ec0-4641-a5f2-30ea2aaa4561","kind":"meeting","title":"Proposal walkthrough","occurredAt":1794052050341}'Response 201:
{ "id": "b5c5c795-91da-4d91-b53d-fe7bd8b48d91", "tenant_id": "opexcg-tenant", "subject_type": "deal", "subject_id": "c80cad76-7ec0-4641-a5f2-30ea2aaa4561", "kind": "meeting", "title": "Proposal walkthrough", "body": null, "occurred_at": 1794052050341, "due_at": null, "done_at": null, "created_at": 1794052050369, "created_by": "usr-fitri-handayani", "modified_at": 1794052050369, "modified_by": "usr-fitri-handayani", "deleted_at": null, "deleted_by": null}