Overview
A per diem (SubsistenceAllowance) is a daily allowance an employee claims for a business trip. The user enters where and when they travelled, and which meals and nights were already paid for. Findity calculates the allowance from the country’s rules and the organization’s settings. Your client never computes an amount.
A per diem has three parts:
- A category, which decides whether the trip is domestic or international.
- A travel route: a start stop, an end stop and, for an international trip, one or more stops in between, each with a destination and dates.
- Deductions: for each day (or 24-hour period) of the trip, whether breakfast, lunch or dinner was provided and whether accommodation was provided. Provided meals reduce the allowance.
PUT before the user continues.
Prerequisites
- Complete Authentication and obtain a user-scoped access token. Per diems belong to the signed-in user.
- Get the organization
idfrom Organizations. The examples useff808181963979e20196397a2098004b. - The organization must have per diem categories. If it has none, the fields call reports
NOT_VALID_CATEGORY_FOUND_FOR_ALLOWANCEand no form can be opened. An administrator has to set them up.
Key concepts
| Concept | Description |
|---|---|
| Domestic and international | Set by the category. A domestic trip has only a start and an end stop. An international trip has at least one stop in between and an addStop command. The category list doesn’t say which kind a category is: the fields response shows it. |
| Stop | One point of the route, with a destination and dates. Stops are numbered from 1: the start stop is 1, the stops in between follow, and the end stop is last. |
date1 and date2 | The dates of a stop: departure from the start stop is date1, arrival at the end stop is date2. The value is local time in the format yyyy-MM-dd HH:mm (control type LOCAL_DATE_TIME). Which dates a stop shows depends on the organization’s settings. |
| Destination | The country of a stop, picked from the destinations list. The start and end stops hold the organization’s home country and don’t show it. |
| Deduction period | One day or one 24-hour period of the trip, depending on the organization’s settings. Findity creates one deduction group per period from the trip’s start and end dates. Periods are numbered from 0. |
| Recent destinations | The destinations list can return the user’s recently used destinations first, as suggestions. Findity keeps the last 10 per user and organization, from the stops between start and end. |
API endpoints
All endpoints use the Expense API base URL. Examples use the stage environment; production uses the same paths onhttps://api.findity.com/api/v1/expense.
Required headers
Step 1 — Initialize the fields
Fetch an empty per diem form:cURL
expenseRecordId={expenseId}.
The response holds these top-level fields:
Custom dimensions such as project or cost center come last. Render only fields with
visible: true, and keep the hidden ones in your state.
Step 2 — Choose the category
Let the user pick the category from the list incategoryId.url. Because categoryId has requiresUpdate: true, send the full fields array back with a PUT after the change. The response has the route of the new trip type.
Step 3 — Build the travel route
The route groupverification.specifications holds the stops. The start and end stops’ fields sit directly in the group; each stop in between is its own FIELD_GROUP, verification.specifications[n].
On a domestic trip the route is stop
1 (start, with date1) and stop 2 (end, with date2). An international trip from Sweden to Oslo and back looks like this: stop 1 departs Sweden, stop 2 is Norway, stop 3 returns to Sweden.
Treat a change to any field inside the route as a change that needs a
PUT: the route group has requiresUpdate: true, and the server uses the dates to check their order and to create the deduction periods in Step 4.Pick a destination
The destination field’surl points to the destinations list with includeSuggestions=5:
cURL
JSON
suggestions first, under the section text from meta.sections, then the full list in data. Names come in the user’s language, sorted by name. The list depends on the organization’s booking country, not on the trip.
A destination becomes a recent one when the user saves a per diem with it on a stop between start and end.
Add and remove stops
On an international trip the route has aCOMMAND field, verification.specifications.addStop, whose command is action=addStop&afterIndex={n}. Send the full fields array with the command in the query:
cURL
2. The stops after it move up by one, so stop 3 becomes stop 4. Re-read the indexes from the response; never keep them in your own state across a PUT.
The last three have
confirmationRequired: true: show the confirmation text and send the command only when the user confirms. A command without its afterIndex or atIndex returns 400 MISSING_PARAMETER.
Step 4 — Record meals and accommodation
Once the start and end dates are valid,verification.deductionAndAccommodation holds one group per deduction period, verification.deductionAndAccommodation[i], numbered from 0:
The groups are regenerated from the dates on every
PUT, and answers are matched back to their period by date. Shortening the trip drops the answers for the days that no longer exist.
On a domestic trip where the user chose meal compensation, the groups are verification.mealCompensation[i] with two switches, meal1 and meal2, instead.
Step 5 — Save the expense
When the form is complete, create the per diem with the full fields array:cURL
PUT /expenses/{expenseId}?format=fields.
A save with validation errors returns 400 VALIDATION_FAILED_FOR_EXPENSE_RECORD and stores nothing. Add forceSave=true to save it anyway as a draft the user fixes later. A route without stops, a stop between start and end without a destination, or an enabled date without a value can’t be force-saved.
Using the JSON format
A backend integration that owns its data can send the per diem as JSON toPOST /expenses instead. The stops go in verification.specifications in route order, and their role comes from their position: the first is the start, the last is the end. This is the Oslo trip from Step 3:
JSON
PAID_YOURSELF means the meal was not provided. The other meal values are FOOD_BENEFITS, BREAKFAST_IN_HOTEL, FOOD_IN_TICKET, FOOD_IN_REPRESENTATION and LUNCH_BENEFITS_SODEXO. The Create expense reference has the full schema.
Step 6 — Send it in a report
Add the per diem to a report withexpenseReportId, or through Expense reports, and send the report. When the report is sent, Findity checks that per diems don’t overlap:
OVERLAPPING_SUBSISTENCE_ALLOWANCE_IN_CURRENT_REPORT: the per diem’s dates overlap another per diem in the same report. Only the later per diem of an overlapping pair gets the error.OVERLAPPING_SUBSISTENCE_ALLOWANCE_IN_OTHER_REPORT: the dates overlap a per diem in another of the user’s submitted reports.
_TWO when the per diem overlaps two others and in _MORE when it overlaps three or more. Both are BLOCKERs, so the report can’t be sent until the user changes the dates or removes a per diem. errorText names the per diems and the dates, for example:
JSON
Error handling
Validation errors come back in
validationErrors, or on the field itself as error and errorText:
Next steps
Dynamic fields
The field object, control types and the update cycle.
Expense reports
Add per diems to a report and send it for approval.

