Skip to main content
POST
Add a budget

Authorizations

Authorization
string
header
required

A group API key, sent as Authorization: Bearer sw_live_…. Keys from staging and the demo start sw_test_ instead. A group admin creates keys in Settings → Integrations → API keys.

Scopes

accounting:write

Headers

Idempotency-Key
string

Unique per budget: any printable text up to 255 characters. A retry with the same key and body within 24 hours answers with the first budget instead of making another. Recommended.

Required string length: 1 - 255

Body

application/json

A field not listed here is refused with a 400.

name
string
required

Unique within its accounting year.

Required string length: 1 - 100
periodId
string<uuid>
required

An open accounting year, from GET /accounting-periods.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
amount
string
required

Pounds, as a string. Zero or more.

Pattern: ^\d+(\.\d{1,2})?$
type
enum<string>

expense for a spending limit (the default), income for a target.

Available options:
income,
expense
sectionIds
string<uuid>[]

The group’s sections it covers. Empty for the whole group.

Maximum array length: 50
Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
eventIds
string<uuid>[]

The group’s events it covers. Empty for the whole group.

Maximum array length: 50
Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
startDate
string<date> | null

Send both dates, inside the accounting year, or neither for the whole year.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
endDate
string<date> | null

A date, YYYY-MM-DD.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
{key}
any

Response

The budget an earlier request with the same Idempotency-Key made.

data
object
required
{key}
any