NAV Navbar
python java

Introduction

Welcome to the Acura Labs API documentation!

Authorization

Header using HMAC Example:

headers={
  "Content-Type":"application/json",
  "Authorization": "hmac %s" % hmac_signature
}
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "hmac " + HMAC);

Acura Labs API uses HMAC as authorization.

HMAC is expected to be included in all API requests header.

Authorization: hmac <username:timestamp:signature>

Timestamp is epoch in second UTC

Sandbox Environment

You can try using sandbox environment using this url.

https://sandbox.acuralabs.ai/<api-selected>.

Example: https://sandbox.acuralabs.ai/apis/v1/acura-score/score

HMAC Generator

To generate HMAC, use this code:

import json, time
import base64, hmac, hashlib

timestamp = int(time.time())

def get_hmac_signature(username, timestamp, secret_key, url, body={}):

    data = ("%s%s%s%s%s" % (username, timestamp, secret_key, url, body)).encode()

    token = secret_key.encode()
    signature = base64.b64encode(
        hmac.new(token, data, digestmod=hashlib.sha256).digest()
    ).decode()
    return "%s:%s:%s" % (username, timestamp, signature)

def clear_white_space( body):
    a_list = json.dumps(body).split()
    new_string = "".join(a_list)
    return new_string

hmac_signature = get_hmac_signature(
                      username,
                      timestamp,
                      secret_key,
                      url,
                      clear_white_space(body)
                  )
String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

public String hmac_generator(String username, Long timestamp, String secret_key, String url, String body) {
    String clean_body = body.replaceAll("\\\\", "");
    String replaced_tab_and_newline = clean_body.replaceAll("[\n\r\t]", "");
    String clean = replaced_tab_and_newline.replaceAll("\\s", "");
    String string2hash = username + timestamp.toString() + secret_key + url + clean;

    try {
      Mac hMacSHA256 = Mac.getInstance(HMAC_SHA256);

      byte[] hmacKeyBytes = secret_key.getBytes(StandardCharsets.UTF_8);
      byte[] bytes_data = string2hash.getBytes(StandardCharsets.UTF_8);

      SecretKeySpec secretKey = new SecretKeySpec(hmacKeyBytes, HMAC_SHA256);
      hMacSHA256.init(secretKey);

      byte[] res = hMacSHA256.doFinal(bytes_data);
      String result = java.util.Base64.getEncoder().encodeToString(res);

      return result;
    } catch (Exception e) {
      return "error";
    }
  }

Computes a Hash-based message authentication code (HMAC) using a secret key.

HMAC is a small set of data that helps authenticate the nature of message it protects the integrity and the authenticity of the message.

secret_key = will be available after the user has registered as a partner in Acura Labs Developer

data = concatenate(username, timestamp, secret_key, url, stringify(body))

signature = base64_encode(hash_hmac(‘sha256’, base64_encode(secret_key), data))

Stringify rule:

Acura Score

Acura Score API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/acura-score/score"

parameter = {
    "nik" : "3285007602101405",
    "phone" : "0088089990022"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"phone\":\"0088089990022\",\"nik\":\"3285007602101405\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/acura-score/score";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "acura_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "data": {
    "acura_score": 678
  }
}

If User Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "acura_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 404,
    "message": "Data Not Found",
    "detail": []
  }
}

This API function is to get user score.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/acura-score/score

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data object
data.acura_score float Acura Score

Identity Verification

