Record Opening Balance
/extensions/roboledger/{graph_id}/operations/record-opening-balancePart of RoboLedger: Ledger & Events.
Record the balance sheet an entity's books start from, when its history does not come with them: one balance per balance-sheet account (assets, liabilities, equity), in cents, debit or credit in the account's normal direction. It posts as one opening entry dated the day before the entity's first fiscal month, so every month's opening balances include it and no month's activity does: the cash flow and the equity statement start from it rather than counting it. Name the equity account that takes any difference between debits and credits (equity_element_id, usually Opening Balance Equity); unbalanced balances without one are refused, and an income or expense account is refused, since income before the books begin is in retained earnings. One per entity: recording it again replaces it, until the entity's first close, after which a correction is an adjusting entry in an open month. Set up the fiscal calendar first; moving its start (change-calendar-start) moves the opening with it.
Idempotency: supply an Idempotency-Key header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
Authentication
Authenticate in any one of these ways — not all of them:
- API key in the
X-API-Keyheader. - Bearer token in the
Authorizationheader.
Path parameters
| Name | Type | Description |
|---|---|---|
graph_idrequired | string | Graph Id Constraints: matches |
Header parameters
| Name | Type | Description |
|---|---|---|
Idempotency-Keyoptional | string | Idempotency-Key |
Request body
Required, application/json.
| Field | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entity_idoptional | string | The entity whose books start here; omit for the group parent. | ||||||||||||
balancesrequired | OpeningBalanceInput[] | One balance per balance-sheet account (assets, liabilities, equity). An income or expense account is refused: income before the books begin is already in retained earnings. Constraints: at least 1 item OpeningBalanceInput fields
| ||||||||||||
equity_element_idoptional | string | The equity account that takes any difference between debits and credits, usually Opening Balance Equity. Required when the balances do not balance; a non-zero balance left there is a review item. | ||||||||||||
memooptional | string | The entry's memo; defaults to 'Opening balances'. |
Example request
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/record-opening-balance" \
-H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
-H "Idempotency-Key: <Idempotency-Key>" \
-H "Content-Type: application/json" \
-d '{
"balances": [
{
"element_id": "string"
}
]
}'Responses
200 Successful Response
| Field | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operationrequired | string | Kebab-case operation name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
operationIdrequired | string | op_-prefixed ULID for audit and SSE correlation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
statusrequired | string | Operation lifecycle state One of: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resultoptional | JournalEntryResponse | Command-specific result payload JournalEntryResponse fields
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
atrequired | string | ISO-8601 UTC timestamp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
createdByoptional | string | User ID that initiated the operation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
idempotentReplayoptional | boolean | True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions. Default: |
| Status | Meaning |
|---|---|
| 400 | Invalid request |
| 401 | Authentication required |
| 403 | Access denied |
| 404 | Resource not found |
| 409 | Idempotency-Key conflict — key reused with different body |
| 422 | Validation error |
| 429 | Rate limit exceeded |
| 500 | Internal server error |