This document describes how to set up and use the Pensure API both for testing and production purposes.
All necessary documentation for understanding and describing the API should be contained in this document.
The testing environment located on:
https://demo.pensure.dk, and your subdomain:
https://(yourcompany).demo.pensure.dk, can only be used with NemID testing users provisioned by Nets.
We have several test users to allow you to pass the NemID step. Gain access to the test users by e-mail request.
The user's journey through our system starts from either a user entering the flow via one of your created apps on Pensure e.g. https://(yourcompany).demo.pensure.dk/onboarding
or through calling our API to start the flow at
https://api.demo.pensure.dk/api/crm/v1/flow/questions/(name)
The following is a description of these two paths through the flow, so you can follow along with whichever solution you are implementing.
The user enters the flow with a url to Pensure
This url can contain a key from you site, so you can identify the user when we call back through the webhook and the redirect. By setting a url parameter; ?l=(your customer identifier). There is no limitations on the string length, but remind the general rule of url length and the identifier must not of contain any personal information like a social security number.
It is also possible to pass custom data through the flow. By providing xparam=(string of data) in the start, the same data will be part of the webhook content and the redirect url. (remember to urlencode/escape the xparam value)
In the Demo environment it also possible to specify an alternative webhook url and a forward url. This gives the opportunity to work on localhost.
demo-webhookurl=(url) will override the default webhook url.
demo-forwardurl=(url) will override the default redirect url. (remember to urlencode/escape the urls).
These two parameters are ignored in production.
The user ends the flow, and the webhook is called
This webhook call will contain some metadata, including the url parameter (customer identifier and xparam) if present. When a succesive response is made from the webhook the browser will be redirected back to your site, including the url parameter (customer identifier and xparam) if present.
You call one or more APIs And ends your call with the exported method.
You send a request to https://api.demo.pensure.dk/api/crm/v1/flow/questions/(name)
This request needs to include your API keys. You will then receive a response with the data needed to display the correct question.
You then post the data for this question
You will then get the next page in the flow, and the response will look the same as the response described above.
The webhook is called at the end of the flow.
The content of the webhook call will contain a set of properties:
Content:
Short description of environment, and methods followed by examples.
For all calls to the API, two security headers must be included.
Example of receiving pensionsinfo pdf through the api:
Last thing first. When you are finished collecting data from the various API's, you must call exported as the very last.
This is important since that request will mark the user's data as received by you, lock it and process it.
All gateway methods are within this path: /api/crm/v1/gateway/
When this method is called, all data will be removed shortly afterwards.
Path: exported Method: POST
It is posssible to put a failure status on the url like: exported?failed=(some status text here)
Example:
curl -X POST -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/gateway/exported
All PensionsInfo methods is within this path: /api/crm/v1/providers/pensionsinfo/
Path: file/pdf Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/providers/pensionsinfo/file/pdf
Response: will be the binary pdf file.
Path: file/data Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/providers/pensionsinfo/file/data
Response: The raw output from PensionsInfo in json format.
All flow question methods is within this path: /api/crm/v1/flow/questions/(name)
Path: file/data Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/flow/questions/(name)/file/data
The actual response varies since it depends on the question package
Path: file/pdf Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/flow/questions/(name)/file/pdf
By default, the pdf is not created. So please inform us if it is needed.
If generated documents are part of the flow, they will have this path: documents/(name)/*
The webhook will be called either when the document is generated, or signed if that is required.
The binary document file.
Path: file/binary Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/documents/(id)/file/binary
Some metadata of the file.
Path: file/data Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/documents/(id)/file/info
Response:
If user is uploading any files, they will have this path: uploads/(name)/*
The binary document file.
Path: file Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/uploads/(id)/file/binary
Path: file Method: GET
Example: curl -v -H "Authorization: Bearer (ApiToken)" -H "X-Pensure-ApiKey: (ApiKey)" https://api.demo.pensure.dk/api/crm/v1/uploads/(id)/file/data
To view test related documentation, request access