Skip to main content

Documentation Index

Fetch the complete documentation index at: https://guide.cloud.blnkfinance.com/llms.txt

Use this file to discover all available pages before exploring further.

This feature is in private beta. If you want access, please contact Support.
After installation, your app now has what it needs to work with the selected Cloud instance. The important values come from the install record you saved earlier:
  • api_key
  • instance_id
  • granted_permissions
Your backend should use those values to decide which instance to call, what key to use, and what actions the app is allowed to perform. For our KYC app, this is where the backend starts doing the review work: reading identities, checking their KYC status, saving the result, and creating alerts when a record needs manual review.

Choose the right Cloud API

Custom Apps usually use three classes of Cloud APIs.
APIWhen to use it
Data APIRead and filter ledger data through Cloud.
Proxy APIPerform Core actions through Cloud.
Direct Cloud endpointsUse Cloud features that are not Core endpoints, such as alerts.
All requests use the Cloud base URL:
https://api.cloud.blnkfinance.com
The installed app API key goes in the Authorization header:
Authorization: Bearer <api_key>
For Proxy and Data API requests, include the selected instance_id in the URL:
?instance_id=<instance_id>

Quick reference

Use the proxy when your app wants to call Blnk Core through Cloud. The format is:
https://api.cloud.blnkfinance.com/proxy/<core-endpoint>?instance_id=<instance_id>
The <core-endpoint> is the same endpoint you would normally call on Core, but with /proxy in front of it.For example, on Core, the request would look like this:
GET http://localhost:5001/ledgers
With the Cloud Proxy, it becomes:
GET https://api.cloud.blnkfinance.com/proxy/ledgers?instance_id=inst_...
A complete request via the Cloud Proxy would look like:
bash
curl -X GET "https://api.cloud.blnkfinance.com/proxy/ledgers?instance_id=inst_..." \
  -H "Authorization: Bearer blnk_..." \
  -H "Content-Type: application/json"

Using the proxy

Learn more about how the proxy works and see all the available endpoints.

Example application

Let’s apply this to build the KYC app workflow we mapped earlier.
1

Retrieve an identity to review

First, we’ll retrieve an identity to review:
retrieveIdentity.ts
async function fetchIdentityDetailsForReview(instance_id: string) {
  const headers = {
    Authorization: `Bearer ${api_key}`,
    "Content-Type": "application/json",
  };

  const response = await axios.get(
    `https://api.cloud.blnkfinance.com/proxy/identities?instance_id=${instance_id}`,
    { headers }
  );

  return response.data;
}
2

Send identity details to a KYC provider

Next, we’ll send the identity details to a KYC provider for verification:
sendIdentityDetailsToKYCProvider.ts
async function sendIdentityDetailsToKYCProvider(identity) {
  const response = await axios.post(`https://api.kycprovider.com/v1/verify`, {
    first_name: identity.first_name,
    last_name: identity.last_name,
    nationality: identity.nationality,
    gender: identity.gender,
    dob: identity.dob,
    street: identity.street,
    city: identity.city,
    state: identity.state,
    post_code: identity.post_code,
    country: identity.country,
    id_document: identity.meta_data.id_document,
    id_document_type: identity.meta_data.id_document_type,
    id_document_number: identity.meta_data.id_document_number
  });

  const verifyResult: { status: string; message: string } = response.data;

  return verifyResult;
}
3

Save the KYC result

Finally, we’ll save the KYC result to the identity metadata:
saveKYCResult.ts
async function saveKYCResult(identity_id, kyc_result) {
  const headers = {
    Authorization: `Bearer ${api_key}`,
    "Content-Type": "application/json",
  };

  const response = await axios.post(
    `https://api.cloud.blnkfinance.com/proxy/${identity_id}/metadata?instance_id=${instance_id}`,
    { meta_data: { kyc_result } },
    { headers }
  );

  return response.data;
}
4

Create an alert if the KYC result is not successful

If the KYC result is not successful, we’ll create an alert instead:
createAlert.ts
async function createAlert(identity_id, kyc_result) {
  const headers = {
    Authorization: `Bearer ${api_key}`,
    "Content-Type": "application/json",
  };

  const response = await axios.post(
    `https://api.cloud.blnkfinance.com/alerts/flag/${identity_id}`,
    {
      title: "KYC verification failed",
      description: `${kyc_result.message}`,
    },
    { headers }
  );

  return response.data;
}

Run the example KYC app

Open the demo repository and follow its README to run the KYC example app this documentation is built around.

Need help?

If you’re having trouble with Blnk Cloud, don’t hesitate to send us a message via email at support@blnkfinance.com or send us a message here.