API reference · Settings
Update products, customers & cells
put
/settings/products| Authentication | Customer token (Bearer) |
|---|---|
| Access | Free user · Pro user Customer token (Bearer) — free and paid users |
Saves everything at once. Changing a generic name, product type, customer core fields or active cells rebuilds the questions and breaks the trend → 409 unless confirm: true.
Request body
| Field | Type | Description |
|---|---|---|
products* | object[] | 1..plan products (free 1, paid 3); same item rules as O4 |
products[].id | integer | null | Unique ID. |
products[].name* | string | |
products[].generic_name* | string | |
products[].type* | string ("software", "service", "physical", "other") | |
products[].features | array | null | |
customers* | object[] | 1..plan customers (free 1, paid 2); same item rules as O5 (industries max 10, decision_makers max 5) |
customers[].id | integer | null | Unique ID. |
customers[].kind* | string ("b2b", "b2c") | |
customers[].industries | array | null | |
customers[].sizes | array | null | |
customers[].decision_makers | array | null | |
customers[].country* | string | |
customers[].province | string | null | |
customers[].city | string | null | |
customers[].main_need | string | null | |
cells | array | null | max 12; product_id, target_customer_id, active, position 1–50; active ≤ plan cells |
confirm | boolean | null | true = accept the question rebuild |
Examplejson
{
"products": [
{
"id": {{productId}},
"name": "آوند ابری",
"generic_name": "نرمافزار حسابداری ابری",
"type": "software",
"features": [
"صدور فاکتور رسمی",
"اتصال به سامانه مودیان",
"دسترسی چندکاربره"
]
}
],
"customers": [
{
"id": {{customerId}},
"kind": "b2b",
"industries": [
"خدمات",
"بازرگانی"
],
"sizes": [
"micro",
"small"
],
"decision_makers": [
"مدیر مالی",
"مدیرعامل"
],
"country": "ایران",
"province": null,
"city": null,
"main_need": "حسابداری ساده و قانونی"
}
],
"cells": [
{
"product_id": {{productId}},
"target_customer_id": {{customerId}},
"active": true,
"position": 1
}
],
"confirm": false
}
Responses
200 — same as GET
409 body (ConfirmRequired): {"message":"…","requires_confirmation":true,"reason":"rebuild_questions","questions_count":10,"changes":[{"field":"products.0.generic_name","from":"نرمافزار حسابداری ابری","to":"نرمافزار حسابداری آنلاین"}]}.
| Field | Type | Description |
|---|---|---|
products* | object[] | |
products[].id* | integer | Unique ID. |
products[].name* | string | |
products[].generic_name* | string | |
products[].type* | string | |
products[].features* | any[] | |
products[].position* | integer | |
customers* | object[] | |
customers[].id* | integer | Unique ID. |
customers[].kind* | string | |
customers[].name* | string | |
customers[].industries* | any[] | |
customers[].sizes* | any[] | |
customers[].decision_makers* | any[] | |
customers[].country* | string | |
customers[].province* | string | null | |
customers[].city* | string | null | |
customers[].main_need* | string | null | |
customers[].position* | integer | |
cells* | object[] | |
cells[].id* | integer | Unique ID. |
cells[].product_id* | integer | |
cells[].target_customer_id* | integer | |
cells[].label* | string | |
cells[].active* | boolean | |
cells[].position* | integer | |
limits* | any[] | Limits of the account's plan. |
question_counts* | object |
json
{
"…": "GET /settings/products body after saving"
}
401 — Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): {"message":"…","code":"unauthenticated"} (message in the request language)
| Field | Type |
|---|---|
message* | string |
code | string |
json
{
"message": "Please sign in to continue; your session has ended or is not valid.",
"code": "unauthenticated"
}
409 — ConfirmRequired — resend with confirm: true
| Field | Type |
|---|---|
message | string |
requires_confirmation* | boolean |
reason | string |
questions_count | integer |
changes | object[] |
changes[].field | string |
changes[].from | any |
changes[].to | any |
json
{
"message": "",
"requires_confirmation": true,
"reason": "",
"questions_count": 0,
"changes": [
{
"field": "",
"from": null,
"to": null
}
]
}
422 — Validation failed (limits (products max, cells max/min), products.N.generic_name contains the brand, unknown ids)
| Field | Type |
|---|---|
message* | string |
errors* | object |
json
{
"message": "",
"errors": {
"email": [
"ایمیل معتبر نیست."
]
}
}
curl example
bash
curl -X PUT 'http://127.0.0.1:8010/api/settings/products' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $RAWI_USER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"products": [
{
"id": {{productId}},
"name": "آوند ابری",
"generic_name": "نرمافزار حسابداری ابری",
"type": "software",
"features": [
"صدور فاکتور رسمی",
"اتصال به سامانه مودیان",
"دسترسی چندکاربره"
]
}
],
"customers": [
{
"id": {{customerId}},
"kind": "b2b",
"industries": [
"خدمات",
"بازرگانی"
],
"sizes": [
"micro",
"small"
],
"decision_makers": [
"مدیر مالی",
"مدیرعامل"
],
"country": "ایران",
"province": null,
"city": null,
"main_need": "حسابداری ساده و قانونی"
}
],
"cells": [
{
"product_id": {{productId}},
"target_customer_id": {{customerId}},
"active": true,
"position": 1
}
],
"confirm": false
}'