Update the balance of an offline or disconnected account
const url = 'https://app.commitly.com/api/accounts/4003/';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"balance":7500}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://app.commitly.com/api/accounts/4003/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "balance": 7500 }'Sets the current balance of an account that COMMITLY does not update from a bank:
accounts with status OFFLINE or DISCONNECTED. Accounts linked to a bank
connection are refused with 400.
balanceis the current balance of the account, as a JSON number or a numeric string with up to two decimal places (same format as when creating an offline account).- COMMITLY calculates the balance history backwards from the current balance: current balance minus the transactions gives the balance on every earlier day.
- Creating transactions does not change the balance. Whenever you add
transactions with
POST /accounts/{account_id}/transactions/, send the new current balance with this request as well, otherwise the balance history is wrong. - Company level only: update the accounts of each company with that company’s credentials.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Bank account ID (id from GET /accounts/).
Example
4003Request Bodyrequired
Section titled “Request Bodyrequired”object
New current balance of the account, up to two decimal places.
Example
{ "balance": 7500}Responses
Section titled “Responses”Balance updated. The response contains the updated account.
object
Bank data embedded in an account.
object
Present in GET /accounts/ only.
object
Short form of a bank account, embedded in transactions.
object
Bank name. Present in the create-transactions response only.
Present in the create-transactions response only.
ISO 4217 currency code.
Account type as supplied by the bank provider (free text, e.g. Checking). Empty for offline accounts.
Account status. Only offline accounts accept transactions via
POST /accounts/{account_id}/transactions/; accounts with status API or
DISCONNECTED, and accounts linked to a bank connection, do not.
Example
{ "id": 4003, "bank": { "open_banking_connection_id": null, "name": "ERP cash accounts", "bic": "" }, "transaction_count": 214, "currency": "EUR", "date_created": "2024-02-01T09:12:44.120511Z", "date_updated": "2024-07-11T08:30:02.518734Z", "name": "Petty cash", "alias": "", "iban": "", "type_name": "", "balance": 7500, "overdraft_limit": null, "status": "OFFLINE", "last_successful_update": null, "last_update_attempt": null, "banking_api_account": null}Invalid request body or parameters. The body lists the errors per field; errors
not tied to a field are listed under non_field_errors. For request bodies
that are arrays, the body is a list with one error object per item. Messages
are localized (see Accept-Language).
Validation errors. Each key is a field of the request body; its value is the
list of messages for that field. Errors not tied to a field are listed under
non_field_errors.
object
Validation errors. Each key is a field of the request body; its value is the
list of messages for that field. Errors not tied to a field are listed under
non_field_errors.
object
Example
{ "settlement_date": [ "This field is required." ]}The access token is invalid or has expired. Request a new token. The message is
localized (see Accept-Language).
object
Error message.
Present only if the company’s edition does not include the function; value billing_plan_permission_denied.
Example
{ "detail": "Invalid token."}Headers
Section titled “Headers”Authentication scheme, Bearer.
Example
BearerNo access token was sent, or the credentials are not allowed to call this
endpoint. If the company’s COMMITLY edition does not include the requested
function, the body additionally contains
"code": "billing_plan_permission_denied".
object
Error message.
Present only if the company’s edition does not include the function; value billing_plan_permission_denied.
Example
{ "detail": "User must be authenticated to access this resource."}The resource does not exist or is not accessible with these credentials.
object
Error message.
Present only if the company’s edition does not include the function; value billing_plan_permission_denied.
Examplegenerated
{ "detail": "example", "code": "example"}
