Toshl Developer

Update account

Update an account.

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 /accounts/{id}

Required scope:

Parameters

id *
required
string

Account id.

parent
optional
string

Parent account id.

name *
required
string

Account name.

Max length: 255
name_override
optional
boolean

Is true if name is overriden with a custom name.

initial_balance
optional
number

Account balance.

Minimum: > -1000000000000000
Maximum: < 1000000000000000
Default value: 0
currency *
required
object

Currency object

code *
required
string

Account currency code.

Regex: [A-Z_]{2,10}
rate
optional
number

Account 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 fixed.

Default value: false
modified *
required
string

Specifies when the account was last modified.

goal
optional
object

If account is a savings goal this includes a savings goal object.

amount *
required
number

Desired amount to save.

Minimum: > 0
Maximum: < 1000000000000000
start *
required
string

Savings goal start date in YYYY-MM-DD format.

Format: date
end *
required
string

Savings goal end date in YYYY-MM-DD format.

Format: date
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.

* denotes required field/parameter.

Request

$ curl https://api.toshl.com/accounts/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": "Tesla model S",
  "balance": 3000,
  "initial_balance": 3000,
  "currency": {
    "code": "USD",
    "rate": 1,
    "fixed": false
  },
  "status": "active",
  "order": 0,
  "modified": "2012-09-04T13:55:15Z"
}