This is a quick start guide to quickly generate a Credit Decisioning analysis assuming that you are able to provide the Open Banking data yourself.
1. Generate an access token
Generate an access token using the client_id and client_secret provided in the Console. The returned access token gives you access to our APIs.
curl --request POST \
--url https://api.algoan.com/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=your_client_id \
--data client_secret=your_client_secret
const axios = require("axios").default;
const options = {
method: 'POST',
url: 'https://api.algoan.com/v1/oauth/token',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: {
grant_type: 'client_credentials',
client_id: 'your_client_id',
client_secret: 'your_client_secret'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests
url = "https://api.algoan.com/v1/oauth/token"
payload = "grant_type=client_credentials&client_id=your_client_id&client_secret=your_client_secret"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
HttpResponse<String> response = Unirest.post("https://api.algoan.com/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=bridge-connector-demo&client_secret=7da1d753-ef30-4fea-bcf8-66250bfa5c84")
.asString();
Congratulations 🥳 You are now authenticated and ready to begin the integration.
Store the access_token securely, for example, as an environment variable, as this token will be required for future API requests.
2. Create a customer
Once you have stored the access_token securely, use it to create a Customer with a custom identifier that matches your system's unique identifier.
curl --request POST \
--url https://api.algoan.com/v2/customers \
--header 'Authorization: Bearer access_token' \
--header 'Content-Type: application/json' \
--data '{
"customIdentifier": "your_custom_identifier"
}'
const axios = require("axios").default;
const options = {
method: 'POST',
url: 'https://api.algoan.com/v2/customers',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer access_token'
},
data: {
customIdentifier: 'your_custom_identifier'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests
url = "https://api.algoan.com/v2/customers"
payload = {"customIdentifier": "your_customer_identifier"}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer access_token"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
HttpResponse<String> response = Unirest.post("https://api.algoan.com/v2/customers")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer your_access_token")
.body("{\n\t\"customIdentifier\": \"your_customer_identifier\"\n}")
.asString();
Warning
Each customer is unique per customIdentifier. If you try to create a customer with the same identifier, a 422 HTTP error will be returned.
3. Create an analysis - Account and Transactions upload
Now that the Customer has been created, it is time to upload their bank accounts and transactions to start the analysis.
ACCOUNTS=$(curl https://raw.githubusercontent.com/algoan/fake-open-banking-data/main/samples/fr/harry_potter.json)
curl --request POST \
--url https://api.algoan.com/v2/customers/${customerId}/analyses \
--header 'Authorization: Bearer access_token' \
--header 'Content-Type: application/json' \
--data $ACCOUNTS
const axios = require("axios").default;
const accountsUrl = 'https://raw.githubusercontent.com/algoan/fake-open-banking-data/main/samples/fr/harry_potter.json';
const options = {
method: 'POST',
url: `https://api.algoan.com/v2/customers/${customerId}/analyses`,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer access_token'
},
data: {}
};
axios.get(accountsUrl).then(function (response) {
const accounts = response.data;
options.data = accounts;
return axios.request(options);
}).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import requests
url = f"https://api.algoan.com/v2/customers/{customer_id}/analyses"
payload = {}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer access_token"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
HttpResponse<String> response = Unirest.post("https://api.algoan.com/v2/customers/${customerId}/analyses")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer your_access_token")
.body("{\n\t\"customIdentifier\": \"your_customer_identifier\"\n}")
.asString();
You can find open banking data samples in the table below or on GitHub:
Successful Analysis creation
Once the analysis is created, the API will return a 202 HTTP response, meaning that the analysis has started.
4. Get results
The last step consists of retrieving Score and Credit Insights results.
To get the result of the analysis, you can proceed to perform a short polling. Request the given analysis until the status is COMPLETED
curl --request GET \
--url https://api.algoan.com/v2/customers/${customerId}/analyses/${analysisId} \
--header 'Authorization: Bearer access_token'
Once the analysis is finished, you should see scoresand creditInsights defined 🏆
Info
You can also be notified when the analysis completed. Refer to the Webhooks section to configure your own webhook.