Threshold Validation Edge Function
API Contract
REST
/functions/v1
6 endpoints
POST
/functions/v1/functions/v1/validate-expense-threshold
Validate a claim against organisation threshold config (validateThreshold)
Public
Request Example
{
"claim_id": "clm_9f2a3b4c",
"organisation_id": "org_001"
}
Response Example
{
"claim_id": "clm_9f2a3b4c",
"organisation_id": "org_001",
"valid": true,
"auto_approvable": false,
"combined_total": 4850,
"combined_distance_km": 0,
"threshold": {
"amount_limit": 1000,
"distance_limit_km": 200
},
"expense_lines_fetched": 2,
"evaluated_at": "2026-03-26T08:05:00Z"
}
GET
/functions/v1/functions/v1/validate-expense-threshold
List edge function invocation logs
Public
Response Example
{
"data": [
{
"invocation_id": "inv_x1y2z3a4",
"claim_id": "clm_9f2a3b4c",
"organisation_id": "org_001",
"auto_approvable": false,
"invoked_at": "2026-03-26T08:05:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 102
}
}
GET
/functions/v1/functions/v1/expense-lines/:claim_id
Fetch expense lines for a claim (fetchExpenseLines)
Public
Response Example
{
"claim_id": "clm_9f2a3b4c",
"expense_lines": [
{
"line_id": "line_001",
"description": "Train Oslo-Bergen",
"amount": 1200,
"category": "transport",
"distance_km": 0,
"receipt_url": "https://storage.example.com/receipts/rcpt_001.pdf"
},
{
"line_id": "line_002",
"description": "Hotel 2 nights",
"amount": 3650,
"category": "accommodation",
"distance_km": 0,
"receipt_url": "https://storage.example.com/receipts/rcpt_002.pdf"
}
]
}
GET
/functions/v1/functions/v1/threshold-config/:organisation_id
Fetch threshold config for an organisation (fetchThresholdConfig)
Public
Response Example
{
"organisation_id": "org_001",
"threshold_id": "thr_org001",
"amount_limit": 1000,
"distance_limit_km": 200,
"currency": "NOK",
"updated_at": "2026-01-15T10:00:00Z"
}
PUT
/functions/v1/functions/v1/threshold-config/:organisation_id
Update threshold configuration via edge function
Public
Request Example
{
"amount_limit": 1500,
"distance_limit_km": 300
}
Response Example
{
"organisation_id": "org_001",
"amount_limit": 1500,
"distance_limit_km": 300,
"updated_at": "2026-03-26T09:00:00Z"
}
DELETE
/functions/v1/functions/v1/threshold-config/:organisation_id
Delete threshold configuration for an organisation
Public
Response Example
{
"deleted": true,
"organisation_id": "org_001"
}