Identity Verification API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/identity-verification/identity"
parameter = {
  "nik" : "3285007600001405",
  "phone" : "0088089990022",
  "match": {
    "kelurahan": "tugu",
    "provinsi": "jawa tengah",
    "kecamatan": "cimanggis",
    "kota": "Jakarta",
    "tanggal_lahir": "19910420",
    "jenis_kelamin": "laki-laki",
    "nama": "aruna",
    "status_perkawinan": "belum kawin"
  }
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"phone\":\"0088089990022\",\"nik\":\"3285007600001405\",\"match\": {\"kelurahan\":\"tugu\",\"provinsi\":\"jawa tengah\",\"kecamatan\":\"cimanggis\",\"kota\":\"Jakarta\",\"tanggal_lahir\":\"19910420\",\"jenis_kelamin\":\"laki-laki\",\"nama\":\"aruna\",\"status_perkawinan\":\"belum kawin\"}}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/identity-verification/identity";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Example Success Response (HTTP Status : 200)

{
  "meta": {
    "app": "identity_verificcation",
    "process_time": 0.1688246726989746,
    "args": {
      "phone": "0088089990022",
      "nik": "3285007600001405"
    },
    "total_records": 1
  },
  "data": {
    "kelurahan": "96% - 100%",
    "kota": "46% - 50%",
    "kecamatan": "96% - 100%",
    "provinsi": "81% - 85%",
    "tanggal_lahir": "0% - 5%",
    "nama": "51% - 55%",
    "jenis_kelamin": "96% - 100%",
    "status_perkawinan": "0% - 5%"
  }
}

Example Response If Parameter is Empty (HTTP Status : 422)

{
  "meta": {
    "app": "identity_verificcation",
    "process_time": 8.392333984375e-5,
    "args": {}
  },
  "error": {
    "status": 422,
    "message": "empty parameter",
    "detail": []
  }
}

Example Response If Data Not Found (HTTP Status : 404)

{
  "meta": {
    "app": "identity_verificcation",
    "process_time": 0.1691591739654541,
    "args": {
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 404,
    "message": "Data not found",
    "detail": []
  }
}

Example Response If Body Parameter is Wrong Format (HTTP Status : 503)

{
  "meta": {
    "app": "identity_verificcation",
    "process_time": 0.2484750747680664,
    "args": {
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 503,
    "message": "internal service error exception occur when parse response - 'attributess'",
    "detail": []
  }
}

This API function is to verify the various components of the identity of a person.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/identity-verification/identity

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number
match object Yes The value will be biodata of the user. For more information, see table below

Match Object Properties

Parameter Type Required Description
kelurahan string Yes The value must be name of urban village
provinsi string Yes The value must be name of province
kecamatan string Yes The value must be name of district
kota string Yes The value must be name of city
tanggal_lahir string Yes The value must be date of birth
jenis_kelamin string Yes The value must be gender
nama string Yes The value must be name
status_perkawinan string Yes The value must be marital status

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data object
data.kelurahan string
data.provinsi string
data.kecamatan string
data.kota string
data.tanggal_lahir string
data.jenis_kelamin string
data.nama string
data.status_perkawinan string

Address Verification

Address Verification API - Distance

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/address-verification/address/distance"

parameter = {
    "nik" : "3285007600001405",
    "phone": "0088089990022",
    "time_slot" : "night",
    "nama_jalan" : "Jl. Teluk Betung",
    "nomor_rumah" : "43",
    "rt": "11",
    "rw": "15",
    "provinsi": "DKI Jakarta",
    "kecamatan": "Kebon Melati",
    "kelurahan": "Kebon Melati",
    "kota": "Jakarta Pusat"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"nik\":\"3285007600001405\",\"phone\":\"0088089990022\",\"time_slot\":\"night\",\"nama_jalan\":\"Jl. Teluk Betung\",\"nomor_rumah\":43,\"rt\":11,\"rw\":15,\"kelurahan\":\"Kebon Melati\",\"kecamatan\":\"Kebon Melati\",\"kota\":\"Jakarta Pusat\",\"provinsi\":\"DKI Jakarta\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/address-verification/address/distance";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "address_verification",
    "args": {
      "nik": "3285007600001405",
      "phone": "0088089990022",
      "time_slot": "night",
      "nama_jalan": "Jl. Teluk Betung",
      "nomor_rumah": "43",
      "rt": "11",
      "rw": "15",
      "kelurahan": "Kebon Melati",
      "kecamatan": "Kebon Melati",
      "kota": "Jakarta Pusat",
      "provinsi": "DKI Jakarta"
    },
    "process_time": 0.0013959407806396484,
    "total_records": 0
  },
  "data": {
    "match": "20%"
  }
}

Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "address_verification",
    "process_time": 0.7558882236480713,
    "args": {
      "nik": "3285007600001405",
      "phone": "0088089990022",
      "time_slot": "night",
      "nama_jalan": "Jl. Teluk Betung",
      "nomor_rumah": "43",
      "rt": "11",
      "rw": "15",
      "kelurahan": "Kebon Melati",
      "kecamatan": "Kebon Melati",
      "kota": "Jakarta Pusat",
      "provinsi": "DKI Jakarta"
    }
  },
  "error": {
    "status": 404,
    "message": "Data Not Found",
    "detail": []
  }
}

Invalid Payload Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "address_verification",
    "process_time": 0.7558882236480713,
    "args": {
      "time_slot": "night",
      "nama_jalan": "Jl. Teluk Betung",
      "nomor_rumah": "43",
      "rt": "11",
      "rw": "15",
      "kelurahan": "Kebon Melati",
      "kecamatan": "Kebon Melati",
      "kota": "Jakarta Pusat",
      "provinsi": "DKI Jakarta"
    }
  },
  "error": {
    "status": 422,
    "message": "Invalid Parameter",
    "detail": [
      {
        "non_field_errors": "Must include either nik or phone"
      }
    ]
  }
}

