Skip to content

Payroll Export

Ditio generates payroll data automatically from the time registrations field workers submit and the payroll rules and absence codes configured in your company’s payroll setup. When a payroll period is approved, that data needs to reach your payroll or accounting system — this guide covers how to pull it out programmatically.

  • You run payroll in an external system (Visma, Tripletex, SAP, or a custom ERP) and want approved hours, overtime, allowances, and absences delivered automatically every period
  • You’re a payroll-system vendor building a standard Ditio connector
  • You want to replace a manual “download file, upload file” routine with a scheduled sync
Terminal window
# Test (default for all examples)
export DITIO_API_BASE="https://core-api.ditio.dev/core"
export DITIO_IDENTITY_BASE="https://identity.ditio.dev"
# Production — only after verifying in test
# export DITIO_API_BASE="https://core-api.ditio.app/core"
# export DITIO_IDENTITY_BASE="https://identity.ditio.app"

The preferred method is the JSON payroll export API. The response contains all data needed to convert into any accounting system format.

GET /api/payroll-export/

GET /api/payroll-export/readonly is an alias for the same JSON export.

ParameterTypeRequiredDescription
fromWorkDatestringNoStart date, e.g. 2026-01-01. Defaults to 14 days before now when omitted. Date ranges are limited to 45 days.
toWorkDatestringNoEnd date, e.g. 2026-01-31. Defaults to now when omitted. Date ranges are limited to 45 days.
modifiedSinceDatestringNoReturn payroll data modified since this date. The oldest supported value is one year back.
dataFilterintNo0 = only approved (default), 5 = only locked, 10 = all data
userIdslist of stringNoFilter by specific Ditio user IDs. If omitted, returns data for all users
userPayrollTypeFilterstringNopaid-by-hour (default), fixed-pay, or all-users
overridePayrollExportSettingsForFixedPayEmployeesboolNoInclude regular hours and absences for fixed-pay employees
exportAllPayrollTypesboolNoInclude payroll types marked “do not export” in Ditio setup
includeAllAbsenceboolNoInclude absence transactions regardless of absence type
onlyDataFromExternalProjectsboolNoInclude only data registered in external projects
companyIdslist of stringNoFilter by project company IDs
projectIdslist of stringNoFilter by Ditio project IDs
payrollTypeIdslist of stringNoFilter by payroll type IDs
absenceTypeIdslist of stringNoFilter by absence type IDs

If you provide modifiedSinceDate together with fromWorkDate and toWorkDate, modified data is queried inside that work-date range.

Terminal window
TOKEN=$(curl -s -X POST "$DITIO_IDENTITY_BASE/connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "scope=ditioapiv3" | jq -r '.access_token')
curl "$DITIO_API_BASE/api/payroll-export/?fromWorkDate=2026-01-01&toWorkDate=2026-01-31&dataFilter=0" \
-H "Authorization: Bearer $TOKEN"
import os
import requests
API_BASE = os.environ.get("DITIO_API_BASE", "https://core-api.ditio.dev/core")
IDENTITY_BASE = os.environ.get("DITIO_IDENTITY_BASE", "https://identity.ditio.dev")
token = requests.post(
f"{IDENTITY_BASE}/connect/token",
data={
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"scope": "ditioapiv3",
},
).json()["access_token"]
response = requests.get(
f"{API_BASE}/api/payroll-export/",
headers={"Authorization": f"Bearer {token}"},
params={
"fromWorkDate": "2026-01-01",
"toWorkDate": "2026-01-31",
"dataFilter": 0, # only approved
},
)
response.raise_for_status()
payroll_data = response.json()
using System.Net.Http.Headers;
var apiBase = Environment.GetEnvironmentVariable("DITIO_API_BASE")
?? "https://core-api.ditio.dev/core";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);
var url = $"{apiBase}/api/payroll-export/" +
"?fromWorkDate=2026-01-01&toWorkDate=2026-01-31&dataFilter=0";
var response = await http.GetAsync(url);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
GET /api/payroll-export/summary-as-lines

Returns payroll summaries as export lines. When fromWorkDate or toWorkDate is omitted, the endpoint uses the same default work-date range as the JSON export.

GET /api/payroll-export/file

Returns a payroll export file in the format configured in your company’s payroll setup. Ditio supports flat-file formats compatible with several accounting systems — to request support for a new format, send a sample export file, field descriptions per column, and the accounting system’s import-format documentation to support@ditio.no.

Additional parameters:

ParameterTypeRequiredDescription
voucherNumberstringNoVoucher number for cost file export
dataExportTypeintNo5 = preview, 6 = journal (default), 10 = payroll, 20 = absence, 30 = cost, 40 = transaction split
dataFilterintNo0 = only approved (default), 5 = only locked, 10 = all data
userPayrollTypeFilterstringNopaid-by-hour (default), fixed-pay, or all-users
payrollTypeIdslist of stringNoFilter by payroll type IDs
absenceTypeIdslist of stringNoFilter by absence type IDs

If you’re pulling payroll data into a BI tool or data warehouse (rather than feeding a payroll run), the paginated Data Extraction API may fit better:

EndpointDescription
GET /v1/payroll-linesProcessed payroll lines
GET /v1/payroll-lines-extendedExtended payroll lines with full detail

These live on the reporting base URL (https://core-api.ditio.dev/reporting in test) and use the reportingapiv1 scope. See Payroll Lines and Pagination.

IssueCauseFix
Empty responseNo approved data in the rangeCheck dataFilter — the default returns only approved data. Use 10 to see everything, and verify the period is approved in Ditio
400 on a long date rangeRanges are limited to 45 daysSplit the export into month-sized chunks
Fixed-salary employees missingDefault filter is paid-by-hourSet userPayrollTypeFilter=all-users (and consider overridePayrollExportSettingsForFixedPayEmployees=true)
Some payroll types missingTypes marked “do not export” in setupSet exportAllPayrollTypes=true, or fix the type configuration
Old edits not picked upmodifiedSinceDate limited to one year backDo a full re-export of the affected work-date range instead

Ready-made Postman files with the token request and a pre-configured payroll export call are available — contact support@ditio.no.