Authentication

Authentication

This page documents the authentication specification for the Protime API, including OIDC discovery, token endpoints, request/response formats, and scope naming conventions.

OIDC discovery

The Protime API implements the OIDC (OpenID Connect) protocol. The discovery document is available at:

https://authentication.<environmentURL>/tenants/<tenantName>/.well-known/openid-configuration

Environment URLs

Environment URL
Production myprotime.eu
Sandbox myprotimesandbox.eu

Token endpoint

https://authentication.<environmentURL>/tenants/<tenantName>/connect/token

Tokens are issued per tenant. Each token is valid for a fixed duration, expressed in seconds in the response.

Supported grant types

The API supports the OAuth 2.0 Client Credentials grant type. For step-by-step instructions on obtaining a token, see How to authenticate.

Token request format

Request headers

POST /tenants/<tenantName>/connect/token HTTP/1.1
Host: authentication.<environmentURL>
Content-Type: application/x-www-form-urlencoded

Request body parameters

Parameter Type Description
grant_type string Must be client_credentials
client_id string Client-specific client ID (provided by Protime)
client_secret string Client-specific client secret
scope string Space-separated list of requested scopes. Optional, but recommended.

Example body (application/x-www-form-urlencoded):

grant_type=client_credentials&client_id=client+specific+client+id&client_secret=client+specific+client+secret&scope=connector-protimeapi-activity-definitions.read+connector-protimeapi-activity-definitions.write+connector-protimeapi-clockings.read

Token response format

Field Type Description
access_token string The JWT access token
expires_in int Token validity duration in seconds
token_type string Always Bearer
scope string Space-separated list of granted scopes

Example response:

{
    "access_token": "eyJ...Uc",
    "expires_in": 1800,
    "token_type": "Bearer",
    "scope": "connector-protimeapi-activity-definitions.read connector-protimeapi-activity-definitions.write connector-protimeapi-clockings.read"
}

Authorization header

The access token is passed via the Authorization header on every API request:

Authorization: Bearer eyJ...Uc

An expired or invalid token results in a 401 response.

Scope naming convention

Scopes follow the pattern:

connector-protimeapi-<collection>.<permission>
Segment Description
<collection> The resource collection name (e.g. clockings, activity-definitions)
<permission> Either read or write

When no scope is specified in the token request, all scopes the client credentials are entitled to are granted by default.

Specifying the scope parameter is recommended. Tokens granting every entitled scope have grown large, which can cause problems on the transport layer.

Scope entitlement

Each set of client credentials is provisioned with a fixed set of entitled scopes. A token request can only ask for scopes within that set.

Condition Result
All requested scopes are entitled 200 OK with an access token carrying those scopes
One or more requested scopes are not entitled, or unknown 400 Bad Request with error invalid_scope – no token is issued
{
    "error": "invalid_scope"
}

The rejection applies to the whole request: valid scopes in the same request are not granted either.

Third-party integrations usually receive credentials with a deliberately limited entitlement covering only the collections they were authorised for. Such credentials are normally not entitled to the general scopes and must request per-collection scopes explicitly.

General scopes

In addition to per-collection scopes, two general scopes grant broad access across all collections:

Scope Grants
connector-protimeapi-all.read Read access to all collections
connector-protimeapi-all.write Write access to all collections

A token carrying connector-protimeapi-all.read is accepted by any endpoint that requires a .read scope. Likewise, connector-protimeapi-all.write is accepted by any endpoint that requires a .write scope. These scopes are evaluated alongside per-collection scopes – an endpoint accepts either its specific scope or the matching general scope.

General scopes simplify token management when an integration needs access to many collections, but they reduce the security benefit of least-privilege scoping. Use per-collection scopes when possible.

The general scopes are subject to entitlement like any other scope. Credentials issued with a limited scope set cannot request them and receive invalid_scope if they try. See Scope entitlement.

Example – requesting only clocking-related scopes:

grant_type=client_credentials&client_id=client+specific+client+id&client_secret=client+specific+client+secret&scope=connector-protimeapi-clockings.read+connector-protimeapi-clockings.write

Scope reference by domain

The following tables list all available scopes grouped by domain. Not every collection supports both read and write; the available permissions reflect the operations the API exposes for each collection.

Time

Collection .read .write
clockings connector-protimeapi-clockings.read connector-protimeapi-clockings.write
absences connector-protimeapi-absences.read
absence-definitions connector-protimeapi-absence-definitions.read
absence-groups connector-protimeapi-absence-groups.read
breaks connector-protimeapi-breaks.read
break-definitions connector-protimeapi-break-definitions.read
work-interruptions connector-protimeapi-work-interruptions.read
calculated-totals connector-protimeapi-calculated-totals.read
paid-presences connector-protimeapi-calculated-totals.read
counters connector-protimeapi-counters.read
counter-definitions connector-protimeapi-counter-definitions.read
counter-groups connector-protimeapi-counter-groups.read
shift-definitions connector-protimeapi-shift-definitions.read
hours-to-validate connector-protimeapi-hours-to-validate.read
hours-to-validate-requests connector-protimeapi-hours-to-validate.read
validated-hours connector-protimeapi-hours-to-validate.read

Activities

Collection .read .write
activity-definitions connector-protimeapi-activity-definitions.read connector-protimeapi-activity-definitions.write
activity-durations connector-protimeapi-activity-durations.read

People

Collection .read .write
people connector-protimeapi-people.read connector-protimeapi-people.write
people-historical-data connector-protimeapi-people-historical-data.read connector-protimeapi-people-historical-data.write
contracts connector-protimeapi-contracts.read connector-protimeapi-contracts.write

Foundation

Collection .read .write
departments connector-protimeapi-departments.read connector-protimeapi-departments.write
employers connector-protimeapi-employers.read connector-protimeapi-employers.write
jobs connector-protimeapi-jobs.read connector-protimeapi-jobs.write
job-categories connector-protimeapi-job-categories.read connector-protimeapi-job-categories.write
sectors connector-protimeapi-sectors.read connector-protimeapi-sectors.write
work-locations connector-protimeapi-work-locations.read connector-protimeapi-work-locations.write

Planning

Collection .read .write
assignments connector-protimeapi-assignments.read connector-protimeapi-assignments.write

Access

Collection .read .write
access-clockings connector-protimeapi-access-clockings.read

Cross-cutting

Collection .read .write
external-references connector-protimeapi-external-references.read connector-protimeapi-external-references.write
webhooks connector-protimeapi-webhooks.read connector-protimeapi-webhooks.write

General (all collections)

Scope .read .write
all connector-protimeapi-all.read connector-protimeapi-all.write

These scopes grant access across all collections, but only to credentials entitled to them. See General scopes and Scope entitlement for details.

See also