Skip to main content

Authentication

Gain API Access

PayrollDetect uses Visma Connect for authentication. To gain access, you need to register an application on the Visma Developer Portal by following the steps below.

1. Log in to Visma Developer Portal

When testing the API, log in to Stage. When in production with real users, use the Production environment.

2. Add the application

Go to "My Applications" > "Add Application" > "Service (Machine-to-Machine)".

Fill in the required details, save your application and create/publish it. Note the client_id.

3. Add the Integration

Select the Machine Learning Factory API Stage/Prod API and the relevant scope (machine-learning-factory-api-<stage/prod>:pd)

Wait for the integration request to be accepted. Feel free to contact the PayrollDetect team to speed up the process.

4. Generate secret

In the the application created, generate and securely store the client_secret.

Generate (Temporary) Access Token

To use the API you need an access token generated by Visma Connect's API. These have a lifetime of up to 60 minutes, depending on what you selected when setting up the application.

To generate an access token from the Visma Connect API, follow these steps:

  1. Initiate a POST request to:
  2. Include the header Content-Type: application/x-www-form-urlencoded
  3. Provide the following parameters in the request body:
    • grant_type: client_credentials
    • client_id: YOUR_CLIENT_ID_FROM_STEP_3
    • scope: YOUR_SCOPE_FROM_STEP_7
    • client_secret: YOUR_SECRET_FROM_STEP_9
  4. Send the request and retrieve the access_token from the response.
cURL (stage)
curl -X POST https://connect.identity.stagaws.visma.com/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=machine-learning-factory-api-stage:pd&client_secret=YOUR_SECRET"

Replace YOUR_CLIENT_ID and YOUR_SECRET.

cURL (prod)
curl -X POST https://connect.visma.com/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=machine-learning-factory-api-prod:pd&client_secret=YOUR_SECRET"

Replace YOUR_CLIENT_ID and YOUR_SECRET.

Use the Access Token in API requests

Include the Authorization header with the Bearer YOUR_ACCESS_TOKEN for all your requests to the PayrollDetect API.

The base url for the Production environment is https://api.machine-learning-factory.visma.com/pd and the for the Stage environment is https://api.machine-learning-factory.stage.visma.com/pd. The API integration scope for the PayrollDetect API is pd. This is needed when requesting access to the API.

You are now ready to make requests to the PayrollDetect API! 🎉

Further Reading

  • For more information about Visma Connect OAuth 2.0 Bearer Token Authentication, we refer to the Visma Connect Confluence.