Norulo ledger REST API
Record project and shared expenses, then read totals by currency. Platform billing is a separate account service.
Set up expenses with a Coding Agent
Give your Coding Agent the API guide and your costs. It can build out an empty ledger, organize projects and categories, and record expenses through the REST API.
Copy the API guide
Open the API page, click Copy for Agent, then paste it into your Coding Agent’s conversation.
Open API · Copy for AgentCreate an API key
Sign in and select the intended ledger in API Keys. Enable profile:read, projects:read, categories:read, expenses:read, expenses:write and reports:read. To create projects or categories, an Owner or Admin also needs projects:write and categories:write. Choose project restrictions and explicitly allow the shared pool when needed; setting up new projects needs all-project access. The token is shown once.
Create API keyStore the key securely
Set NORULO_API_KEY in the agent’s secure environment or secret manager, and NORULO_API_BASE to https://api.norulo.com. A local .env must be excluded from Git and explicitly loaded by the agent’s runtime. Tell the agent the variable names, never paste the key into chat, source code, browser variables or logs. The Bash example below reads it without echoing or putting it in shell history; the agent must inherit that environment.
Give the agent your expenses
Ask it to read the copied API guide, inspect the ledger, reuse or create the needed projects and categories, then add your expenses. Include dates, amounts, currencies and purposes. If the agent’s model supports images or PDFs, attach receipts and invoices too. The agent extracts structured fields; the REST API accepts JSON, with no receipt-upload endpoint. Confirm unclear fields before saving. Use the prompt below to get started.
Check the saved ledger
Have the agent read back each saved expense and report its ID, project or shared target, category, date and amount. Verify totals separately by currency in Overview. Add recurring schedules only when requested; recording a cost does not pay an invoice or renew a subscription.
Review expense totals
# Bash: run in the environment your Coding Agent will inherit. # Skip key input if your secure runtime already provides NORULO_API_KEY. export NORULO_API_BASE='https://api.norulo.com' read -r -s -p 'Norulo API key: ' NORULO_API_KEY printf '\n' export NORULO_API_KEY
How the ledger fits together
A ledger belongs to an Owner and contains projects, one shared pool and ledger-wide categories. Each expense belongs to exactly one project or the shared pool, and uses one category. Projects answer which product incurred the cost; categories describe what the cost was for, such as Hosting or Software. Shared costs, such as tools used by several projects, count once in ledger totals and are not split or copied across projects. GitHub links are optional. Start by reusing existing projects and categories; create only what is missing.
A prompt to send your agent
Read the Norulo API guide I pasted. Use NORULO_API_BASE and NORULO_API_KEY from your secure environment without displaying the key. Inspect my ledger and reuse existing projects and categories; create missing ones within your permissions. Organize the expenses I provide by project or shared pool, with category, date, exact amount, currency and purpose. If you can read my receipt images or PDFs, extract those fields. Ask me about unclear values before saving. Add the confirmed expenses via REST with a separate idempotency key for each, then read them back and report IDs and totals by currency. Create recurring schedules only if I request them.
Quickstart: save your first expense
The Web ledger and external clients use the same REST resources and business rules. Web authenticates with its login cookie; integrations use a Bearer API key. Projects, categories, project/shared expenses, recurring rules and member management use this API.
Sign in, select a ledger, and create at least one active category in Categories. A standalone project does not need GitHub. This example records a real shared expense and needs Bash, curl, jq and openssl. Replace the date, amount and purpose with your intended entry before running.
Open API Keys in the same ledger. Select profile:read, categories:read, projects:read, expenses:read, expenses:write and reports:read, and enable shared-pool access. Save the one-time token immediately; later key listings never reveal it. Keep it on your server in an environment variable. A key with an explicit empty project allowlist can access no projects; shared access is independent.
# Bash, curl, jq and openssl. Use a key from the same environment as this base.
set -euo pipefail
export NORULO_API_BASE='https://api.norulo.com'
# Skip these lines if your secure runtime already provides the key.
read -r -s -p 'Norulo API key: ' NORULO_API_KEY
printf '\n'
export NORULO_API_KEY
api() { curl --fail-with-body --silent --show-error \
"$NORULO_API_BASE$1" -H "Authorization: Bearer $NORULO_API_KEY" "${@:2}"; }
api /api/v1/me | jq '{id, workspace, scopes}'
api /api/v1/categories | jq '.[] | select(.archivedAt == null) | {id, name}'
export CATEGORY_ID='PASTE_AN_ACTIVE_CATEGORY_ID_FROM_ABOVE'
# One new intent gets one unique key. Keep it unchanged for a network retry.
export IDEMPOTENCY_KEY="expense-$(date +%s)-$(openssl rand -hex 8)"
BODY=$(jq -n --arg category "$CATEGORY_ID" \
'{target:{kind:"shared"},occurredOn:"2026-10-09",amount:"12.00",currency:"USD",categoryId:$category,purpose:"Hosting"}')
CREATED=$(api /api/v1/expenses -X POST -H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" --data "$BODY") || exit 1
printf '%s\n' "$CREATED" | jq .
export EXPENSE_ID=$(printf '%s' "$CREATED" | jq -r .id)
api "/api/v1/expenses/$EXPENSE_ID" | jq .
api "/api/v1/reports/summary?target=shared¤cy=USD" | jq .A successful create returns HTTP 201 and the expense object directly. Read id and revision from that object; there is no data wrapper. The following response is illustrative and omits timestamps, optional fields and assistance. Categories return a JSON array; expense/project/rule lists return items and nextCursor.
{
"id": "exp_example",
"target": {
"kind": "shared"
},
"occurredOn": "2026-10-09",
"amount": "12.00",
"currency": "USD",
"categoryId": "cat_example",
"purpose": "Hosting",
"amountMinor": 1200,
"revision": 1
}Project expenses use the same POST /api/v1/expenses endpoint. Choose an allowed active project from GET /api/v1/projects and use target.kind project with target.projectId. Shared expenses use target.kind shared and must omit projectId. Neither expenses nor recurring rules accept a separate workspace ID in the body.
api "/api/v1/projects?limit=50" | jq .
# Replace only the target in the create body with a real project ID:
# "target": {"kind":"project","projectId":"prj_FROM_PROJECTS_RESPONSE"}Environments and request URLs
Append the exact reference path to the base URL. Direct Server clients use /api/v1/... . The Web base ends in /api, so its ledger requests are /api/api/v1/...; the Web Worker removes only the outer /api. Authentication paths such as /auth/session have no /api/v1 prefix.
Direct: https://api.norulo.com Web proxy: https://norulo.com/api GET https://api.norulo.com/api/v1/me GET https://norulo.com/api/api/v1/me
The production ledger API is available at api.norulo.com and through the /api proxy on norulo.com. Use a production account and a key issued for the same ledger. Accounts, keys and data remain isolated between environments.
The Web REST client sends its HttpOnly login cookie and X-Norulo-Workspace for the selected ledger. Cookie writes require the configured trusted Origin; setting a Referer alone is insufficient for ledger writes. API-key requests use Authorization: Bearer and do not need a browser cookie. Account login, linking and joining another ledger remain explicit authenticated account flows.
Authentication
Create a key in API Keys with only the scopes needed. Project allowlists do not grant shared-pool access; enable that separately. A revoked key cannot read or write.
https://api.norulo.com
Authorization: Bearer nrk_example
Each key is bound to one ledger and cannot exceed its issuer's current member role. A member revision change invalidates team keys. Cookie clients can select a ledger with X-Norulo-Workspace; CSV links use workspaceId, and conflicting selectors are rejected. All members share the ledger Owner's plan and model allowance.
Scopes, roles and ledger boundaries
A scope never grants a stronger role. Every operation intersects the key's scopes, its bound ledger, the issuing member's current role and target restrictions. Owner and Admin manage projects/categories; Editor also writes expenses and recurring rules; Viewer reads. Only the Owner removes projects. Member changes invalidate keys tied to the old membership revision.
Member scopes apply to the whole bound ledger and cannot be combined with a project allowlist. Use a separate member-management key with no projectIds restriction. The shared switch still controls financial shared-pool access. Member scopes are opt-in, and Viewer/Editor cannot receive members:write.
Member REST reads require members:read; governance writes require members:write and the issuer's current Owner or Admin role. Owner manages Admins; Admin manages only Editors and Viewers. Governance keys must omit projectIds and remain bound to one ledger. Only the original inviter can approve or reject requests, using the request's If-Match revision. GET /api/v1/workspaces and GET /api/v1/workspace-invitation-requests expose only a key's bound ledger. Invitation preview and application still require the applicant's independent cookie account; a management key cannot join on their behalf.
GET /api/v1/me returns workspace.id and workspace.role. A Bearer key selects its own bound ledger; an X-Norulo-Workspace header or workspaceId query cannot switch it to another ledger. Use workspace.id in member-management paths. Web sessions list their ledgers and select one explicitly. Ledger quotas and Jev allowances belong to the Owner, while platform billing belongs to each account.
Projects
Create a standalone project with POST /api/v1/projects and a nonempty name, for example {"name":"Website launch"}. description is optional. Omit githubRepoIds or send []; omit githubOrganizationId or use null. Standalone projects work without installing the GitHub App on a repository. Authenticate normally.
To link GitHub, send githubRepoIds with 1–30 distinct numeric IDs authorized to the acting user. A non-null githubOrganizationId requires at least one repository and current access to that organization. GitHub organization access does not grant ledger membership.
PATCH /api/v1/projects/{id} requires If-Match. Omit githubRepoIds to keep the current links; send [] to remove every repository and automatically clear the organization. A project with no repositories must have a nonempty name; include name in the same PATCH if needed. Later links and removals preserve the project ID and expense history.
Standalone responses have githubRepoId: null, githubRepoIds: [], repositories: [] and githubAccess: "not_linked". Active standalone projects can record expenses under the usual role, scope and plan limits.
curl -X POST 'https://api.norulo.com/api/v1/projects' \
-H "Authorization: Bearer $NORULO_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"name":"Website launch"}'Editing, retries, pagination and money
GET the current resource before changing it. Send its numeric revision as a quoted If-Match header, for example If-Match: "7". PATCH/DELETE and approval actions use that resource's revision, not the ledger revision. HTTP 412 means the saved record changed: reload and reconcile your draft before another explicit write. HTTP 428 means the header is missing. Ledger resource DELETE actions return 204 with no JSON response body; account API-key revocation at /api-keys/{id} returns 200 with JSON.
CURRENT=$(api "/api/v1/expenses/$EXPENSE_ID") || exit 1
REVISION=$(printf '%s' "$CURRENT" | jq -r .revision)
# Expense PATCH replaces the complete editable input, not just one field.
EDIT=$(printf '%s' "$CURRENT" | jq \
'{target,occurredOn,amount,currency,categoryId,purpose:"Updated hosting",note,quantity,unit}')
api "/api/v1/expenses/$EXPENSE_ID" -X PATCH -H "Content-Type: application/json" \
-H "If-Match: \"$REVISION\"" --data "$EDIT" | jq .
# Removal is a separate, explicit operation using the latest revision.
REVISION=$(api "/api/v1/expenses/$EXPENSE_ID" | jq -r .revision)
api "/api/v1/expenses/$EXPENSE_ID" -X DELETE -H "If-Match: \"$REVISION\""POST ordinary expenses and recurring rules require Idempotency-Key (1–128 characters). Persist one key with its exact request body before sending. If the response is lost, retry the same body with that same key; an exact replay returns the original create response. A different body with the same key returns 409. A new expense, changed draft or new rule needs a new key. Do not automatically retry non-idempotent project, invitation, approval or review writes. If capacity replacement is enabled, replaying the same accepted expense request returns its original result without removing another expense. A failed new expense does not remove the old record.
Project, expense and recurring lists return {items, nextCursor}. limit is 1–100, default 50. Pass the opaque nextCursor as cursor with the same filters until it is null; stop if a cursor repeats. Categories and the bounded member roster do not use this page shape. Invitation-request lists return items and hasMore without a cursor; approving/rejecting then explicitly reloading advances pending requests. from includes the start date and to excludes the end date.
Send nonnegative amounts as decimal strings with the currency's precision, such as USD "12.00" or JPY "1200". Use uppercase three-letter currency codes and YYYY-MM-DD business dates. Single amountMinor values are safe integers in the currency's smallest unit; aggregate values above 9007199254740991 are exact integer strings. Use BigInt or decimal arithmetic and never combine currencies or convert unavailable amounts to zero.
api "/api/v1/expenses/export?target=shared&from=2026-10-01&to=2026-11-01" > expenses.csv
Project and category management
Before this workflow, set NORULO_API_KEY to a key with projects:read and projects:write. The quickstart key does not include project-write permission. Create a named standalone project with POST; edit only the intended fields with PATCH and If-Match. Optional developmentUrl and productUrl are absolute HTTP(S) URLs. GitHub links use authorized repository IDs, not names, and retain the same project ID and expense history when changed.
# Use an Owner key with profile:read, projects:read and projects:write.
export NORULO_API_KEY='PASTE_YOUR_PROJECT_MANAGEMENT_KEY'
PROJECT=$(api /api/v1/projects -X POST -H "Content-Type: application/json" \
--data '{"name":"Website launch","description":"Launch costs"}') || exit 1
PROJECT_ID=$(printf '%s' "$PROJECT" | jq -r .id)
REVISION=$(printf '%s' "$PROJECT" | jq -r .revision)
api "/api/v1/projects/$PROJECT_ID" -X PATCH -H "Content-Type: application/json" \
-H "If-Match: \"$REVISION\"" --data '{"name":"Website launch v2","productUrl":"https://example.com"}' | jq .
# Archive is reversible: PATCH {"status":"archived"}; restore with active.
# Owner-only removal is irreversible through this API; confirm intent first.
REVISION=$(api "/api/v1/projects/$PROJECT_ID" | jq -r .revision)
api "/api/v1/projects/$PROJECT_ID" -X DELETE -H "If-Match: \"$REVISION\""DELETE /api/v1/projects/{id} requires the actual ledger Owner, projects:write and the current project's If-Match revision. Cookie sessions and Owner API keys are supported; keys must have current ledger and project target permission. Admin, Editor and Viewer cannot remove projects. Confirmation permanently deletes the project, its currently assigned expenses, all its recurring schedules in every state and related business history. Existing expenses moved to another project or the shared pool remain. Success is 204; a stale revision is 412 and requires an explicit reload. Archive remains a separate action that preserves records.
POST /api/v1/categories/{id}/remove accepts an empty JSON body {} with If-Match and the existing categories:write authority. Referenced categories can be removed; successful removal returns 204 and retains historical names. Default GET /api/v1/categories hides removed categories. Financial history clients may request includeRemoved=true to read metadata with optional removedAt. Removed categories cannot be assigned to new expenses, selected by Jev, renamed or restored; an expense PATCH may retain that same expense's original removed categoryId. Category omission still means Automatic and may select only an active category. Schedules using a removed category are blocked with INVALID_CATEGORY on their next due run; choose an active category and explicitly Resume the blocked schedule. Archive remains distinct and does not hide the category from management.
Project and shared recurring expenses
Both targets use /api/v1/expense-recurring-rules with expenses:read/write and ordinary project/shared restrictions. Each successful occurrence creates one separate expense record, never a cumulative amount. A startOn on or before local today immediately records exactly one expense on startOn, without backfilling intervening periods; a future start waits. Future plans do not count as spent. On create or complete edit, categoryId may be omitted for Jev under the Owner’s eligible plan, enabled preference, availability and allowance. Only a confident active category is selected; explicit categories remain unchanged. CATEGORY_REQUIRED leaves the rule unsaved for manual category selection. Background posting reuses the saved category without calling Jev. Rules do not make payments or renew subscriptions.
# Use a key with expenses:read and expenses:write for this target.
export NORULO_API_KEY='PASTE_YOUR_EXPENSE_MANAGEMENT_KEY'
RULE_BODY=$(jq -n --arg category "$CATEGORY_ID" \
'{target:{kind:"shared"},amount:"12.00",currency:"USD",categoryId:$category,purpose:"Monthly hosting",
schedule:{frequency:"monthly",timezone:"Asia/Shanghai",startOn:"2026-11-01",day:1}}')
RULE_KEY="rule-$(date +%s)-$(openssl rand -hex 8)"
RULE=$(api /api/v1/expense-recurring-rules -X POST -H "Content-Type: application/json" \
-H "Idempotency-Key: $RULE_KEY" --data "$RULE_BODY") || exit 1
RULE_ID=$(printf '%s' "$RULE" | jq -r .id)
api "/api/v1/expense-recurring-rules?target=shared&limit=50" | jq .
# For a project rule, replace target with {kind:project, projectId:...}.schedule requires frequency, a valid IANA timezone, startOn and frequency-specific fields: weekly uses weekday (Monday=1…Sunday=7); monthly uses day (1–31); quarterly uses quarterMonth (1–3 within each calendar quarter) and day; yearly uses month (1–12) and day. Optional endOn is inclusive. Days beyond a month's end use its last day. GET returns nextOccurrenceOn, nextRunAt, status, revision and blockedCode; reads never generate expenses. nextOccurrenceOn is strictly after today in the schedule timezone, or null if no future occurrence remains. awaitingSync marks an overdue stored pointer projected forward by this read, without changing financial state. pendingOccurrences separately lists retained historical capacity failures.
REVISION=$(api "/api/v1/expense-recurring-rules/$RULE_ID" | jq -r .revision)
api "/api/v1/expense-recurring-rules/$RULE_ID" -X PATCH -H "Content-Type: application/json" \
-H "If-Match: \"$REVISION\"" --data '{"status":"paused"}' | jq .
# Read a fresh revision before each edit, resume or cancel.
# Resume: PATCH {"status":"active"}.
# Edit: PATCH the complete RULE_BODY (template + schedule); target is immutable.
REVISION=$(api "/api/v1/expense-recurring-rules/$RULE_ID" | jq -r .revision)
api "/api/v1/expense-recurring-rules/$RULE_ID" -X DELETE -H "If-Match: \"$REVISION\""Capacity failures advance the future calendar while preserving the first 10 unresolved pendingOccurrences per rule. Later failures are discarded while all 10 remain unresolved. Each retained item freezes periodKey, scheduledOn, amount, currency, purpose, categoryId, blockedCode and createdAt. English email goes to the saved execution account’s usable verified email; otherwise Norulo inbox is used. After fixing capacity, PATCH the rule with only {retryPeriodKey: the retained periodKey} and the current If-Match. A successful retry creates one separate expense and atomically removes that pending item, without changing the future schedule. A failed retry keeps it. An already posted period with a current revision returns the rule without another expense; a stale revision returns 412. Canceled rules reject retry. GET /api/v1/recurring-expense-notifications is a cookie-only, read-only account inbox across currently authorized ledgers; it returns up to 100 items and hasMore, excluding email-delivered or resolved entries.
# Resolve capacity first, then select one retained historical occurrence.
CURRENT=$(api "/api/v1/expense-recurring-rules/$RULE_ID") || exit 1
printf '%s\n' "$CURRENT" | jq .pendingOccurrences
# Replace with an actual periodKey from that response, such as M2026-09.
export RETRY_PERIOD_KEY='PASTE_RETAINED_PERIOD_KEY'
REVISION=$(printf '%s' "$CURRENT" | jq -r .revision)
RETRY_BODY=$(jq -n --arg period "$RETRY_PERIOD_KEY" '{retryPeriodKey:$period}')
api "/api/v1/expense-recurring-rules/$RULE_ID" -X PATCH -H "Content-Type: application/json" \
-H "If-Match: \"$REVISION\"" --data "$RETRY_BODY" | jq .
# Each success creates a separate expense using the frozen occurrence values.
# Re-read the current rule before another retry; no automatic write retry loop.Recurring REST reads use expenses:read; create, edit, pause, resume and cancel use expenses:write with current role and project/shared target permission. POST /api/v1/expense-recurring-rules requires Idempotency-Key; PATCH and DELETE /api/v1/expense-recurring-rules/{id} require If-Match. A key-created or key-resumed schedule retains only a credential hash internally. Every occurrence rechecks that key's expiry, revocation, scopes, ledger membership and target restrictions. A full edit or explicit Resume adopts the current actor and credential; a session edit or Resume removes an old key grant. Categories must be active, targets stay fixed, and canceling preserves previously recorded expenses.
Invitations and member management
Set NORULO_API_KEY to the separate member-management key before running this example; the quickstart key has no member scopes. Use a whole-ledger key with members:read/write. Read members, create/revoke invitations, read pending join requests, approve/reject them and edit/remove members through /api/v1/workspaces/{workspaceId}/... . Owner manages Admin/Editor/Viewer; Admin manages Editor/Viewer. The original inviter must still be authorized to approve or reject. Owner cannot be changed or removed by these endpoints.
# Use an Owner/Admin whole-ledger key: profile:read, members:read, members:write.
export NORULO_API_KEY='PASTE_YOUR_MEMBER_MANAGEMENT_KEY'
WORKSPACE_ID=$(api /api/v1/me | jq -r .workspace.id)
api "/api/v1/workspaces/$WORKSPACE_ID/members" | jq .
INVITE=$(api "/api/v1/workspaces/$WORKSPACE_ID/invites" -X POST \
-H "Content-Type: application/json" --data '{"role":"editor"}') || exit 1
INVITE_ID=$(printf '%s' "$INVITE" | jq -r .id)
# Give the applicant the one-time token from INVITE, in the Web invitation link.
api "/api/v1/workspaces/$WORKSPACE_ID/invites/$INVITE_ID/requests" | jq .
# After reading an actual pending applicant, set its id and revision:
REQUEST_ID='PASTE_PENDING_REQUEST_ID'
REQUEST_REVISION='PASTE_PENDING_REQUEST_REVISION'
api "/api/v1/workspaces/$WORKSPACE_ID/invites/$INVITE_ID/requests/$REQUEST_ID/approve" \
-X POST -H "Content-Type: application/json" -H "If-Match: \"$REQUEST_REVISION\"" --data '{}' | jq .
# Reject uses the same request revision and /reject instead of /approve.An invitation is a 24-hour link, not immediate membership. The token is returned only on creation. The applicant signs into their own account in Web, previews the link and explicitly submits a join request; these account actions use their own cookie session rather than a key bound to the inviting ledger. Pending/rejected applicants have no ledger access. After approval, the link closes. Sharing grants access to existing and future ledger data according to role, but never grants GitHub repository access.
USER_ID='PASTE_MEMBER_USER_ID'
REVISION=$(api "/api/v1/workspaces/$WORKSPACE_ID/members" \
| jq -r --arg id "$USER_ID" '.items[] | select(.userId == $id) | .revision')
api "/api/v1/workspaces/$WORKSPACE_ID/members/$USER_ID" -X PATCH \
-H "Content-Type: application/json" -H "If-Match: \"$REVISION\"" --data '{"role":"viewer"}' | jq .
# Re-read member revision before DELETE; the Owner cannot be removed.
# DELETE /api/v1/workspaces/$WORKSPACE_ID/members/$USER_ID
# Revoke an invitation: DELETE /api/v1/workspaces/$WORKSPACE_ID/invites/$INVITE_ID
# Both DELETE operations require the current record's quoted If-Match revision.Operation history
GET /api/v1/activity requires a project or shared target (project also needs projectId) and returns items, nextCursor and the server's rolling last-24-hour window. Page explicitly; no polling is necessary. API keys with expenses:read expose expense and recurring-rule activity within their target restrictions; project-setting activity additionally requires projects:read on the same key. Web cookie members see activity permitted by their current role. Events identify the actor and exact changes without exposing private email or credentials.
# Use a key with expenses:read; include projects:read for project-setting history. export NORULO_API_KEY='PASTE_YOUR_ACTIVITY_READ_KEY' export ACTIVE_PROJECT_ID='PASTE_AN_ACTIVE_PROJECT_ID' api "/api/v1/activity?target=shared&limit=50" | jq . api "/api/v1/activity?target=project&projectId=$ACTIVE_PROJECT_ID&limit=50" | jq .
Expense capacity and automatic removal
Expense capacity counts undeleted expenses in the Owner's visible ledger: shared-pool expenses and expenses in active or archived projects. Removing an expense manually or automatically, or removing its project, frees expense slots; archived projects still count toward project capacity, while removing a project frees its project slot. autoRemoveOldestExpense is Off by default on every plan. Off blocks new expenses at capacity. On, when exactly full, removes one oldest expense and saves the new expense atomically, without extra charges. Oldest means occurredOn first, then createdAt, then id. Removed expenses disappear from normal reads, reports and CSV. Internal immutable audit and idempotency records remain, without restoring removed expenses. The authorized last-24-hour operation log can still show removal events and their changes. Changing the switch does not immediately remove expenses or reset usage.
The oldest candidate is selected across the Owner's visible project and shared-pool expenses, including archived projects. The caller must be allowed to remove that exact record. A role or key restriction that forbids it returns 403 RETENTION_TARGET_FORBIDDEN; the server does not skip it and remove a newer permitted record. With automatic removal enabled, if a lower plan limit leaves usage above capacity, the server returns 403 RETENTION_CLEANUP_REQUIRED: remove expenses manually before creating another. Automatic removal replaces only one expense when exactly full, never performs bulk cleanup. Failed creation removes no expense; an exact Idempotency-Key replay removes no additional expense. Recurring generation follows the same Owner preference and capacity rules.
GET/PATCH /api/v1/account/expense-retention manage the signed-in account's own autoRemoveOldestExpense preference on every plan. They require a browser session Cookie; Bearer credentials are rejected. GET returns {autoRemoveOldestExpense, revision}. PATCH sends only {autoRemoveOldestExpense: boolean}, with that preference revision quoted in If-Match and a trusted app Origin or Referer. Selecting another shared workspace does not change which account is updated; that ledger uses its own Owner's preference. Changing the switch does not immediately remove expenses, reset usage or add charges. Read after a conflict before submitting another explicit change.
# Use your authenticated browser session, never a Bearer key.
# Keep the session cookie in a protected curl cookie-jar file.
export NORULO_COOKIE_JAR='/path/to/your/protected-cookie-jar'
export NORULO_APP_ORIGIN='https://norulo.com'
PREFERENCE=$(curl --fail-with-body --silent --show-error \
"$NORULO_API_BASE/api/v1/account/expense-retention" -b "$NORULO_COOKIE_JAR") || exit 1
REVISION=$(printf '%s' "$PREFERENCE" | jq -r .revision)
# This explicit choice affects future creates; it removes nothing immediately.
curl --fail-with-body --silent --show-error -X PATCH \
"$NORULO_API_BASE/api/v1/account/expense-retention" -b "$NORULO_COOKIE_JAR" \
-H "Origin: $NORULO_APP_ORIGIN" -H "Content-Type: application/json" \
-H "If-Match: \"$REVISION\"" --data '{"autoRemoveOldestExpense":true}' | jq .
# Disable with {"autoRemoveOldestExpense":false}, using a fresh revision.Filters and writes
Expense lists and reports share target, projectId, categoryId, from (inclusive), to (exclusive) and currency filters. Lists also use limit and cursor. Amounts are decimal strings on writes and minor units in totals. Currencies are never combined.
Use Idempotency-Key when creating an expense and If-Match with the latest revision when editing or removing one.
curl 'https://api.norulo.com/api/v1/expenses?target=shared&from=2026-09-01&to=2026-10-01' \ -H "Authorization: Bearer $NORULO_API_KEY"
Single expense amountMinor values are safe integers. Aggregate amountMinor totals are numbers up to 9007199254740991 and exact decimal integer strings above that boundary; parse large totals with BigInt or decimal arithmetic.
Automatic Jev assistance
Jev assists expense saves in Web and REST API when enabled, available and within the Owner’s call allowance: Free 20 one-time trials, Pro 1,000/month, Max 4,000/month. Members and API keys share it. Automatic categorization only selects a confident active category; explicit category, target, amount and currency stay unchanged. Otherwise choose a category and retry. Recurring setup supports Automatic; background posting reuses the saved category. Ordinary writes need no suggestions:use scope. Normal expenses:write and target permissions apply.
On POST/PATCH /api/v1/expenses, omit categoryId for Automatic while the Owner has Jev calls and enabled, available Jev. Free shares 20 one-time trials; Pro and Max have monthly calls. Explicit category, target, amount and currency stay unchanged. If no confident category is found, 422 CATEGORY_REQUIRED leaves input unsaved; choose a category and retry. Creates need a new Idempotency-Key; edits need the loaded If-Match revision and explicit reload after conflict. Recurring setup supports the same option; background posting uses the saved category.
Successful writes return the expense with an assistance object: status, categorySource (jev or user), suggestions and optional reason/modelVersion/questionVersion. Duplicate advice never blocks saving. Identical create requests with the same Idempotency-Key return the cached result without another model call. Reads do not invoke Jev.
curl -X POST 'https://api.norulo.com/api/v1/expenses' \
-H "Authorization: Bearer $NORULO_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: hosting-2026-09-unique' \
--data '{"target":{"kind":"shared"},"occurredOn":"2026-09-27","amount":"12.00","currency":"USD","purpose":"September hosting"}'Jev settings
GET/PATCH /api/v1/account/jev use the signed-in cookie account’s own preference; workspace selection and API keys grant no access to another Owner’s settings. Free can also toggle Jev. Responses expose enabled, revision, eligible, available, monthlyCalls, trialCalls and period; monthlyBudgetUsd is deprecated compatibility data. PATCH accepts only {enabled: boolean} and requires If-Match with the preference revision. After 412, explicitly GET before another choice. No model checks, expense changes or call refunds occur. Members inherit the ledger Owner’s preference.
Review saved expenses
POST /api/v1/expenses/{id}/review requires {}, If-Match of the loaded revision, expenses:write and normal role/target authority. Expense review loads up to 100 filtered expenses separately from the normal page. Only Start review sends one check at a time. Model checks share the Owner’s Free lifetime trial or paid monthly calls; each admitted attempt consumes one call, including failures. Stop ends queued work without refunding started checks. Reviews never edit expenses or advance revisions. Local duplicate checks remain available for paid ledgers with Jev off. Uncertain or unavailable is not a clear result; Edit reloads saved values without applying advice. No automatic retries or Idempotency-Key replay.
A review returns expenseId, revision, questionVersion, modelVersion, optional suggestionId and checks. Category and target checks use checked, issue, uncertain or unavailable, with current values and optional suggested values and confidence. Jev returns only predefined choices and scores. Optional reason values are fixed codes: disabled, provider_unavailable, no_categories or invalid_context. Duplicate checks use local rules on other expenses with the same authorized target, occurredOn date, currency and exact amount. Purpose does not need to match. The duplicate status is checked or issue; an issue may include candidate {id, revision}, without expense details. Local duplicate checks can remain available when the model is unavailable. Uncertain or unavailable does not mean a clear result. To edit, first GET the current expense with expenses:read, then explicitly PATCH it with expenses:write and the fresh If-Match revision.
curl -X POST 'https://api.norulo.com/api/v1/expenses/exp_example/review' \
-H "Authorization: Bearer $NORULO_API_KEY" \
-H 'Content-Type: application/json' \
-H 'If-Match: "7"' \
--data '{}'Error responses and recovery
Check the HTTP status before reading a success DTO. Business errors contain error.code; additional fields depend on the endpoint. A failure is not an empty list or a zero total. Do not invent success after a timeout: use the saved idempotency key for supported creates, or explicitly reload before deciding what to do next.
{"error":{"code":"CATEGORY_REQUIRED"}}Use /me entitlements for the Owner's current plan and configured allowances rather than hardcoding prices or capacity. Standard list pages are bounded to 100; recurring rules are bounded to 100 noncanceled rules per ledger; explicit expense review handles one expense per request and shares the monthly model allowance without a daily attempt cap. Request/schema limits and operation-specific errors are listed below in the complete reference. Read /me ledgerUsage for used, limit and remaining capacity: projects count current undeleted projects, including archived projects; expenseRecords count undeleted expenses in the visible ledger. Removing a project frees its project slot. Manual or automatic expense removal and project removal free expense slots, with no extra charges.
Free includes up to 300 expense records per ledger Owner, shared across projects, the shared pool and generated recurring expenses, including archived projects. Pro defaults to 20,000 and Max to 200,000. Read the current configured allowance in Billing; removing an expense frees a place.
Complete API reference
Expand an endpoint to see its authentication, parameters, request fields and every documented response. Field names and the formal contract descriptions are in English.