Manage workforce through the API
Start with the customer API guide to activate access, get a token and choose scopes. Every path below is relative to https://workforce-api.vesta.services/api/customer/v1/employers/{employerId}.
| Task | Request | Scope |
|---|---|---|
| Create an employee | POST /employees | employees:write |
| Update contact details | PATCH /employees/{id}/contact-details | employees:write |
| Read contracts | GET /contracts, /contracts/{id} | contracts:read |
| Manage day contracts | POST /contracts, PUT and DELETE /contracts/{id} | contracts:write |
| Read and file Dimona | GET and POST /contracts/{id}/dimona | dimona:read, dimona:write |
| Read payroll calculations | GET /accountancy/calculations | accountancy:read |
| Push worked hours | POST /prestation-batches, GET /prestation-batches/{id} | prestations:write |
| Create and edit planning | POST /establishments/{establishmentId}/shifts, GET and PATCH /establishments/{establishmentId}/shifts/{id} | planning:write |
| Correct time entries | GET and PUT /time-entries/{id} | time-entries:read, time-entries:write |
Retry writes safely
Section titled “Retry writes safely”Every write needs an Idempotency-Key header. Retry the same write with the same key and the identical body; use a new key for a different write. A retry can return the stored response with Idempotency-Replayed: true. A reused key with a different body is refused.
Create an employee
Section titled “Create an employee”Send POST /employees with JSON:
{ "firstName": "Alex", "culture": "en-GB", "sendWelcomeEmail": false }
- Required:
firstNameandculture(nl-BE,fr-BEoren-GB). - Optional:
lastName,email,phoneNumber,statuteId,functionId,establishmentId,costCenterId,ssin(the national register number),birthDateandaddress(street,houseNumber,boxNumber,zipCode,cityand a two-lettercountry). sendWelcomeEmail: truesends an invitation; it defaults tofalse. WhatsApp invitations, wages and bank accounts are not accepted.- A contract can only be created for an employee with an
ssin; abirthDatemust agree with it. - The answer is
201with{ "id": "<employee UUID>" }, never a kiosk PIN.
Reference fields take IDs from the employer’s own lists, which need employees:read or establishments:read:
| Field | Source |
|---|---|
statuteId | GET /employment-statutes: [{ "id": 1, "text": "..." }]. Never copy a statute ID from another employer. |
functionId | GET /job-functions |
establishmentId | id from GET /establishments: the payroll establishment |
costCenterId | GET /cost-centers |
A value that does not belong to the employer is refused with 422 and the code EmployeeDefaults.EmployerEstablishmentUniqueCode.Invalid or EmployeeDefaults.EmployerDepartmentId.Invalid. While the employer’s payroll runs in VestaPay, the employee exists in Vesta at once but waits for VestaPay until the payroll establishment, and the cost centre once the employer has cost centres, are set. Existing payroll-bridge ownership rules still apply.
A typical onboarding integration requests employees:read employees:write establishments:read:
VESTA_EMPLOYER_API="https://workforce-api.vesta.services/api/customer/v1/employers/$VESTA_EMPLOYER_ID"
curl "$VESTA_EMPLOYER_API/employment-statutes" --header "Authorization: Bearer $VESTA_ACCESS_TOKEN"
curl "$VESTA_EMPLOYER_API/job-functions" --header "Authorization: Bearer $VESTA_ACCESS_TOKEN"
curl "$VESTA_EMPLOYER_API/establishments" --header "Authorization: Bearer $VESTA_ACCESS_TOKEN"
curl --request POST "$VESTA_EMPLOYER_API/employees" \
--header "Authorization: Bearer $VESTA_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: employee-onboarding-2026-001' \
--data '{"firstName":"Alex","lastName":"Example","culture":"en-GB","sendWelcomeEmail":false}'
Update employee contact details
Section titled “Update employee contact details”Send PATCH /employees/{id}/contact-details with email, phoneNumber or both:
{ "phoneNumber": "+32470123456" }
An omitted field stays unchanged and an explicit null clears it. Invalid or duplicate email addresses are refused. A change revokes pending invitations sent to the previous details. The answer is 204.
Read contracts
Section titled “Read contracts”GET /contracts (with limit and cursor) and /contracts/{id} return contract summaries: the integer id, employeeId, employmentStatuteId, from, to, isDayContract and isActive. Dates may be null. Archived contracts and employees are left out, and so are pay, documents and identity details.
Manage day contracts
Section titled “Manage day contracts”Send POST /contracts:
{ "employeeId": "...", "schedule": { "date": "2026-12-15", "startsAt": "18:00:00", "endsAt": "02:00:00" } }
- Times are Belgian local time; an end at or before the start is on the next day.
plannedHoursis optional for a student contract. - The contract takes the employee’s employment statute and the portal’s rules: national register number, age, student, extra and flexi wage rules.
- The answer is
201with the integer contractid.
Send PUT /contracts/{id} with a new schedule to move a day contract, or DELETE /contracts/{id} to cancel one nothing was worked on. Both answer 204. A contract that is not a day contract, or has work registered on it, returns 409, and so does any write while VestaPay owns the employee’s contracts.
Read and file Dimona
Section titled “Read and file Dimona”Dimona is never sent synchronously. The Dimona sweep files the IN of a new contract; a reschedule or cancellation updates or cancels its Dimona as the portal does.
GET/contracts/{id}/dimona(dimona:read) returnsstatus,dimonaNumber,latestDeclarationType,latestDeclarationDateand theanomaliesRSZ reported.POST/contracts/{id}/dimona(dimona:write) queues the IN now and answers202withparked: a flexi or extra contract more than 14 days ahead is held untilfilesFrom. A pending declaration returns409; nothing left to declare returns422. Read the outcome later.
Read payroll calculations
Section titled “Read payroll calculations”GET /accountancy/calculations?year=2026&month=10 returns year, month and items: the hours and EUR amounts booked per employee, employment statute, salary group, cost center and performance code, the same lines as the accountancy export. National register numbers are left out; join on employeeId. A month not yet calculated returns no items.
Push worked hours
Section titled “Push worked hours”Use prestations:write when another system, such as a planning or clocking tool, delivers the hours your employees worked. Send POST /prestation-batches:
{ "year": 2026, "month": 12, "lines": [{ "employeeId": "...", "date": "2026-12-02", "code": "1", "hours": 7.5, "costCenterId": 12 }] }
- A batch holds 1 to 5000 lines of one pay month.
codeis a performance code, such as1for worked hours or2210for night hours.hoursis more than 0 and at most 24, with at most two decimals.costCenterIdfrom/cost-centersis optional; without it the hours follow the contract’s cost centers.- The employee needs a national register number. While VestaPay runs the employer’s payroll the push is refused with
409PayrollLead.Employer.VestaPay.
A batch with an unknown employee, code or cost center, a day outside the month or invalid hours is refused whole with 422, each error under its line, such as lines[2].hours. A valid batch answers 202 with its id. Within about a minute its hours replace the month’s imported hours of every contract it names, just like an uploaded prestations file; contracts it does not name keep theirs, so sending the whole month again never counts hours twice. One batch per month is processed at a time: another batch while one is queued returns 409 ImportPrestations.Request.InProgress, and the same batch again returns that batch with isReplay.
Poll GET /prestation-batches/{id} until status is Finished or Failed. A finished batch lists each line by its lineNumber (its position in lines, from 1) as Accepted or Refused with reason EmployeeNotFound, NoContract (no contract that day) or MonthSettled (payroll already settled). A failed batch wrote nothing: push it again.
Create and edit planning
Section titled “Create and edit planning”Create a draft. Send POST /establishments/{establishmentId}/shifts with date and local startsAt and endsAt, and optionally employeeId, teamId, taskId and breaks. An end before the start is on the next day. breaks: null follows the automatic break rules; an array sets explicit breaks. The answer is 201 with the shift id. Publish the draft in the planning screen.
Edit a shift. GET /establishments/{establishmentId}/shifts/{id} returns its schedule and revision; it needs planning:write because it includes unpublished planning. Send PATCH to the same URL with expectedRevision, date, startsAt, endsAt and breaks. This edits one occurrence and keeps its assignment and other details. A published shift keeps its published schedule until the pending revision is published in the planning screen. The answer holds the new revision; a stale revision returns 409.
Correct time entries
Section titled “Correct time entries”- Find the entry in
/time-entries. GET /time-entries/{id}?workDate=YYYY-MM-DDwith its originalworkDate. The answer has UTCstartsAtandendsAt, manualbreaks,automaticBreaksWaived,isPayrollLockedandrevision.PUT/time-entries/{id}with the sameworkDatequery and the complete editable timeline plusexpectedRevision.
Automatic breaks are not in the editable list; they are recalculated on save. A successful correction answers 204. A stale revision or a payroll lock returns 409. The timeline, overlap and employment rules still apply: a running entry stays open and a completed entry keeps an end time. A correction neither clocks out nor files a new Dimona. When a correction moves the start day, use the new work date afterwards.