#API integration
Here are the URLs you would need for calling Setu Insights APIs—
- Sandbox—https://di-uat.setu.co
- Production—https://insights.setu.co
- Headers—Contact Setu for providing the credentials required to successfully call Setu APIs. This contains—
x-client-idx-client-secretx-product-instance-id
#Data ingestion APIs
#Create FI Data block API
Call this API to create an FI data block for the user 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 payload is validated against the ReBIT schema.
If you need to pass multiple accounts of same type for a customer, you can go about it in one of the following ways,
- Pass the data for all accounts in a single call to the ingest API.
- 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 /v3/fiData?refId=your-unique-ref-id--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": {"linkedAccRef": "8a467ff9-51a5-4c8e-9cec-396d56acda13","maskedAccNumber": "XXXXXXXXXX2381","type": "deposit","version": "1.2","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": {"balanceDateTime": "2022-11-08T20:45:48+05:30","branch": "BALTANA","currency": "INR","currentBalance": "680.56","status": "ACTIVE","type": "SAVINGS"},"transactions": {"startDate": "2021-09-01","endDate": "2023-09-07","transaction": [{"amount": "1000","currentBalance": "20000","mode": "OTHERS","narration": "CDM Service Charges","transactionTimestamp": "2021-10-02T23:59:59+05:30","type": "CREDIT","valueDate": "2021-10-02"}]}}}]
Response
A dataId is assigned for this FI data block for usage in other APIs.
{"status": "Success","version": "0.73.1","body": {"refId": "test-single-account-15","fiSchema": ["deposit"],"expiryDate": "2025-07-06 07:03:12.312"}}
#Get FI data blocks API
Call this API to get a list of all FI data blocks created by you.
Request
GET /v1/fiData
Response
An array of FI data blocks created by you is returned.
{"status": "Success","statusDescription": "statusDescription","body": [{"dataId": "4e0ba220-9575-11eb-a8b3-0242ac130003","fiSchema": "deposit","expiryDate": "2023-05-16T10:16:53.334Z"}]}
#Insight generation APIs
#Create Insight report
This endpoint triggers an asynchronous job to generate insights on the data previously submitted with a refId.
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. You can also provide an optional accounts filter to generate insights only for specific accounts.
POST /v3/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": "b6418647-6397-47a8-8219-1bff5f7ddfe5","refId": "test-single-account-15","filters": {"accounts": []}}'
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 /v3/insight?reportId={reportId}--header 'Accept: application/json'--header 'x-client-id: <client_id>'--header 'x-client-secret: <client_secret>'--header 'x-product-instance-id: <product_instance_id>'
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?