Toshl Developer

Update budget

Update a budget. Clients can set an additional query parameter update which dictates which budgets to update. Possible values are:

all Updates are to effect all past and future budgets.
tail Updates will be in effect from now on.

If update parameter is not specified the default value is all.

Note: Certain circumstances will cause all changes made to past or future budgets to be lost.

Some related data is updated asynchronously. Clients can set an additional GET parameter immediate_update which dictates that those values should be updated immediately in current request. Such a request may take longer to complete.

PUT /budgets/{id}

Required scope:

Parameters

id
required
string

Budget id.

name
required
string

Budget name.

Max length: 255
limit
required
number

Budget limit. If type != regular this field is read only.

Minimum: > -1000000000000000
Maximum: < 1000000000000000
currency
required
object

Currency object

code
required
string

Budget currency code.

Regex: [A-Z]{3}
rate
optional
number

Budget exchange rate calculated according to users currency. If not set (and currency differs from main currency) the daily exchange rate will be used.

Minimum: > 0
fixed
optional
boolean

If set to true, the exchange rate is not refreshed on next budget iteration.

Default value: false
rollover
optional
boolean

Boolean which determines if rollover is enabled for budget. If rollover is enabled whatever is left of the budget limit is carried over to the next month.

rollover_amount
optional
number

Current budget rollover amount if rollover is true.

Minimum: > -1000000000000000
Maximum: < 1000000000000000
Default value: 0
rollover_override
optional
boolean

Is true if rollover is overriden with a custom amount (can be useful for smart clients).

modified
required
string

Specifies when the budget was last modified.

type
required
string

Budget type.

Possible values: regular, delta, percent
percent
optional
number

Percent of monthly income. If type is percent this field must be set or server will report an error.

Minimum: > 0
delta
optional
number

Used to define monthly budget -/+ delta. If type if delta this field must be set or server will report an error.

tags
optional
array

An array of tag ids included in budget.

!tags
optional
array

An array of tag ids excluded from the budget.

categories
optional
array

An array of category ids included in budget.

!categories
optional
array

An array of category ids excluded from the budget.

accounts
optional
array

An array of account ids included in budget.

!accounts
optional
array

An array of account ids excluded from the budget.

extra
optional
object

A custom JSON object that you can use to extend Toshl API. Whatever you save into this field you will get back whenever you fetch it later.

Request

$ curl https://api.toshl.com/budgets/42 \
  -H "Authorization: Bearer T9cE5asGnuyYCCqIZFoWjFHvNbvVqHjl" \
  -H "Content-Type: application/json" \
  -X PUT \
  -d '{json}'

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "42",
  "name": "Monthly budget",
  "limit": 1000,
  "amount": 78.4,
  "planned": 12.6,
  "currency": {
    "code": "USD",
    "rate": 1,
    "fixed": false
  },
  "from": "2013-02-01",
  "to": "2013-02-30",
  "rollover": false,
  "modified": "2013-06-27T14:14:03+00:00Z",
  "recurrence": {
    "frequency": "monthly",
    "interval": 1,
    "start": "2012-06-01",
    "iteration": 4
  },
  "status": "active",
  "type": "regular",
  "order": 0,
  "categories": ["42"]
}