v1
latestOpenAPI 3.1.02026-07-13154170539.0 KBLogs
Atomic Field Update
Apply an atomic operation to a numeric field in a log entry.
This endpoint performs race-safe atomic updates directly in PostgreSQL, ensuring correct results even under high concurrent load.
Supported operations:
- +N: Add N to the current value
- -N: Subtract N from the current value
- *N: Multiply the current value by N
- /N: Divide the current value by N
If the field doesn't exist or is NULL, it is treated as 0 before the operation.
patch/v0/logs/{log_id}/fields/{field_name}/atomic
Path parameters
log_idinteger required
The ID of the log to update
The ID of the log to update
field_namestring required
The name of the field to update atomically
The name of the field to update atomically
Request body
Example request
{
"operation": "+1",
"field": "cumulative_spend",
"project": "Assistants",
"context": "42/7/Spending/Monthly",
"unique_keys": {
"_assistant_id": "str",
"month": "str"
},
"initial_data": {
"_assistant_id": "123",
"_org_id": 456,
"month": "2026-01"
}
}Response
Atomic operation applied successfully