Accessing the API

To authorise against the Partner API Endpoints you must first exchange your API Key & Secret for a short lived JWT token, which can be done via the accessing the Auth endpoint as follows:


const axios = require('axios');

let config = {
  url: 'https://api.phonelineplus.com/v1/auth',
  data : {
    "keyID": PARTNER_KEY,
    "secret": PARTNER_SECRET
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})

The Auth response includes a JWT in the access_token field:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhb...",
    "expires": 1693522800
}

The JWT should then be included in all requests to Partner API endpoints via the Authorization HTTP Request Header, with scheme set to Bearer:

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhb...