Skip to main content

Cost centers workflow

The public field is cost_center_id. Table names stay CostCenter / CostCenterBudget. User-facing copy in the dashboard is centros de resultados. Use GET /api/cost-centers (x-api-key, company scoped) to list centers with an embedded budgets array so you can resolve IDs.
Each center includes client_id (imputation vehicle), default_internal_account_id, net_balance_by_default, and budgets with kind = expense | income (default expense). Amounts are positive. Unique key is (cost_center_id, currency, year, period, kind).

Create a centro de resultados

If the list is empty, create one with POST /api/cost-centers. This is the same domain path as the dashboard: it creates the CostCenter and a type=1 client tagged for centros de resultados (legacy Centro de costos tags are reused when present; new tags use Centro de resultados). Required: name, default_currency. Optional: default_internal_account_id, net_balance_by_default, owner_name, owner_email, department.
The 201 body is the created center (same fields as a GET item, including id and client_id, with budgets: []). Use that id as cost_center_id on POST /api/operations. Optional PATCH /api/cost-centers/{id} updates those fields. Delete is not supported.

Seed a budget operation type

Budget operations need a company operation type with type=budget. New companies with cost centers enabled get Centros de resultados automatically. Existing companies (for example Blueprint) may only have up / down / other / exchange.
type must already exist on CompanyOperationTypes (up, down, exchange, other, budget, interest). Then create budget operations with POST /api/operations. See Operations workflow.