API Reference
Table of contents
API Reference
Base URL
Health check
Submit reconciliation job
Poll job status
Retrieve reconciliation report
Human review queue
List bank ledger rows for manual match
Submit human review decision
Download Excel report
Authentication
Auth endpoints
Tenant settings (mgmt app, JWT tenant_user)
Admin-only
User management (admin app, JWT admin)
Platform endpoints
List jobs
Job progress stream (SSE)
List tenants (admin only)
Create tenant (admin only)
Generate API key (admin only)
Ingest transactions
Register webhook
Analytics summary
Bank accounts and ledger
Create bank account
Upload bank statement (standalone)
Additional platform endpoints
Job lifecycle
Error responses
OpenAPI
Base URL
Environment
Base URL
Local API
http://localhost:8000
Docker (direct)
http://localhost:8000
Docker (via frontend nginx)
http://localhost:5173/api
Vite dev proxy
http://localhost:5173/api
Interactive documentation: http://localhost:8000/docs (Swagger UI)
All v1 routes are prefixed with /api/v1.
Health check
Returns service status and version.
Response 200
{
"status" : "ok" ,
"version" : "0.1.0" ,
"env" : "development"
}
Submit reconciliation job
Content-Type: multipart/form-data
Field
Type
Required
Description
payment_proofs
file[]
Yes
One or more payment proof files
bank_statement
file (repeatable)
One of three sources
Bank statement file(s) (XLSX, CSV, or PDF). Multiple files are merged into one ledger. Omit when using ledger references.
bank_statement_id
string (UUID)
One of three sources
Single uploaded statement from /bank-accounts/{id}/statements or /bank-statements. Uses uncleared entries only.
bank_account_id
string (UUID)
One of three sources
Registered bank account. Aggregates all pending (uncleared) ledger entries across every statement for that account.
base_currency
string
No
ISO 4217 code (default: MYR)
Accepted MIME types for proofs: image/jpeg, image/png, image/webp, application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, text/csv, application/csv
Query parameters
Param
Type
Default
Description
dry_run
bool
false
When true, runs the pipeline inline and returns the full report (DryRunResponse, status 200 , no Celery enqueue). Useful for integration tests.
Response 201 (default enqueue)
{
"job_id" : "550e8400-e29b-41d4-a716-446655440000" ,
"status" : "PENDING" ,
"created_at" : "2026-05-23T10:00:00Z"
}
Errors
Status
Cause
400
Missing proofs, conflicting bank sources, or account has no pending ledger entries
502
Storage upload failure
Example
curl -X POST http://localhost:8000/api/v1/jobs \
-H "Authorization: Bearer YOUR_JWT" \
-F "payment_proofs=@invoice.pdf" \
-F "payment_proofs=@receipt.png" \
-F "bank_statement=@statement.csv" \
-F "base_currency=MYR"
Poll job status
Response 200
{
"job_id" : "550e8400-e29b-41d4-a716-446655440000" ,
"status" : "MATCHING" ,
"progress_pct" : 50.0 ,
"agents_completed" : [ "ingestion" , "normalisation" ],
"error" : null ,
"created_at" : "2026-05-23T10:00:00Z" ,
"updated_at" : "2026-05-23T10:00:15Z"
}
Job statuses
Status
Meaning
Badge
PENDING
Queued, not yet started
Pending
INGESTING
Extraction stage in progress
Ingesting
NORMALISING
FX conversion and tolerance calculation
Normalising
MATCHING
Match scoring and LLM reasoning
Matching
REPORTING
Report synthesis and Excel preparation
Reporting
COMPLETED
Finished successfully
Complete
AWAITING_REVIEW
Uncertain items need review
Review
FAILED
Unrecoverable error
Failed
CANCELLED
Cancelled via POST …/cancel
Cancelled
Errors: 404 if job not found.
The frontend polls this endpoint every 2 seconds until a terminal status is reached.
Retrieve reconciliation report
Response 200 — ReconciliationReport
{
"job_id" : "550e8400-e29b-41d4-a716-446655440000" ,
"summary" : {
"total" : 4 ,
"matched" : 2 ,
"uncertain" : 1 ,
"unmatched" : 1 ,
"total_value_myr" : "1234.56"
},
"matches" : [ "..." ],
"audit_log" : [ "..." ]
}
Each match in matches includes:
Field
Type
Description
id
UUID
Match identifier
status
enum
MATCHED | UNCERTAIN | UNMATCHED
confidence
float
0.0 – 1.0 composite score
amount_variance_myr
string
Decimal as string
variance_explanation
string
Plain-language explanation
reasoning_chain
string
Full LLM chain for audit
normalised_record
object
Payment + MYR amounts + tolerance bounds
bank_entry
object | null
Matched bank statement row
Live data after human review: Match rows and summary counts are merged from the database on each request (not a frozen pipeline snapshot). After you confirm or reject via the review endpoint, call this again — or refresh the results page — to see updated statuses and counts. The executive narrative text is generated once at report time and is not regenerated after review.
Errors: 404 job not found · 409 job not yet complete
Human review queue
Response 200 — MatchResult[]
[
{
"id" : "..." ,
"status" : "UNCERTAIN" ,
"confidence" : 0.68 ,
"variance_explanation" : "Amount differs by MYR 0.20, likely due to FX rate on settlement date..." ,
"normalised_record" : { "..." },
"bank_entry" : { "..." }
}
]
Returns an empty array when no uncertain items remain.
List bank ledger rows for manual match
Returns uncleared ledger entries (when the job used a bank account or statement) or the bank statement snapshot stored on the job report (file upload jobs). Used by the review UI ledger picker.
Response 200 — array of BankEntry objects (id, value_date, amount, currency, description, reference, counterparty).
Submit human review decision
Content-Type: application/json
{
"action" : "confirm" ,
"bank_entry_id" : null ,
"note" : "Verified against SWIFT advice"
}
Field
Type
Required
Description
action
enum
Yes
confirm | reject | manual_match
bank_entry_id
UUID
For manual_match only
Target bank entry from GET .../bank-entries
note
string
No
Optional reviewer note
Response 200
{
"match_id" : "..." ,
"status" : "MATCHED" ,
"human_reviewed" : true ,
"note" : "Matched to Moonshot debit" ,
"bank_entry" : { "id" : "..." , "value_date" : "2026-04-30" , "amount" : "-20.20" , "currency" : "MYR" }
}
Idempotency: Re-submitting confirm or reject on an already-reviewed match returns the current state without error. manual_match may be submitted again to change the linked bank entry and note.
Side effects: Updates the match row, refreshes the stored report blob (matches + summary), and sets job status to COMPLETED when no uncertain items remain. For jobs tied to a bank account or statement ledger, confirm and manual_match mark the linked bank entry cleared (same as auto-matched rows at pipeline completion).
Errors: 404 match not found · 409 invalid job state
Download Excel report
Response 200
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="aria-reconciliation-{job_id}.xlsx"
Sheets: Summary · Matched · Exceptions · Audit Log
Uses the same live hydrated report as GET /results (reflects human review decisions).
Errors: 404 job not found (includes cross-tenant access) · 409 report not yet available
Example
curl -H "Authorization: Bearer YOUR_JWT" -OJ \
http://localhost:8000/api/v1/jobs/YOUR_JOB_ID/export
Authentication
All /api/v1 endpoints (except /health, /docs, /redoc, /openapi.json, /api/v1/auth/login) accept either :
JWT — Authorization: Bearer <token> from POST /api/v1/auth/login (Admin and Tenant mgmt UIs)
API key — X-API-Key: aria_… (NovaPay reference client, external integrators, scripts)
Client
API authentication
UI sign-in
NovaPay (:5173)
X-API-Key via VITE_API_KEY
Demo credentials only (finance@novapay.demo / novapay2026) — no backend auth call
Admin (:5174)
JWT Bearer
POST /api/v1/auth/login (platform admin)
Tenant mgmt (:5175)
JWT Bearer
POST /api/v1/auth/login (tenant user)
# Login
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@aria.local","password":"your-password"}'
# Use token
curl -H "Authorization: Bearer YOUR_JWT" http://localhost:8000/api/v1/jobs
Status
Cause
401
Missing/invalid token or API key
403
Valid auth but insufficient role
Auth endpoints
Method
Path
Description
POST
/api/v1/auth/login
Email + password → JWT
GET
/api/v1/auth/me
Current user (Bearer required)
Tenant settings (mgmt app, JWT tenant_user)
Method
Path
Description
GET/POST
/api/v1/tenant/keys
List/create API keys
DELETE
/api/v1/tenant/keys/{id}
Revoke key
GET/POST
/api/v1/tenant/users
List/invite tenant users
Admin-only
Method
Path
Description
GET
/api/v1/analytics/admin/summary
Cross-tenant analytics
GET
/api/v1/ingest/admin/queue
All tenant queue status
POST
/api/v1/ingest/admin/queue/flush/{tenant_id}
Flush tenant buffer
Legacy admin API key (ADMIN_API_KEY) still works for programmatic tenant management via X-API-Key.
User management (admin app, JWT admin)
Method
Path
Description
POST
/api/v1/users
Create user (admin or tenant_user; tenant_id required for tenant users)
GET
/api/v1/users
List users (optional tenant_id; page default 1, page_size default 50, max 200)
DELETE
/api/v1/users/{user_id}
Deactivate user (sets is_active=false; does not hard-delete)
List jobs
Returns a paginated list of jobs scoped to the authenticated tenant.
Query parameters
Param
Type
Default
Description
page
int
1
Page number
page_size
int
20
Items per page (max 100)
status
enum
—
Filter by job status
Response 200
{
"items" : [
{
"job_id" : "550e8400-..." ,
"status" : "COMPLETED" ,
"progress_pct" : 100.0 ,
"base_currency" : "MYR" ,
"record_count" : 12 ,
"matched_count" : 10 ,
"uncertain_count" : 1 ,
"unmatched_count" : 1 ,
"created_at" : "2026-05-23T10:00:00Z" ,
"updated_at" : "2026-05-23T10:00:45Z"
}
],
"total" : 42 ,
"page" : 1 ,
"page_size" : 20
}
Job progress stream (SSE)
Server-Sent Events stream delivering real-time pipeline progress. Events are emitted at each agent boundary.
Response — text/event-stream
Event types:
Event
When
Payload fields
status_change
Status transition
status, progress_pct
agent_complete
Pipeline stage finishes
agent, status, progress_pct, agents_completed
progress_update
Progress tick
progress_pct
completed
Terminal — all resolved
status, summary (matched, uncertain, unmatched, total)
review_required
Terminal — items need review
status, summary
error
Terminal — pipeline failed
status, error
event: status_change
data: {"status": "INGESTING", "progress_pct": 5.0}
event: agent_complete
data: {"agent": "ingestion", "progress_pct": 25.0, "agents_completed": ["ingestion"]}
event: completed
data: {"status": "COMPLETED", "summary": {"matched": 10, "uncertain": 1, "unmatched": 1, "total": 12}}
The frontend useJobStream hook wraps EventSource, reconnects on transient errors, and hydrates the TanStack Query cache on each event. Polling via GET /jobs/{id} is retained as a fallback.
Authentication: Browsers cannot send Authorization headers on EventSource. Pass credentials as query parameters:
?access_token=YOUR_JWT — tenant or admin JWT from login
?api_key=aria_… — tenant API key (used by the NovaPay reference client)
Both are accepted on the stream path only.
List tenants (admin only)
Requires admin JWT or X-API-Key: {ADMIN_API_KEY}.
Response 200 — TenantResponse[]
Create tenant (admin only)
Requires admin JWT or X-API-Key: {ADMIN_API_KEY}.
Request body
Response 201
{
"id" : "..." ,
"name" : "Acme Corp" ,
"created_at" : "2026-05-23T10:00:00Z"
}
Generate API key (admin only)
Request body
{ "label" : "Production webhook integration" }
Response 201
{
"id" : "..." ,
"tenant_id" : "..." ,
"label" : "Production webhook integration" ,
"enabled" : true ,
"created_at" : "2026-05-23T10:00:00Z" ,
"key" : "aria_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
The key field is returned only on creation — it is never retrievable again. Store it securely immediately.
| Method | Path | Description |
| — | — | — |
| GET | /api/v1/tenants/{id}/keys | List all keys for tenant |
| DELETE | /api/v1/tenants/{id}/keys/{key_id} | Revoke key |
Ingest transactions
Push raw transactions from external systems into the buffer. Transactions are automatically batched into reconciliation jobs by Celery Beat when the count or time threshold is reached.
Request body
{
"transactions" : [
{
"payment_proof_b64" : "<base64-encoded image or PDF>" ,
"corridor" : "USD/MYR" ,
"value_date" : "2026-05-23"
}
]
}
Field
Type
Description
payment_proof_b64
string
Base64-encoded document (mutually exclusive with storage_key)
storage_key
string
Pre-uploaded MinIO key
corridor
string
e.g. USD/MYR, EUR/MYR
value_date
date
Transaction value date
Response 202
{ "buffered" : 12 , "tenant_id" : "..." }
| Method | Path | Description |
| — | — | — |
| GET | /api/v1/ingest/queue | Queue status by corridor + trigger prediction |
| POST | /api/v1/ingest/queue/flush | Force-batch immediately |
Register webhook
Request body
{
"url" : "https://erp.example.com/webhooks/aria" ,
"events" : [ "job.completed" , "job.review_required" ],
"label" : "ERP integration"
}
Supported events: job.created, job.stage_completed, job.completed, job.review_required, job.failed
Response 201
{
"id" : "..." ,
"url" : "https://erp.example.com/webhooks/aria" ,
"events" : [ "job.completed" , "job.review_required" ],
"enabled" : true ,
"created_at" : "2026-05-23T10:00:00Z" ,
"secret" : "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
The secret is returned only on creation. Store it securely — ARIA encrypts the signing secret at rest in the database (see WEBHOOK_SECRET_ENCRYPTION_KEY in configuration). Use the raw secret to verify HMAC-SHA256 signatures on incoming webhook payloads:
X-ARIA-Signature: sha256=<hmac_hex>
X-ARIA-Timestamp: <unix_timestamp>
Delivery is retried up to 5 times with exponential backoff. Payloads that do not receive a 2xx within 10 seconds are retried.
| Method | Path | Description |
| — | — | — |
| GET | /api/v1/webhooks | List all webhooks |
| DELETE | /api/v1/webhooks/{id} | Remove webhook |
| POST | /api/v1/webhooks/{id}/test | Queue job.test delivery (no real job row; requires Celery worker) |
| GET | /api/v1/webhooks/{id}/deliveries | Delivery history (job_id is null for test events) |
Analytics summary
Aggregated reconciliation statistics for the authenticated tenant.
Query parameters
Param
Type
Default
Description
period_start
date
30 days ago
Start of reporting window
period_end
date
today
End of reporting window
Response 200
{
"tenant_id" : "..." ,
"period_start" : "2026-04-23" ,
"period_end" : "2026-05-23" ,
"total_jobs" : 15 ,
"total_records" : 312 ,
"matched_records" : 289 ,
"uncertain_records" : 18 ,
"unmatched_records" : 5 ,
"avg_match_rate" : 0.926 ,
"avg_processing_seconds" : 41.2 ,
"escalation_rate" : 0.058 ,
"by_corridor" : [
{ "corridor" : "*/MYR" , "job_count" : 8 , "record_count" : 180 , "avg_match_rate" : 0.944 }
]
}
Bank accounts and ledger
Tenants register named bank accounts, upload monthly statements, and browse a persistent ledger. Entries are marked cleared when matched by a reconciliation job (auto-match at pipeline completion, or human confirm / manual_match during review).
Ledger amount convention: positive = deposit/credit (money in), negative = withdrawal/debit (money out). PDF parsers read separate Withdrawal/Deposit columns when present (e.g. CIMB) and never store the running balance as the transaction amount.
Create bank account
Request body (application/json)
{
"name" : "Main Operating" ,
"bank_name" : "Maybank" ,
"currency" : "MYR" ,
"account_number_last4" : "1234"
}
Response 201 — BankAccountResponse
Method
Path
Description
GET
/api/v1/bank-accounts
List accounts for authenticated tenant
GET
/api/v1/bank-accounts/{id}
Account detail
PATCH
/api/v1/bank-accounts/{id}
Edit account metadata (name, bank name, last4)
DELETE
/api/v1/bank-accounts/{id}
Delete account
POST
/api/v1/bank-accounts/{id}/statements
Upload statement (multipart) to account
GET
/api/v1/bank-accounts/{id}/statements
List statements for account
DELETE
/api/v1/bank-accounts/{id}/statements/{statement_id}
Delete statement and all its ledger entries
GET
/api/v1/bank-accounts/{id}/ledger
Paginated ledger entries (cleared filter optional)
POST
/api/v1/bank-accounts/{id}/ledger
Create a single ledger entry (creates a manual statement on first use)
POST
/api/v1/bank-accounts/{id}/ledger/bulk
Bulk create ledger entries (max 500 per request)
GET
/api/v1/bank-accounts/{id}/ledger/export
Excel export — 5 sheets (Cover, All, Cleared, Uncleared, FX Summary); supports date_from, date_to, cleared filters
PATCH
/api/v1/bank-accounts/{id}/ledger/{entry_id}
Edit a pending ledger entry
DELETE
/api/v1/bank-accounts/{id}/ledger/{entry_id}
Delete a pending ledger entry (409 if cleared)
Upload bank statement (standalone)
Content-Type: multipart/form-data
Field
Type
Required
Description
bank_statement
file
Yes
XLSX, CSV, or PDF
base_currency
string
No
Default MYR
account_id
UUID
No
Link statement to a bank account
Response 201 — BankStatementUploadResponse with entry_count and statement period dates.
Method
Path
Description
GET
/api/v1/bank-statements
List statements (paginated)
GET
/api/v1/bank-statements/{id}
Statement detail with all entries
GET
/api/v1/bank-statements/{id}/entries
Entries only (cleared filter optional)
Method
Path
Description
POST
/api/v1/jobs/{job_id}/cancel
Cancel a non-terminal job (PENDING through REPORTING, or AWAITING_REVIEW)
DELETE
/api/v1/jobs/{job_id}
Delete a job and its stored artifacts
GET
/api/v1/schedules
List reconciliation schedules for the tenant
POST
/api/v1/schedules
Create a schedule (run_time_utc HH:MM, days_of_week 0=Mon…6=Sun, bank_account_id, base_currency, enabled)
PUT
/api/v1/schedules/{id}
Update a schedule
DELETE
/api/v1/schedules/{id}
Delete a schedule
GET
/api/v1/analytics/performance
Tenant AI performance metrics
GET
/api/v1/analytics/escalation-breakdown
Escalation counts by reason
POST
/api/v1/webhooks/{id}/deliveries/{delivery_id}/resend
Retry a failed webhook delivery
GET
/api/v1/vendor-rules
List tenant vendor rules (AI feedback from review)
PUT
/api/v1/vendor-rules/{id}
Update a vendor rule
DELETE
/api/v1/vendor-rules/{id}
Delete a vendor rule
Job lifecycle
stateDiagram-v2
[*] --> PENDING
PENDING --> INGESTING
INGESTING --> NORMALISING
NORMALISING --> MATCHING
MATCHING --> REPORTING
REPORTING --> COMPLETED
REPORTING --> AWAITING_REVIEW
REPORTING --> FAILED
INGESTING --> FAILED
NORMALISING --> FAILED
MATCHING --> FAILED
PENDING --> CANCELLED: cancel
INGESTING --> CANCELLED: cancel
NORMALISING --> CANCELLED: cancel
MATCHING --> CANCELLED: cancel
REPORTING --> CANCELLED: cancel
AWAITING_REVIEW --> COMPLETED: human review
COMPLETED --> [*]
FAILED --> [*]
CANCELLED --> [*]
Error responses
All errors return JSON:
{
"detail" : "Human-readable error message"
}
Status
Domain errors
404
Job or match not found
409
Invalid job state (e.g. results before complete)
422
Extraction failure
502
LLM or storage error
503
FX rate unavailable (all providers failed)
OpenAPI
The live OpenAPI 3 schema is served at:
Frontend TypeScript types in each app’s src/types/api.ts (frontend-novapay, frontend-admin, frontend-tenant-mgmt) mirror these schemas. Monetary values are serialised as strings to preserve decimal precision across the JSON boundary.