eMSP API

Introduction

In order for you to integrate eMSP functionality provided by be.Energised into your system, we provide you with this resource based API. At the moment it is focused to read and get invoices based on various filters, put information back to close invoices and attach information to additional fields. In time this collection of endpoints will be extended and documented here.

Authentication

The API uses bearer tokens, which can be fetched on the endpoint https://emp-api.auth.eu-central-1.amazoncognito.com (see example curl request). The initial token fetching requests contains a client_id and a client_secret.

The response of this first request (json response) is an access token. This access token must then be included in calls against the endpoint of your mandant.

Sample request to receive the bearer token. CLIENT_ID and CLIENT_SECRET must be exchanged with your received client_id and client_secret.

curl --location --request POST 'https://emp-api.auth.eu-central-1.amazoncognito.com/token?grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET' \
  --header 'Content-Type: application/x-www-form-urlencoded'

The response will look similar to the following:

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
    "expires_in": 3600,
    "token_type": "Bearer"
}

The field access_token must then be included in all further requests with the header Authorization: Bearer <access_token>. Also keep an eye on the expires_in field. This field gives you a hint, how long your token can be used before you have renew it.

Technical Documentation

Read up on the technical details of the eMSP API by following this link.