Getting started
Amplified Intelligence API uses OAuth 2.0 to secure API endpoints using a client_credentials
grant. You'll need an attentionPLAN® account before you can begin using Amplified Intelligence API.
The account will be set up by us and the credentials will be sent to your email. If you don't yet have an account, please contact us here.
If you've had an attentionPLAN® account, you can log in here and follow the instructions below to generate an access token.
Creating an API application
Navigate to the Manage API application page on the attentionPLAN® platform and create a new API application.
Once your application is created, you’ll be provided with your OAuth client ID and OAuth client secret. These will be used via OAuth 2.0 to create an authenticated token and allow you to access the API endpoints.
It's important to note that this screen is only shown once upon creating an application for security purposes. Please store the client secret in a safe an secure location. You should never share your client secret with anyone.
Only one application is permitted at a time. In order to create a new one, you will need to delete any existing application first.
You’ll then need to create an access token using your newly created credentials.
Authentication
A valid and authenticated token is created by calling https://login.amplified.co/oauth/token along with passing over your:
- Client ID: Your OAuth application client ID, retrieved from attentionPLAN
- Client secret: Your OAuth application client secret, retrieved from attentionPLAN
- Audience: Your OAuth application audience - https://integration.amplified.co
The token is passed over in the HEADER Request via Authorization: Bearer <token>
The token expires after 1 hour so it’s important that your application is properly set up to request a new token when necessary.
Getting an access token for attentionPLAN API
- CURL
- C#
- Go
- Node.JS
- PHP
- Python
- Ruby
curl --request POST \
--url https://login.amplified.co/oauth/token \
--header 'content-type: application/json' \
--data '{"grant_type":"client_credentials","client_id":"{{your_oauth_application_id}}","client_secret":"{{your_oauth_application_secret}}","audience":"https://integration.amplified.co"}'
var client = new RestClient("https://login.amplified.co/oauth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"client_id\":\"{{your_oauth_application_id}}\",\"client_secret\":\"{{your_oauth_application_secret}}\",\"audience\":\"https://integration.amplified.co\",\"grant_type\":\"client_credentials\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://login.amplified.co/oauth/token"
payload := strings.NewReader("{\"client_id\":\"{{your_oauth_application_id}}\",\"client_secret\":\"{{your_oauth_application_secret}}\",\"audience\":\"https://integration.amplified.co\",\"grant_type\":\"client_credentials\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var request = require('request');
var options = {
method: 'POST',
url: 'https://login.amplified.co/oauth/token',
headers: { 'content-type': 'application/json' },
body: '{"client_id":"{{your_oauth_application_id}}","client_secret":"{{your_oauth_application_secret}}","audience":"https://integration.amplified.co","grant_type":"client_credentials"}',
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://login.amplified.co/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"client_id\":\"{{your_oauth_application_id}}\",\"client_secret\":\"{{your_oauth_application_secret}}\",\"audience\":\"https://integration.amplified.co\",\"grant_type\":\"client_credentials\"}",
CURLOPT_HTTPHEADER => array(
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("login.amplified.co")
payload = "{\"client_id\":\"{{your_oauth_application_id}}\",\"client_secret\":\"{{your_oauth_application_secret}}\",\"audience\":\"https://integration.amplified.co\",\"grant_type\":\"client_credentials\"}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/oauth/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://login.amplified.co/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"client_id\":\"{{your_oauth_application_id}}\",\"client_secret\":\"{{your_oauth_application_secret}}\",\"audience\":\"https://integration.amplified.co\",\"grant_type\":\"client_credentials\"}"
response = http.request(request)
puts response.read_body
Request body
{
"grant_type": "client_credentials",
"client_id": "{{your_oauth_application_id}}",
"client_secret": "{{your_oauth_application_secret}}",
"audience": "https://integration.amplified.co"
}