This API function is to get user address distance.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/address-verification/address/distance

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number
time_slot string Yes The value must be day / night / allday
nama_jalan string Yes The value must be street name
nomor_rumah string Yes The value must be house number
rt string Yes The value must be RT number
rw string Yes The value must be RW number
provinsi string Yes The value must be name of province
kecamatan string Yes The value must be name of district
kelurahan string Yes The value must be name of urban village
kota string Yes The value must be name of city

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data object
data.match string Percentage of distance matched

Address Verification API - Postal Code Query

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/address-verification/address/postal-code"

parameter = {
    "nik" : "3285007600001405",
    "phone" : "0088089990022",
    "time_slot" : "night"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"nik\":\"3285007600001405\",\"phone\":\"0088089990022\",\"time_slot\":\"night\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/address-verification/address/postal-code";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "address_verification",
    "process_time": 0.48687005043029785,
    "args": {
      "nik": "3285007600001405",
      "phone": "0088089990022",
      "time_slot": "night"
    },
    "total_records": 1
  },
  "data": {
    "kode_pos": "10240"
  }
}

Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "address_verification",
    "process_time": 0.14839482307434082,
    "args": {
      "nik": "3285007600001405",
      "phone": "0088089990022",
      "time_slot": "night"
    }
  },
  "error": {
    "status": 404,
    "message": "Data Not Found",
    "detail": []
  }
}

Invalid Payload Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "address_verification",
    "process_time": 0.0006451606750488281,
    "args": {
      "nik": "3285007600001405",
      "phone": "0088089990022",
      "time_slot": "day1"
    }
  },
  "error": {
    "status": 422,
    "message": "Invalid Parameter",
    "detail": [
      {
        "time_slot": "\"day1\" is not a valid choice."
      }
    ]
  }
}

This API function is to get user address postal code query.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/address-verification/address/postal-code

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number
time_slot string Yes The value must be day / night / allday

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data object
data.kode_pos string Postal code

Distress Score

Distress Score API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/distress-score/score-result"

parameter = {
    "nik" : "3285007602101405",
    "phone" : "0088089990022"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"phone\":\"0088089990022\",\"nik\":\"3285007602101405\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/distress-score/score-result";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "distress_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "data": {
    "distress_score": 0.517620980739594
  }
}

If User Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "distress_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 404,
    "message": "Data Not Found",
    "detail": []
  }
}

If Parameter Does Not Exists Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "distress_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 422,
    "message": "Data Not Found",
    "detail": ["DistressScoreModel matching query does not exist."]
  }
}

If Invalid payload Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "distress_score",
    "process_time": 0.285900354385376,
    "args": {
      "phone": ["20a20-01-10"]
    }
  },
  "error": {
    "status": 422,
    "message": "Data Not Found",
    "detail": {
      "phone": "Not a valid string."
    }
  }
}

If Multiple Data Found Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "distress_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405"
    }
  },
  "error": {
    "status": 422,
    "message": "Multiple data found",
    "detail": [
      "get() returned more than one DistressScoreModel -- it returned 2!"
    ]
  }
}

This API function is to get user financial distress score.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/distress-score/score-result

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data object
data.distress_score float distress score

Income Proxy

Income Proxy API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/income-proxy/level"

parameter = {
    "nik" : "3285007602101405",
    "phone" : "0088089990022"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"phone\":\"0088089990022\",\"nik\":\"3285007602101405\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/income-proxy/level";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "income_proxy",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "data": {
    "combined_income_level": "100k - 500k"
  }
}

If User Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "income_proxy",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 404,
    "message": "Data Not Found",
    "detail": ["Data not found in database"]
  }
}

If Invalid Payload Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "income_proxy",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101=405",
      "phone": "0088089990022"
    }
  },
  "error": {
    "status": 422,
    "message": "Invalid Parameter",
    "detail": ["non_field_errors": "A valid NIK is required."]
  }
}

This API function is to get user income financial level.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/income-proxy/level

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data.combined_income_level object Contain data income proxy level

Collection Score

Collection Score API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/collection-score/collections/score"

parameter = {
    "nik" : "3285007602101405",
    "phone" : "0088089990022",
    "dpd_date": "2020-12-21"
}

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.post(url = URL, headers = headers, json = parameter)

import java.security.MessageDigest;
import java.sql.Timestamp;
import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;

