Create a clocking

Create a clocking

Creates a new clocking record.

Tip

Check the Swagger page for more technical information on the endpoints.

Endpoint details

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

Headers: Authorization: Bearer {token}, User-Agent: {agent} Scope: connector-protimeapi-clockings.write

Body properties

Field Type Required Writable Description
person.id integer Yes Yes Internal ID of the person who performed the clocking (or use external reference).
date string Yes Yes Date of the clocking (YYYY-MM-DD).
timeOfDayInMinutes integer Yes Yes Minutes since midnight (-1440 and 2880) representing the time of the clocking.
terminal.id integer No Yes Internal ID of the terminal on which the clocking occurred.
geolocation.longitude number No Yes Longitude coordinate where the clocking was registered.
geolocation.latitude number No Yes Latitude coordinate where the clocking was registered.
kind string Yes Yes Type of clocking (InOut, Reason, Activity, ActivityEnd).
reason.id integer No Yes Internal ID of the reason for the clocking (only for Reason kind).
isOpen boolean No Yes Indicates if the reason clocking is open (only for Reason kind).
activityLevels array No Yes Array of activity levels (only for Activity kind).

External references

The endpoint supports predefined and custom external references. See the external references page for details.

The following collections are supported for this endpoint:

Collection Predefined Custom
people @badge-number, @employee-number Supported
terminals @external-code Supported
activity-definitions @data-entry-code, @external-reference Supported
absence-definitions @absence-code Supported

Error responses

Status Condition
400 Validation failed (missing required fields, invalid values)
401 Missing or invalid access token, or insufficient scope

Success response

201 Created with a Location header pointing to the new clocking.

Examples

In/Out Clockings: “InOut”

Example for creating an in/out clocking with badge number as the external reference:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
  "person": {
    "externalReferences": {
      "@badge-number": "1955"
    }
  },
  "date": "2024-12-17",
  "timeOfDayInMinutes": 500,
  "kind": "InOut"
}  

Reason clockings: “Reason”

Example for creating a reason clocking:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
  "person": {
        "id": 76547
  },
  "date": "2024-12-17",
  "timeOfDayInMinutes": 500,
  "kind": "Reason",
  "reason": {
        "id": 6578
    }
}  

Activity clockings: “Activity”

When creating an activity clocking, a structure version is not required, as the Protime API automatically selects the active structure version.

Example for creating an activity clocking with external references on the person, the terminal and the activity definition:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
    "person": {
        "externalReferences": {
            "@employee-number": "01256"
        }
    },
    "date": "2024-01-05",
    "timeOfDayInMinutes": 480,
    "terminal": {
        "externalReferences": {
            "SapTerminalCode": "SAPTO1"
        }
    },
    "geolocation": {
        "longitude": "51.144127",
        "latitude": "4.392225"
    },
    "kind": "Activity",
    "activityLevels": [
        {
            "level": 1,
            "activityDefinition": {
                "externalReferences": {
                    "@data-entry-code": "00014"
                }
            }
        },
        {
            "level": 2,
            "activityDefinition": {
                "externalReferences": {
                    "@data-entry-code": "10019"
                }
            }
        }
    ]
}

End activity clockings: “ActivityEnd”

An activity definition isn’t required here; this will end the activity clocking that is currently active.

Example for ending an activity:

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
  "person": {
        "id": 76547
  },
  "date": "2024-12-17",
  "timeOfDayInMinutes": 480,
  "kind": "ActivityEnd"
}  

Overnight clocking: night shift example

This example demonstrates the recommended standard approach for overnight clockings. The employee works a night shift from 22:00 on 13 February to 06:00 on 14 February. The schedule in Protime is configured so that this night shift belongs to 14 February.

You create the check-in clocking on 13 February with the actual time (22:00 = 1320 minutes):

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
  "person": {
    "externalReferences": {
      "@badge-number": "1955"
    }
  },
  "date": "2025-02-13",
  "timeOfDayInMinutes": 1320,
  "kind": "InOut"
}

And the check-out clocking on 14 February with the actual time (06:00 = 360 minutes):

POST
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/clockings

{
  "person": {
    "externalReferences": {
      "@badge-number": "1955"
    }
  },
  "date": "2025-02-14",
  "timeOfDayInMinutes": 360,
  "kind": "InOut"
}

Protime will automatically assign both clockings to 14 February based on the schedule configuration. No special time values are needed.