Skip to main content

POST run_allocation

Create and execute an Allocation Run for a given fiscal period.

Endpoint

POST /api/method/konsol.api.run_allocation

Authentication: Required (Frappe session cookie)

Parameters

ParameterTypeRequiredDescription
fiscal_yearintegerYesFiscal year (e.g., 2025)
fiscal_periodintegerYesFiscal period (112)

What Happens

  1. Creates a new Allocation Run document
  2. Submits it (triggers before_submit):
    • allocation_run_id set to the document name
    • run_by set to the current user
    • run_at set to the current timestamp
    • status set directly to "Active"
  3. Syncs to ClickHouse (epm_staging.allocation_runs)

The endpoint does not invoke dbt. The allocation gold models (gold_allocation_results, built from the multi-step allocation engine) read from epm_staging.allocation_runs on their next run; gold_allocation_results itself applies no status filter.

Response

{
"message": {
"name": "ARUN-2025-P6-0001",
"allocation_run_id": "ARUN-2025-P6-0001",
"status": "Active",
"run_by": "admin@example.com",
"run_at": "2025-06-09 14:30:00"
}
}

Example

curl -X POST http://localhost:8069/api/method/konsol.api.run_allocation \
-H "Content-Type: application/json" \
-b "cookies.txt" \
-d '{"fiscal_year": 2025, "fiscal_period": 6}'

Workflow Context

Draft ──[Run Allocation]──→ Active ──[Reverse]──→ Reversed

See also: reverse_allocation, allocation_history