Upsert Snapshot Endpoint
POST
/api/v1/snapshots/upsert
const url = 'https://example.com/api/v1/snapshots/upsert';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"account_id":1,"date":"2026-04-15","balance":1,"currency":"example","source":"manual","note":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/snapshots/upsert \ --header 'Content-Type: application/json' \ --data '{ "account_id": 1, "date": "2026-04-15", "balance": 1, "currency": "example", "source": "manual", "note": "example" }'Create or update a snapshot for an account.
If no snapshot exists for (account_id, date): creates one → action=“created”. If a snapshot exists with a different balance: updates it → action=“updated”. If a snapshot exists with the same balance: no-op → action=“unchanged”.
Webhooks are fired only for “created” and “updated”, not “unchanged”.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
SnapshotCreate
Schema for snapshot creation — enforces non-negative balance (SNAP-04).
source defaults to ‘manual’, accepts ‘manual’, ‘import’, or ‘recurring’. note is optional, max 500 chars.
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
UpsertSnapshotResponse
Response for POST /api/v1/snapshots/upsert — create or update.
object
snapshot
required
SnapshotOut
Schema for snapshot response — ORM serialization via from_attributes.
object
id
required
Id
integer
account_id
required
Account Id
integer
date
required
Date
string format: date
balance
required
Balance
string
currency
required
Currency
string
source
required
Source
string
created_at
required
Created At
string format: date-time
updated_at
required
Updated At
string format: date-time
action
required
Action
string
Example generated
{ "snapshot": { "id": 1, "account_id": 1, "date": "2026-04-15", "balance": "example", "currency": "example", "source": "example", "note": "example", "deleted_at": "2026-04-15T12:00:00Z", "created_at": "2026-04-15T12:00:00Z", "updated_at": "2026-04-15T12:00:00Z" }, "action": "example"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}