Events API

The Events API allows creating and managing events, such as absences.

The API uses two concepts:

  • Event type – a category of event
  • Event – a single occurrence of an event type for a person on a specific date or time

Event object

Field Type Description
eventId number Event identifier
eventTypeId string Event type identifier
personId string Person identifier
dateTime string Date and time of the event

Event type object

Kenttä Tyyppi Kuvaus
id number Identifier
name string Name

Get event types

GET

/api/v1/events/types  

Returns all available event types.


Get event

GET /api/v1/events/{eventId}  

Returns a single event based on event id.

Example request

GET /api/v1/events/1234

Example response

{
  "data": {
    "eventId": 1234,
    "eventTypeId": 10,
    "personId": 1001,
    "dateTime": "2027-10-16T08:00:00+03:00"
  }
}

Search events

GET /api/v1/events?{parameters}  

Returns multiple events based on search parameters.

Parameter Description
date Return events for a specific date
startDate Return events starting from this date
endDate Return events up to and including this date
eventTypeId Filter by event type
personId Filter by person

Example request

GET /api/v1/events?startDate=2027-01-01&endDate=2026-01-31

Example response

{
  "data": [
    {
      "eventId": 1,
      "eventTypeId": 10,
       "personId": 1001,
       "dateTime": "2027-01-05T08:00:00+03:00"
     },
     {
       "eventId": 2,
       "eventTypeId": 10,
       "personId": 1001,
       "dateTime": "2027-01-06T08:00:00+03:00"
      },
      ...
  }
}

Search changes

GET /api/v1/events/changes?{parameters}  

Returns multiple events based on search parameters.

Parameter Description
startDate Return changes of events starting from this date
endDate Return changes of events up to and including this date
includeDetails If true, return all event fields. If false, return id only. Default: false    

Example request

GET /api/v1/events/changes?startDate=2027-01-01&endDate=2027-01-31

Example response

{
  "data": {
    "created": [ id1, id2, ...],
    "changed": [ ... ],
    "deleted": [ ... ]
  }
}

Example request

GET /api/v1/events/changes?startDate=2027-01-01&endDate=2027-01-31&includeDetails=true

Example response

{
  "data": {
    "created": [
      {
        "eventId": 1,
        "edited": {
          "personId": 1001,
          "dt": "2027-01-13T14:38:40+03:00"
        },
        "eventTypeId": 10,
        "personId": 1001,
        "dateTime": "2027-01-05T08:00:00+03:00"
      },
      {
        "eventId": 2,
        "edited": {
          "personId": 1002,
          "dt": "2027-01-14T14:38:40+03:00"
        },
        "eventTypeId": 10,
        "personId": 1001,
        "dateTime": "2027-01-06T08:00:00+03:00"
      },
      ...
    ,
    "changed": [ ... ],
    "deleted": [ ... ]
  }
}

Note

  • Each event appears only once in the results.
    • New events appear in created , even if they have been changed during the search period.
    • Deleted events always appear in deleted , even if they have been created or changed during the search period before deletion.
  • edited includes information about the last edit.
    • personId  is the id number of the person who edited the event.
    • personId  is 0 for changes made by the system or Deltabit employees.
    • personId  is -1 for events created by clicking a registration button.

Add events

POST /api/v1/events  

  • Creates one or more events.
  • The request body can contain a single event or multiple events.
  • Existing events for the same person and date can optionally be replaced.

Single event

{
  data: {
    "personId": 1001, 
    "eventTypeId": 100,
    "dateTime": "2027-10-16T08:00:00+03:00"
  },
  "mode": "add"
} 

Event spanning multiple days

{
  data: {
    "personId": 1001,
    "eventTypeId": 114,
    "startDate": "2027-12-25",
    "endDate": "2027-12-31"
  }
}

Replace existing events

{
  data: {
    "personId": 1001,
    "eventTypeId": 114,
    "dateTime": "2027-10-16T08:00:00+03:00"
  },
  "mode": "replace"
} 

Notes

  • dateTime      is used for single events.
  • startDate      and endDate      are used for date ranges, if supported by the event type. When adding absence days, events are only created for working days configured in the system.
  • mode      is optional. The default value is add     . Use replace      to remove existing events for the same person and date before adding the new one.
  • A successful request always returns 200 OK.

Edit an event

PATCH /api/v1/events/{eventId}           

Updates an existing event. Only the provided fields are updated.

{
  data: {
    "personId": 1001, 
    "eventTypeId": 100,
    "dateTime": "2027-10-16T08:00:00+03:00"
  }
}

Delete an event

DELETE /api/v1/events/{eventId}           

Deletes an event. Deletion is permanent.


Delete events

DELETE /api/v1/events  

Delete multiple events.

Parameter Description
date Return events for a specific date
startDate Return events starting from this date
endDate Return events up to and including this date
eventTypeId Filter by event type
personId Filter by person

Example request

DELETE /api/v1/events?startDate=2027-01-01&endDate=2026-01-31