/

to search

Introducing Setu Changelog Check it out ↗

#API integration

Here are the URLs you would need for calling Setu Insights APIs—


#Data ingestion APIs

#Create FI Data block API

Call this API to create an FI data block for the customer data you would like to feed into Setu Insights.

Request

Send the financial data as payload in the body. The payload should be same as the data provided by the FIP. The JSON schema for different data types is available in FI Data Types. The ReBIT schema is available here.

If you need to pass multiple accounts of same type for a customer, you can go about it in one of the following ways,

  1. Pass the data for all accounts in a single call to the ingest API.
  2. If you feel the data is too large, you can pass the data for each account in a separate call to this API. Remember to pass the same refId parameter in each call.

We recommend using the first approach. There should be no issues with JSON data of upto 1 MB.


If you want to pass accounts of different types, ie deposit, mutual_fund, etf etc. we recommend the second approach. Remember to pass the same refId parameter in each call. We plan to support this with a single API call approach in the future.


POST /v2/fiData?refId=4e0ba220-9575-11eb-a8b3-0242ac130003
--header 'Content-Type: application/json'
--header 'x-client-id: <client_id>'
--header 'x-client-secret: <client_secret>'
--header 'x-product-instance-id: <product_instance_id>'
--data-raw '[{
"account": {
"profile": {
"holders": {
"holder": [
{
"name": "Ashok Kumar",
"dob": "2019-08-24",
"mobile": "9999999999",
"nominee": "REGISTERED",
"landline": "1234567890",
"address": "123 Main Street",
"email": "ashok@xyz.com",
"pan": "ABCD1234X",
"ckycCompliance": true
}
],
"type": "SINGLE"
}
},
"summary": {
"pending": {"transactionType": "CREDIT", "amount": 0},
"currentBalance": "20000",
"currency": "INR",
"balanceDateTime": "2019-08-24T14:15:22Z",
"type": "SAVINGS",
"branch": "NARKATIAGANJ BH",
"facility": "OD",
"ifscCode": "ABCD1234X",
"micrCode": "123456789",
"openingDate": "2019-08-24",
"currentODLimit": "20000",
"drawingLimit": "20000",
"status": "ACTIVE"
},
"transactions": {
"transaction": [
{
"type": "CREDIT",
"mode": "CASH",
"amount": 0,
"currentBalance": "20000",
"transactionTimestamp": "2019-08-24T14:15:22Z",
"valueDate": "2019-08-24",
"txnId": "123456789",
"narration": "string",
"reference": "string"
}
],
"startDate": "2019-08-24",
"endDate": "2019-08-24"
},
"type": "deposit",
"maskedAccNumber": "XXXXXXXXXXX1234",
"version": "2.0",
"linkedAccRef": "123456789"
}
},
// second account in the same API call
{
"account": {
// similar to above one
}
}
]

Response

A dataId is assigned for this FI data block for usage in other APIs.

{
"status": "Success",
"version": "1.0",
"body": {
"refId": "4e0ba220-9575-11eb-a8b3-0242ac130003",
"fiSchema": "deposit",
"expiryDate": "2023-05-16 09:23:39.115"
}
}

#Insight generation APIs

#Create Insight report

Call this API to generate an Insights report based on the customer's FI data block created earlier. Each customer is identified by it's refId. Pass the templateId obtained from template creation step, which will determine the ouput insights parameters that will be present in the report.

You can use the same refId for multiple data blocks for a single customer.

Request

Send the customer refId and the templateId as the payload.

Currently, only one refId is supported in the request body.


POST /v2/insight
--header 'Content-Type: application/json'
--header 'x-client-id: <client_id>'
--header 'x-client-secret: <client_secret>'
--header 'x-product-instance-id: <product_instance_id>'
--data-raw '{
"templateId": "4777db7e-e604-4c0c-a410-51be9d17d00b",
"refIds": [
"4e0ba220-9575-11eb-a8b3-0242ac130003"
]
}'

Response

A reportId is returned along with the status of the Insights generation job. A notification will be posted after successful generation of insights. See notifications.

The reportId also can be used fetch the Insights report using Get Insight report API, if the report status is Success.

{
"status": "Success",
"body": {
"reportId": "4b108e83-07b6-47a4-84cd-a77d0e9e2b3d",
"status": "in-progress"
}
}

#Get Insight report

Call this API to fetch the Insights report. Pass the reportId as a URL parameter, which was returned in the response body of Create Insight report API.

Request
GET /v1/insight?reportId=4b108e83-07b6-47a4-84cd-a77d0e9e2b3d

Response

A dictionary, where insight names are keys and insights are values, is returned

{
"status": "Success",
"body": {
"name": "Redacted Services",
"dob": "2006-06-27",
"email": "redacted@gmail.com",
"pan": "redacted",
"ckyc_compliance": false,
"mobile": 9999912345,
"bank_branch": "NARKATIAGANJ BH",
"bank_account_number": "XXXXXXXXXXX1234",
"bank_account_type": "CURRENT",
"opening_date": "2019-02-26",
"closing_balance": 27929.84,
"end_of_month_balances": {
"2021": {
"9": 245676.89,
"10": 48650.54,
"11": 145487.41,
"12": 97725.67
},
"2022": {
"1": 9152.09,
"2": 5957.19,
"3": 545.59,
"4": 1282299.18,
"5": 134376.04,
"6": 84468.46,
"7": 135585.11,
"8": 3346.11,
"9": 268766.7,
"10": 50049.84,
"11": 27929.84
}
},
"balances_on_10th": {
"2021": {
"12": 55387.41
},
"2022": {
"1": 2426.67,
"2": 9629.59,
"3": 97487.45,
"4": 1641.09,
"5": 52517.54,
"6": 72084.28,
"7": 165864.04,
"8": 63465.11,
"9": 11226.11,
"10": 418535.81,
"11": 27929.84
}
},
"average_end_of_day_balance": 297715.03,
"maximum_end_of_day_balance": 1818766.7,
"total_credits": 153,
"total_credits_value": 44810341.06,
"total_debits": 473,
"total_debits_value": 45178088.11,
"quarterly_salary_average": {
"2021": {
"4": 15072
}
},
"cash_deposit_x_total_credit": {
"2021": {
"12": 0.0095
},
"2022": {
"3": 0.0018
}
}
}
}

Was this page helpful?