Skip to content
campaiDeveloper
campai.com

Finance · Accounting · Budgets

POST/{organizationId}/{mandateId}/finance/accounting/budgets

Create budget

Creates a draft budget for a mandate and fiscal year and returns its budgetId. Choose empty, previousActuals, or previousBudget as the source. You can adjust amounts by a percentage and, for previous actuals, request a split by cost center.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • The caller must have access to the organization.
  • The caller needs mandate.read and budget.insert permissions.

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired

Body

Content-Type: application/json

  • fiscalYearintegerrequired

    2000–3000

  • sourcestringrequired
    empty previousActuals previousBudget
  • adjustmentPercentnumber

    -100–1000 · default 0

  • splitByCostCenterboolean

    default false

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/finance/accounting/budgets' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • budgetIdid
Response200
{
  "budgetId": "000000000000000000000001"
}

What else happens

  • The endpoint creates a budget record with status draft.

Errors

Other errors

StatusErrorWhen
400There is no budget for the fiscal year beforeIf source is previousBudget and there is no budget for the previous fiscal year, the endpoint returns HTTP 400 with key routes.finance.accounting.budgets.noPreviousBudget.
404Accounting plan is missing. Please make sure you have setup your finances app properly.If the organization's accounting plan is missing, the endpoint returns HTTP 404 with key finance.accounting.getAccountingPlan.notFound.
404Finances settings are missingIf the organization's finances settings are missing, the endpoint returns HTTP 404 with key finance.settings.getFinancesSettings.notFound.
404A mandate needs to be providedIf no budget already exists and the mandate ID is the null object ID, the endpoint returns HTTP 404 with key organization.getMandate.nullMandateId.
404Mandate mandate ID not foundIf no budget already exists and the non-null mandate ID is not found in the organization, the endpoint returns HTTP 404 with key organization.getMandate.notFound.
409This mandate already has a budget for this fiscal yearIf the mandate already has a budget for the fiscal year, the endpoint returns HTTP 409 with key routes.finance.accounting.budgets.alreadyExists.

Marked words such as mandate ID are filled in with the actual value when the error happens.

Errors nearly every request can meet are listed under Errors.