/v2/api/entity base and authenticated with a Bearer token.cost_center_id and cost_center_ids. Omitting either fails with a 400.name and code as well — if omitted they are silently stored as an empty name and an empty/0 code, which is rarely useful. code must be unique across the account; a duplicate code fails with a 400.is_primary marks a cost center as primary (root) or secondary (child):| Value | Meaning |
|---|---|
| 1 | Primary (root) |
| 0 | Secondary (child); defaults to 0 when omitted |
cost_center_id is the id of the parent cost center — send 0 for a primary/root cost center, or the parent's id for a child. cost_center_ids is the comma-separated ancestor path of parent ids; it must be non-empty (an empty string is rejected), and it is not maintained automatically, so the caller supplies it.branch_id, status, id, created and modified are assigned by the server and are not settable through this endpoint.{ "message": "...", "id": <new id> }. The message is localized to the caller's language (for example Cost center Added Successfully in English).curl --location --globoff 'https://.daftara.com/v2/api/entity/cost_center' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ' \
--header 'apikey: ' \
--header 'Content-Type: application/json' \
--data '{
"name": "Project f",
"code": "0002",
"is_primary": 0,
"cost_center_id": 1,
"cost_center_ids": "1"
}'{
"message": "Cost center Added Successfully",
"id": 3
}