External references
This page documents the external references specification for the Protime API, including predefined reference options, custom reference format, management endpoints, and uniqueness requirements.
External reference types
The Protime API supports two types of external references, distinguished by the @ prefix:
| Type | Prefix | Description |
|---|---|---|
| Predefined | @ |
Selected properties within the Protime software suite, read-only via the API. |
| Custom | None | Flexible key-value pairs managed entirely by the third party. |
Predefined external references options
Replace collection and external reference in the query parameter with the appropriate values from the table below. Predefined external references are always prefixed with @.
| Collection | Identifier | External reference | Query parameter |
|---|---|---|---|
| absence-definitions | Absence Code | @absence-code |
?externalReferences=(absence-definitions,@absence-code) |
| activity-definitions | Data Entry Code | @data-entry-code |
?externalReferences=(activity-definitions,@data-entry-code) |
| External Reference | @external-reference |
?externalReferences=(activity-definitions,@external-reference) |
|
| counter-definitions | Counter Code | @counter-code |
?externalReferences=(counter-definitions,@counter-code) |
| people | Badge Number | @badge-number |
?externalReferences=(people,@badge-number) |
| Employee Number | @employee-number |
?externalReferences=(people,@employee-number) |
|
| shift-definitions | Shift Code | @shift-code |
?externalReferences=(shift-definitions,@shift-code) |
| terminals | External Code | @external-code |
?externalReferences=(terminals,@external-code) |
Query format
Single external reference:
?externalReferences=({collection},{external reference})Multiple external references:
?externalReferences=({collection1},{reference1})({collection2},{reference2})Multiple references may be requested for the same collection. Each requested reference is resolved independently and returned under that collection’s externalReferences object:
?externalReferences=(people,@badge-number)(people,@employee-number)Example – requesting multiple predefined external references:
GET /connector/protimeapi/api/v1/activity-durations?filter=date%20ge%20'2025-01-01'%20and%20date%20le%20'2025-01-05'&externalReferences=(people,@employee-number)(activity-definitions,@data-entry-code)(absence-definitions,@absence-code)(counter-definitions,@counter-code) HTTP/1.1
Host: <tenant>.myprotime.euGET response with predefined external reference
{
"id": 39577408,
"calculatedTimeOfDayInMinutes": 480,
"isGenerated": false,
"person": {
"id": 123152,
"externalReferences": {
"@badge-number": "6767676"
}
},
"date": "2024-01-05",
"timeOfDayInMinutes": 480,
"kind": "InOut"
}POST/PUT body with predefined external reference
{
"person": {
"externalReferences": {
"@badge-number": "6767676"
}
},
"date": "2024-01-05",
"timeOfDayInMinutes": 480,
"kind": "InOut"
}GET response with multiple references for one collection
When several references are requested for the same collection, the response returns all of them under that collection’s externalReferences object:
{
"id": 39577408,
"calculatedTimeOfDayInMinutes": 480,
"isGenerated": false,
"person": {
"id": 123152,
"externalReferences": {
"@badge-number": "6767676",
"@employee-number": "E-00421"
}
},
"date": "2024-01-05",
"timeOfDayInMinutes": 480,
"kind": "InOut"
}Note
Requesting multiple references for the same collection enriches the response only. When addressing a single resource by an external reference (resolving a reference to an internal id), only the first reference provided for that collection is used.
Custom external references
Custom external references allow third parties to assign their own identifier to a Protime resource. A custom external reference has a reference name (freely chosen, without @) and a reference value (the external identifier).
There can only be one reference value linked to one Protime resource per reference name.
Custom external references are only known within the Protime API and are not visible elsewhere in the Protime software.
How a custom reference is registered
A custom reference has to exist before it can be used to address a resource. There are two ways to create one:
| Method | Applies to | Description |
|---|---|---|
| Management endpoints | Every collection with external reference support | Links an existing Protime resource to your identifier in a separate call. |
externalReferenceIdentifier body property |
people and activity-definitions create endpoints only |
Registers the reference in the same call that creates the resource. |
The externalReferenceIdentifier property holds exactly one key-value pair and is honoured only on the create (POST) endpoint of those two collections — the corresponding update endpoints ignore it. See Create a person for the full behaviour.
Request format for addressing a related resource
Once a reference exists, use it in place of an id when a request body points at another resource. This form resolves the reference — it looks up the resource already linked to that value. It never creates or changes a reference.
{
"{property}": {
"externalReferences": {
"{external reference}": "ExternalReferenceX"
}
}
}GET response with custom external reference
{
"id": 39577408,
"calculatedTimeOfDayInMinutes": 480,
"isGenerated": false,
"person": {
"id": 123152,
"externalReferences": {
"HRMID": "6767676"
}
},
"date": "2024-01-05",
"timeOfDayInMinutes": 480,
"kind": "InOut"
}POST body with custom external reference
{
"person": {
"externalReferences": {
"HRMID": "Emp123"
}
},
"date": "2024-01-05",
"timeOfDayInMinutes": 480,
"kind": "InOut"
}External reference management endpoints
These endpoints operate on custom references only. A reference name starting with @ is rejected with a 400.
Add or update a custom external reference
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/external-references/{collectionName}/{referenceName}/{externalReference}
Scope: connector-protimeapi-external-references.write
Request body:
{
"internalReference": "4781"
}A successful response returns 200 OK.
This links the external reference value ({externalReference}) to the Protime internal identifier (internalReference) within the specified collection and reference name.
Delete a custom external reference
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/external-references/{collectionName}/{referenceName}/{externalReference}
Scope: connector-protimeapi-external-references.write
A successful response returns 204 No Content.
List the custom external references of a collection
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/external-references/{collectionName}
Scope: connector-protimeapi-external-references.read
Returns 200 OK with every custom reference registered for the collection.
List the custom external references of one reference name
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/external-references/{collectionName}/{referenceName}
Scope: connector-protimeapi-external-references.read
Returns 200 OK with every value registered under that reference name.
Retrieve one custom external reference
https://<tenant>.myprotime.eu/connector/protimeapi/api/v1/external-references/{collectionName}/{referenceName}/{externalReference}
Scope: connector-protimeapi-external-references.read
Returns 200 OK, or 404 Not Found when the value is not registered.
Error responses
| Status | Condition |
|---|---|
400 |
The collection name is unknown or has no external reference support |
400 |
The reference name starts with @ — these endpoints handle custom references only |
400 |
(PUT) internalReference cannot be parsed to the internal id type of the collection |
400 |
(PUT) The value is already linked to a different internalReference — delete it first |
401 |
Missing or invalid access token, or insufficient scope |
404 |
(GET single) The external reference value is not registered |
Endpoint path segments
| Segment | Description |
|---|---|
{collectionName} |
The collection the external reference belongs to (e.g. people) |
{referenceName} |
The name of the reference group (e.g. HRMID) |
{externalReference} |
The external reference value (e.g. Emp123) |
Uniqueness requirements
Within a collection, external reference values (both predefined and custom) must be unique per reference name. If an identifier is not unique, its purpose as an identification reference is lost.
Additionally, every object in the collection should have a value for the external reference. Objects with empty values will not fail, but the external reference system cannot provide references consistently and accurately for those objects.
@ prefix convention
- Predefined external references always start with
@(e.g.@badge-number). - Custom external references never start with
@(e.g.HRMID).