import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainRequest {
  String secret_key = "secret_key";
  String user = "user";
  String body = "{\"phone\":\"0088089990022\",\"nik\":\"3285007602101405\",\"dpd_date\":\"2020-12-21\"}";
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String url = "https://griffin.acuralabs.ai/apis/v1/collection-score/collections/score";
  String HMAC_SHA256 = "HmacSHA256";

  public void call_api() {

    Long epoch_now = (timestamp.getTime() / 1000);
    String HMAC = user + ":" + epoch_now + ":" + hmac_generator(user, epoch_now, secret_key, url, body);

    try {
      URL endpoint = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
      conn.setRequestMethod("POST");
      conn.setRequestProperty("Content-Type", "application/json");
      conn.setRequestProperty("Authorization", "hmac " + HMAC);

      conn.setDoOutput(true);
      OutputStream os = conn.getOutputStream();
      os.write(body.getBytes());
      os.flush();
      os.close();
      int responseCode = conn.getResponseCode();

      try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {

        String line;
        StringBuilder response = new StringBuilder();

        while ((line = in.readLine()) != null) {
          response.append(line);
        }
      }

    } catch (Exception exception) {
      System.out.println(exception.toString());
    }
  }

  public static void main(String[] args) {
    MainRequest myObj = new MainRequest();
    myObj.call_api();
  }
}

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "collection_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3285007602101405",
      "phone": "0088089990022",
      "dpd_date": "2020-12-21"
    }
  },
   "data": {
    "collection_score": "598.6906796693802"
  },
}

If User Does Not Exists Response Example (HTTP Status : 404)

{
  "meta": {
    "app": "collection_score",
    "process_time": 0.285900354385376,
    "args": {
      "nik": "3323332333233323",
      "dpd_date": "2021-01-01"
    }
  },
  "error": {
    "status": 404,
    "message": "Data not found",
    "detail": []
  }
}

If Invalid Date Format (HTTP Status : 422)

{
  "meta": {
    "app": "collection_score",
    "process_time": 0.285900354385376,
    "args": {
        "ovo_id": "0081038116119024",
        "dpd_date": "2020-01-44"
    }
  },
  "error": {
    "status": 422,
    "message": "Invalid Parameter",
    "detail": {
        "dpd_date": "Date has wrong format. Use one of these formats instead: YYYY-MM-DD."
    }
  }
}

This API function is to predicts the likelihood a consumer will repay their debt so companies can allocate resources to the accounts most likely to pay.

HTTP Request

POST https://griffin.acuralabs.ai/apis/v1/collection-score/collections/score

Payload Request

Parameter Type Required Description
nik string Yes The value must be NIK
phone string Yes The value must be phone number
dpd_date date Yes The value must be day past due date (dpd_date)

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:signature

Response

Parameter Type Description
meta object Request information
data.collection_score object Contain data collection score

Reset Token

Reset Token API

import requests

URL = "https://griffin.acuralabs.ai/apis/v1/token/reset"

headers={
    "Content-Type":"application/json",
    "Authorization": "hmac %s" % hmac_signature
}

r = requests.get(url = URL, headers = headers)

Success Response Example (HTTP Status : 200)

{
  "meta": {
    "app": "Acura Marketplace",
    "process_time": 0.285900354385376,
    "args": {}
  },
  "data": {
    "secret_key": "secret_key"
  }
}

Error Response Example (HTTP Status : 400)

{
  "meta": {
    "app": "Acura Marketplace",
    "process_time": 0.285900354385376,
    "args": {}
  },
  "error": {
    "status": 400,
    "message": "Failed to reset token",
    "detail": []
  }
}

This API function is to reset secret key.

HTTP Request

GET https://griffin.acuralabs.ai/apis/v1/token/reset

Header Request

Parameter Type Description
Content-type string application/json
Authorization string hmac username:timestamp:secretkey:url:clear_white_space(body)

Response

Parameter Type Description
meta object Request information
data object
data.secret_key string Secret key value

Errors

Invalid Payload Response Example (HTTP Status : 422)

{
  "meta": {
    "app": "Acura OVO Score",
    "process_time": 0.0011036396026611328,
    "args": {
      "identifier": ["0088089990022", "3285007600001405"]
    }
  },
  "error": {
    "status": 422,
    "message": "",
    "detail": {
      "type": "This field is required."
    }
  }
}

The Acura Labs API uses the following error codes:

Error Code Meaning
401 Unauthorized Access.
403 Forbidden to access the API.
404 The specified resource could not be found.
422 Invalid payload (happen when one of field is in invalid format / mandatory field is empty).
500 Something went wrong. Please try again.