You are on page 1of 44

Perfios Insights Statement Upload API

Version 3.0

June 17, 2020

Contents

1 Process Flow 5
1.1 Perfios Insights Document Upload API Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 How Does It Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Signing Requests 6
2.1 Step 1. Create a canonical request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Step 2. Use the canonical request and additional metadata to create a string for signing . . . . . . . . . . 8
2.3 Step 3. Calculate a SHA256 checksum of the string to sign . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Step 4. Sign the checksum using the client’s RSA Private Key to create the signature . . . . . . . . . . . 8
2.5 Step 5. Add signature to the HTTP request in a header . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Note on URLs 8

4 API : Initiate Transaction 9


4.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.5 Request Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.6 Payload Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.7 A Note on Scanned Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.8 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.9 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.10 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.11 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1
Perfios Insights Statement Upload API Contents

5 API : Cancel Transaction 13

5.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.6 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.7 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6 API : Delete Transaction 15

6.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.6 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6.7 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

7 API : Upload File 16

7.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.5 Request Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.6 Success Response: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.7 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

7.8 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

8 API : Process Statement 18

8.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

8.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

8.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

8.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

8.5 Request Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

v 2.0 2
Perfios Insights Statement Upload API Contents

8.6 Payload Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

8.7 Success Response: E-statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

8.8 Success Response: Scanned Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

8.9 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

8.10 List of Statement Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

8.11 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

9 API : Re-Process Statement 22

9.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

9.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

9.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

9.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

9.5 Request Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

9.6 Payload Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

9.7 Success Response: E-statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

9.8 Success Response: Scanned Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

9.9 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

9.10 List of Statement Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

9.11 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

10 API : Report Generation 26

10.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

10.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

10.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

10.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

10.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

10.6 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

11 API : Retrieve Reports 27

11.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

11.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

11.5 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

v 2.0 3
Perfios Insights Statement Upload API Contents

12 API : Reprocess Transaction 29

12.1 Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

12.2 Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

12.3 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.4 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.5 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.6 Requires Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.7 Payload Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.8 Payload Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12.9 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

12.10Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

12.11 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

13 API : List Institutions 33

13.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

13.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

13.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

13.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

13.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

13.6 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

14 API : Transaction Status 35

14.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

14.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

14.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

14.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

14.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

14.6 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

14.7 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

15 API : Bulk Transaction Status 38

15.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

15.2 URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

15.3 Methods Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

v 2.0 4
Perfios Insights Statement Upload API 1 Process Flow

15.4 Content-Types Accepted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

15.5 Success Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

15.6 Sample Error Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

15.7 List of API Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

16 Notes on Some Topics 40

16.1 A note on date range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

16.2 A note on acceptance policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

16.3 A note on Transaction Complete callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

16.4 Type TRANSACTION_COMPLETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

16.5 Callback URL Whitelisting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

1 Process Flow

This section describes the high level process flow of the Perfios Insights API for Document Upload. Perfios Insights API
can be used to automate and expedite the processing of application in the financial sector, as listed below

• Income verification as part of loan application processing

• Income eligibility as part of loan application processing

• Income document submission as part of application processing for loan, credit card, Insurance etc.

1.1 Perfios Insights Document Upload API Listing

• Initiate Transaction

• Cancel Transaction

• Delete Transaction

• Upload File

• Process Statement

• Re-Process Statement

• Report Generation

• Retrieve Report

• Re-Process Transaction

v 2.0 5
Perfios Insights Statement Upload API 2 Signing Requests

1.2 How Does It Work?

• Step 1: The client starts by initiating a transaction using the Initiate Transaction API. This API returns a
response containing a time-limited perfiosTransactionId that the client can use to upload documents. The
perfiosTransactionId is valid for 60 minutes.

• Step 2: The client then proceeds to upload a file using the Upload File API. One file can be uploaded per API
call. This API returns a response with a file ID.

• Step 3: The client processes the uploaded file using the Process Statement API. This API returns the list of
ALL bank accounts processed so far (i.e. cumulative) if everything goes well.

• Step 4: After uploading and processing all documents the client invokes the Report Generation API to complete
the transaction. Perfios tries to generate one or more reports (XML, PDF, XLS, XLSX, JSON ) using the data from
the uploaded documents. This API returns a response indicating if the process succeeded.

• Step 5: After Step 4 succeeds, the client can use the Retrieve Report API to retrieve the report(s) generated for
this Transaction.

2 Signing Requests

This API introduces a major change in the way requests are signed.

• Clients must sign ALL API requests

• Server expects the signature as a request header: X-Perfios-Signature

• Some request headers are mandatory for ALL requests

Table 1: Mandatory request headers.

HTTP Request Header Value


Host Host. E.g. app.perfios.com
X-Perfios-Algorithm PERFIOS-RSA-SHA256
X-Perfios-Content-Sha256
Lowercase, hex encoded SHA256 sum of the XML or JSON payload (if there is no
payload then use an empty string)
X-Perfios-Date Timestamp in YYYYMMDD'T'HHMMSS'Z' format
X-Perfios-Signature Calculated Signature
X-Perfios-Signed-Headers
host;x-perfios-content-sha256;x-perfios-date

Request signature is calculated as follows.

1. Create a canonical request

2. Use the canonical request and additional metadata to create a string for signing

3. Calculate a SHA256 checksum of the string to sign

v 2.0 6
Perfios Insights Statement Upload API 2 Signing Requests

4. Sign the checksum using the client’s RSA Private Key to create a signature (SHA256withRSA/PSS)

5. Add the resulting signature to the HTTP request in a header

2.1 Step 1. Create a canonical request

A canonical request can be created as follows.

CanonicalRequest = HttpRequestMethod + "\n"


+ CanonicalUri + "\n"
+ CanonicalQueryString + "\n"
+ CanonicalHeaders + "\n"
+ SignedHeaders + "\n"
+ Lowercase(Hex(Sha256(PayloadOrEmptyString)))

Where:

CanonicalUri = UriEncode(path)

E.g.

• https://app.perfios.com/KuberaVault/api/v3/organisations/acme/transactions

– Path is /KuberaVault/api/v3/organisations/acme/transactions

• https://app.perfios.com/KuberaVault/api/v3/organisations/acme/transactions/G7BW1549868724968/report

– Path is: /KuberaVault/api/v3/organisations/acme/transactions/G7BW1549868724968/reports

CanonicalQueryString = UriEncode(<QueryParam1>) + "=" + UriEncode(<Value1>) + "&"


+ ... + UriEncode(<QueryParamN>) + "=" + UriEncode(<ValueN>) // Sorted by query parameter name

CanonicalHeaders = Lowercase(<HeaderName1>) + ":" + Trim(<value1>) + "\n"


+ ... + Lowercase(<HeaderNameN>) + ":" + Trim(<valueN>) // Sorted by header name

The following headers are deemed ’canonical’, and must be used in the above calculation:

1. Host

2. X-Perfios-Content-Sha256

3. X-Perfios-Date

SignedHeaders = host;x-perfios-content-sha256;x-perfios-date // Fixed string

PayloadOrEmptyString = Payload iff request requires XML/JSON payload, else empty string ""

v 2.0 7
Perfios Insights Statement Upload API 3 Note on URLs

2.2 Step 2. Use the canonical request and additional metadata to create a string for
signing

1. Start with the algorithm designation, followed by a newline character. Algorithm is PERFIOS-RSA-SHA256 (note
that this is the value of the mandatory header, X-Perfios-Algorithm)

2. Append the request date value, followed by a newline character. (note that this request date (RequestDate) is
the value of the mandatory header, X-Perfios-Date in the format YYYYMMDD'T'HHMMSS'Z'

3. Append the lowercase, Base 16 encoded, Sha256 hash of the canonical request created in the previous step

I.e.

StringToSign = "PERFIOS-RSA-SHA256" + "\n"


+ RequestDate in `YYYYMMDD'T'HHMMSS'Z'` format + "\n"
+ Lowercase(Hex(Sha256(CanonicalRequest)))

For e.g.:

StringToSign = "PERFIOS-RSA-SHA256" + "\n"


+ "20190213T114306Z" + "\n"
+ "87d5cd4e84282038505563542974ad5f3eafdad2ada5cfb91f8709d0fd46e497"

2.3 Step 3. Calculate a SHA256 checksum of the string to sign

Checksum = Lowercase(Hex(Sha256(StringToSign)))

2.4 Step 4. Sign the checksum using the client’s RSA Private Key to create the signa-
ture

Signature = Lowercase(Hex(RSA-Private-Key-Signed(Checksum)))

2.5 Step 5. Add signature to the HTTP request in a header

Add the X-Perfios-Signature header to the HTTP request, with the signature as its value.

3 Note on URLs

All URLs will have the following prefix:

• https://host-name/KuberaVault/api/v3

The host-name will vary depending on the target environment. E.g.

v 2.0 8
Perfios Insights Statement Upload API 4 API : Initiate Transaction

• Production Singapore Data Center (DC): www.perfios.com

• Production India DC: app.perfios.com

• UAT: demo.perfios.com

4 API : Initiate Transaction

4.1 URL

• /organisations/{organisationName}/transactions

4.2 URL Parameters

Table 2: Initiate Transaction URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios

4.3 Methods Accepted

POST

4.4 Content-Types Accepted

`application/xml`
`application/json`

4.5 Request Body

XML:

<?xml version="1.0" encoding="UTF-8"?>


<payload>
<loanAmount>100000</loanAmount>
<loanDuration>24</loanDuration>
<loanType>Home</loanType>
<processingType>STATEMENT</processingType>
<transactionCompleteCallbackUrl>https://example.com/callback</transactionCompleteCallbackUrl>
<txnId>PQ1342687YTX</txnId>
<!-- The following are optional -->
<acceptancePolicy>atLeastOneTransactionPerMonthInRange</acceptancePolicy>
<institutionId>2</institutionId>

v 2.0 9
Perfios Insights Statement Upload API 4 API : Initiate Transaction

<uploadingScannedStatements>true</uploadingScannedStatements>
<yearMonthFrom>2015-11</yearMonthFrom>
<yearMonthTo>2016-02</yearMonthTo>
</payload>

JSON:

{
"payload": {
"loanAmount": "100000",
"loanDuration": "24",
"loanType": "Home",
"processingType": "STATEMENT",
"transactionCompleteCallbackUrl": "https://example.com/callback",
"txnId": "PQ1342687YTX",
"acceptancePolicy": "atLeastOneTransactionPerMonthInRange",
"institutionId": "2",
"uploadingScannedStatements": "true",
"yearMonthFrom": "2015-11",
"yearMonthTo": "2016-02"
}
}

4.6 Payload Elements

Table 3: Initiate Transaction Payload.

Element Name Description


loanAmount Loan Amount in INR. Round to the nearest full Rupee. No decimal values.
loanDuration Loan Duration in Months. Integer ranging from 1 to 1188 (99 years)
loanType Loan Type (e.g. Home, Personal, Vehicle etc.). Maximum 64 characters
processingType Type of documents processed in this transaction
Possible values: STATEMENT (for processing bank
statements), SALARY_SLIP (for processing salary slips).
transactionCompleteCallbackUrl Perfios server will send an HTTP POST request to this url
after the transaction is completed. See the Notes on
Some Topics section for more details.
This element is mandatory if the client is uploading
scanned documents. See next element.
txnId Client-specified identifier to uniquely identify this transaction.
Alpha-numeric, or dash (-), maximum 64 characters.

v 2.0 10
Perfios Insights Statement Upload API 4 API : Initiate Transaction

Element Name Description


acceptancePolicy (Optional) Constrain the condition under which the
user’s data should be accepted and report generated. Can
be one of three possible values in case of bank
statements:
atLeastOneTransactionInRange: proceed if the user
has at least one transaction in the expected date range.
atLeastOneTransactionInStartAndEndMonths:
proceed if the user has at least one transaction in the
start and end months of expected date range.
atLeastOneTransactionPerMonthInRange:
proceed if the user has at least one transaction per month
in the expected date range.
institutionId User selected institution. See Supported Institutions API for full list.
uploadingScannedStatements (Optional) Indicates whether the client will upload
scanned documents - i.e. images - rather than
e-documents - i.e. text only. Possible values are true,
and false. True indicates that the client is uploading
scanned documents.
If this element is omitted, it is assumed that the client
will upload e-documents.
yearMonthFrom yearMonthTo (Optional) Constrain the date range for which data should be fetched
through netbanking, or uploaded by user in case of bank statements. Must
be a valid year-month in YYYY-MM format. Maximum and minimum values
are current month, and current month minus two years respectively. If one
of these is given, the other must also be supplied.

4.7 A Note on Scanned Documents

Perfios supports two types of documents: scanned (image), and e-documents (text-only). Of the two, scanned documents
are not immediately processed. Instead they are accepted for processing, and are processed later. The client will receive
a call back after processing completes (successfully or otherwise).

4.8 Success Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<transaction>
<perfiosTransactionId>ZZZZ1234567890123</perfiosTransactionId>
</transaction>

JSON:

v 2.0 11
Perfios Insights Statement Upload API 4 API : Initiate Transaction

"transaction": {
"perfiosTransactionId": "ZZZZ1234567890123"
}
}

Note: Client will need to use this perfiosTransactionId parameter in subsequent API calls.

4.9 Sample Error Response

See subsequent sections for a complete listing of API and Document Error Codes.

XML:

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>MethodNotAllowed</code>
<message>The specified method is not allowed for the API</message>
</error>

JSON:

{
"error": {
"code": "MethodNotAllowed",
"message": "The specified method is not allowed for the API"
}
}

4.10 List of API Error Codes

The following table lists possible values for API error codes applicable to this API for all processing types.

Table 4: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
DateRangeTooLarge The date range specified by the Client exceeds the contractually 400
permitted limit
InternalError We encountered an internal error. Please try again. 500
InvalidInstitution Client has sent an institutionId that is not supported by Perfios 400
MalformedXML Client has sent malformed XML for the API 400
MethodNotAllowed The specified method is not allowed for the API 405

v 2.0 12
Perfios Insights Statement Upload API 5 API : Cancel Transaction

HTTP
Status
Error Code Description Code
MissingHeaders Client has not sent one or more mandatory request headers 400
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header 400
value
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionLimitExceeded Client has exceeded the limit for number of transactions. 403
UnsupportedDocumentType Client is not permitted to process this type of document. 415
UnsupportedMediaType Client is not permitted this media type. 415
UnsupportedProcessingType Client is not permitted this processing type. 415
XMLSchemaMismatch XML sent by the client does not match the expected Schema 400

4.11 Note

See the last section for detailed notes on date range, acceptance policy and transaction complete callback.

5 API : Cancel Transaction

5.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}?cancel

5.2 URL Parameters

Table 5: Cancel Transaction URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response
cancel ’cancel’ query param represents an action and it is no value query parameter

5.3 Methods Accepted

POST

v 2.0 13
Perfios Insights Statement Upload API 5 API : Cancel Transaction

5.4 Content-Types Accepted

`application/xml`
`application/json`

5.5 Success Response

• HTTP Status code: 204 NO CONTENT

5.6 Sample Error Response

See subsequent sections for a complete listing of API and Document Error Codes.

XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


<error>
<code>NoActiveTransaction</code>
<message>We could not find an active transaction corresponding to this transaction Id</message>
</error>

JSON:

{
"error": {
"code": "NoActiveTransaction",
"message": "We could not find an active transaction corresponding to this transaction Id"
}
}

5.7 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 6: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
AccessDisabled Client access is disabled 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client

v 2.0 14
Perfios Insights Statement Upload API 6 API : Delete Transaction

HTTP
Status
Error Code Description Code
NotSignedUp Client has not signed up for the 403
Perfios Insights Service
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404

6 API : Delete Transaction

6.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}

6.2 URL Parameters

Table 7: Delete Transaction URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response

6.3 Methods Accepted

DELETE

6.4 Content-Types Accepted

`application/xml`
`application/json`

6.5 Success Response

• HTTP Status code: 204 NO CONTENT

6.6 Sample Error Response

See subsequent sections for a complete listing of API and Statement Error Codes.
XML:

v 2.0 15
Perfios Insights Statement Upload API 7 API : Upload File

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


<error>
<code>TransactionDeleted</code>
<message>The Perfios Transaction referred to by the Client has been deleted</message>
</error>

JSON:

{
"error": {
"code": "TransactionDeleted",
"message": "The Perfios Transaction referred to by the Client has been deleted"
}
}

6.7 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 8: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
AccessDisabled Client access is disabled 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
NotSignedUp Client has not signed up for the Perfios Insights Service 403
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404
TransactionStateConflictThe Perfios Transaction referred to by the Client is awaiting further 400
processing

7 API : Upload File

After starting the transaction, upload files one by one using this API. Send multi-part POST requests with the one file per
request.

v 2.0 16
Perfios Insights Statement Upload API 7 API : Upload File

7.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/files

7.2 URL Parameters

Table 9: Upload File URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response

7.3 Methods Accepted

POST

7.4 Content-Types Accepted

multipart/form-data

7.5 Request Structure

This API expects a multi-part request, with the contents of one file per call

7.6 Success Response:

• HTTP Status code: 200 OK

XML:

<?xml version="1.0" encoding="UTF-8"?>


<file>
<fileId>b09051b4ab2859b4ea66cc1a0128fa684e6c49f3</fileId>
</file>

JSON:

{
"file": {
"fileId": "b09051b4ab2859b4ea66cc1a0128fa684e6c49f3"
}
}

v 2.0 17
Perfios Insights Statement Upload API 8 API : Process Statement

7.7 Sample Error Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>MethodNotAllowed</code>
<message>The specified method is not allowed for the API</message>
</error>

JSON:

{
"error": {
"code": "MethodNotAllowed",
"message": "The specified method is not allowed for the API"
}
}

7.8 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 10: API Error Codes.

HTTP
Status
Error Code Description Code
CannotProcessFile We could not process the statement file uploaded by the Client 400
FileTooLarge Client tried to upload a file whose size is larger than the maximum allowed 400
InsecureFileType Client tried to upload an insecure file type (executable, DLL, JAR, etc.) 400
InternalError We encountered an internal error. Please try again. 500
LimitExceeded Client cannot upload more files for this transaction 403
MethodNotAllowed The specified method is not allowed for the API 405
NoActiveTransaction We could not find an active transaction corresponding to this transaction 404
Id
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
TransactionLimitExceeded
Client has exceeded the limit for number of transactions. 403
UnsupportedFileType We could not find the Perfios Transaction referred to by the Client 404

8 API : Process Statement

The Client can try to process an uploaded file as a statement using this API.

v 2.0 18
Perfios Insights Statement Upload API 8 API : Process Statement

8.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/bank-statements

8.2 URL Parameters

Table 11: Process Statement URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response

8.3 Methods Accepted

POST

8.4 Content-Types Accepted

`application/xml`
`application/json`

8.5 Request Body

XML:

<?xml version="1.0" encoding="UTF-8"?>


<payload>
<fileId>b09051b4ab2859b4ea66cc1a0128fa684e6c49f3</fileId>
<!-- The following are optional -->
<institutionId>22</institutionId>
<password>topSecret!</password>
</payload>

JSON:

{
"payload": {
"fileId": "09133d7543de5df7f610ec28c1a334d39f61306c",
"institutionId": "22",
"password": "topSecret!"
}
}

v 2.0 19
Perfios Insights Statement Upload API 8 API : Process Statement

8.6 Payload Elements

Table 12: Process Statement Payload.

Element Name Description


fileId File identifier obtained on uploading the file.
institutionId (Optional) Identify the institution that issued this bank statement
password (Optional) Password to open the statement, if applicable

8.7 Success Response: E-statements

• HTTP Status code: 200 OK

XML:

<?xml version="1.0" encoding="UTF-8"?>


<bankStatement>
<bankAccounts>
<bankAccount>
<accountId>fec4b3f2fd9fec90e03de0f564a34c37417df2af</accountId>
<accountNumber>XXXXXXXXXXXX0297</accountNumber>
<accountType/>
<complete>true</complete>
<institutionId>30</institutionId>
<missingMonths/>
</bankAccount>
</bankAccounts>
</bankStatement>

JSON:

{
"bankStatement": {
"bankAccounts": [
{
"accountId": "fec4b3f2fd9fec90e03de0f564a34c37417df2af",
"accountNumber": "XXXXXXXXXXXX0297",
"accountType": "Current",
"complete": true,
"institutionId": 30,
"missingMonths": []
}
]
}
}

v 2.0 20
Perfios Insights Statement Upload API 8 API : Process Statement

8.8 Success Response: Scanned Statements

• HTTP Status code: 202 Accepted

8.9 Sample Error Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>MethodNotAllowed</code>
<message>The specified method is not allowed for the API</message>
</error>

JSON:

{
"error": {
"code": "MethodNotAllowed",
"message": "The specified method is not allowed for the API"
}
}

8.10 List of Statement Error Codes

The following table lists API error codes applicable to this API.

Table 13: Statement Error Codes.

Error Code Description


E_DATE_RANGE No bank transactions in the expected date range
E_FILE_NO_PASSWORD No password provided to open a password protected file
E_FILE_WRONG_PASSWORD Wrong password provided to open a password protected file
E_OTHER Some other error occurred
E_STATEMENT_AMBIGUOUS_INSTITUTION Statement format matches those of multiple institutions
E_STATEMENT_UNSUPPORTED_FORMAT Unsupported statement format
E_STATEMENT_WRONG_INSTITUTION User uploaded statement for wrong institution
E_STATEMENT_NO_INSTITUTION_MATCHEDStatement uploaded by user did not match any institution

8.11 List of API Error Codes

The following table lists API error codes applicable to this API.

v 2.0 21
Perfios Insights Statement Upload API 9 API : Re-Process Statement

Table 14: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
CannotProcessFile We could not process the statement file uploaded by the Client 400
InternalError We encountered an internal error. Please try again. 500
MalformedXML Client has sent malformed XML for the API 400
MethodNotAllowed The specified method is not allowed for the API 405
MissingHeaders Client has not sent one or more mandatory request headers 400
NoActiveTransaction We could not find an active transaction corresponding to this 404
transaction Id
NotSignedUp Client has not signed up for the Perfios Insights Service 403
ProcessingTypeDoesNotMatch
Processing type does not match the type provided during transaction 400
initiation
RemoteAddressNotPermittedClient is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header 400
value
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404
TransactionLimitExceeded Client has exceeded the limit for number of transactions. 403
UnsupportedMediaType Client is not permitted this media type. 415
XMLSchemaMismatch XML sent by the client does not match the expected Schema 400

9 API : Re-Process Statement

Sometimes the Client may need to re-process a statement. E.g. if Perfios detects that the statement requires a password,
then the (error) response from the Process API will indicate as much. The Client can call the Re-Process API and supply
the password to process the statement again.

9.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/bank-statements/{statementFil

9.2 URL Parameters

v 2.0 22
Perfios Insights Statement Upload API 9 API : Re-Process Statement

Table 15: Re-Process Statement URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response
statementFileId fileId obtained from the Upload File API response

9.3 Methods Accepted

POST

9.4 Content-Types Accepted

`application/xml`
`application/json`

9.5 Request Body

XML:

<?xml version="1.0" encoding="UTF-8"?>


<payload>
<!-- The following are optional -->
<institutionId>22</institutionId>
<password>topSecret!</password>
</payload>

JSON:

{
"payload": {
"institutionId": "22",
"password": "topSecret!"
}
}

9.6 Payload Elements

Table 16: Re-Process Statement Payload.

Element Name Description


institutionId (Optional) Identify the institution that issued this bank statement
password (Optional) Password to open the statement, if applicable
v 2.0 23
Perfios Insights Statement Upload API 9 API : Re-Process Statement

9.7 Success Response: E-statements

• HTTP Status code: 200 OK

XML:

<?xml version="1.0" encoding="UTF-8"?>


<bankStatement>
<bankAccounts>
<bankAccount>
<accountId>fec4b3f2fd9fec90e03de0f564a34c37417df2af</accountId>
<accountNumber>XXXXXXXXXXXX0297</accountNumber>
<accountType/>
<complete>true</complete>
<institutionId>30</institutionId>
<missingMonths/>
</bankAccount>
</bankAccounts>
</bankStatement>

JSON:

{
"bankStatement": {
"bankAccounts": [
{
"accountId": "fec4b3f2fd9fec90e03de0f564a34c37417df2af",
"accountNumber": "XXXXXXXXXXXX0297",
"accountType": "Current",
"complete": true,
"institutionId": 30,
"missingMonths": []
}
]
}
}

9.8 Success Response: Scanned Statements

• HTTP Status code: 202 Accepted

9.9 Sample Error Response

XML:

v 2.0 24
Perfios Insights Statement Upload API 9 API : Re-Process Statement

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>MethodNotAllowed</code>
<message>The specified method is not allowed for the API</message>
</error>

JSON:

{
"error": {
"code": "MethodNotAllowed",
"message": "The specified method is not allowed for the API"
}
}

9.10 List of Statement Error Codes

The following table lists API error codes applicable to this API.

Table 17: Statement Error Codes.

Error Code Description


E_DATE_RANGE No bank transactions in the expected date range
E_FILE_NO_PASSWORD No password provided to open a password protected file
E_FILE_WRONG_PASSWORD Wrong password provided to open a password protected file
E_OTHER Some other error occurred
E_STATEMENT_AMBIGUOUS_INSTITUTION Statement format matches those of multiple institutions
E_STATEMENT_WRONG_INSTITUTION User uploaded statement for wrong institution
E_STATEMENT_NO_INSTITUTION_MATCHEDStatement uploaded by user did not match any institution

9.11 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 18: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
CannotProcessFile We could not process the statement file uploaded by the Client 400
InternalError We encountered an internal error. Please try again. 500
MalformedXML Client has sent malformed XML for the API 400

v 2.0 25
Perfios Insights Statement Upload API 10 API : Report Generation

HTTP
Status
Error Code Description Code
MethodNotAllowed The specified method is not allowed for the API 405
MissingHeaders Client has not sent one or more mandatory request headers 400
NoActiveTransaction We could not find an active transaction corresponding to this 404
transaction Id
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header 400
value
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404
TransactionLimitExceededClient has exceeded the limit for number of transactions. 403
XMLSchemaMismatch XML sent by the client does not match the expected Schema 400

10 API : Report Generation

After processing sufficient files the client can try generate reports for this transaction. Reports are not immediately
generated. Instead they are accepted for generation. The client will receive a call back after report generation completes
(successfully or otherwise).

10.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/reports

10.2 URL Parameters

Table 19: Report Generation URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response

10.3 Methods Accepted

POST

v 2.0 26
Perfios Insights Statement Upload API 11 API : Retrieve Reports

10.4 Content-Types Accepted

`application/xml`
`application/json`

10.5 Success Response

• HTTP Status code: 202 Accepted

10.6 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 20: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
MethodNotAllowed The specified method is not allowed for the API 405
MissingHeaders Client has not sent one or more mandatory request headers 400
NoActiveTransaction We could not find an active transaction corresponding to this transaction 404
Id
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header value 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404
TransactionLimitExceeded
Client has exceeded the limit for number of transactions. 403

11 API : Retrieve Reports

After processing sufficient files the client can try generate reports for this transaction.

11.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/reports?types={types}

v 2.0 27
Perfios Insights Statement Upload API 11 API : Retrieve Reports

11.2 URL Parameters

Table 21: Retrieve Reports URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response
types Comma separated types of reports to retrieve.

• E.g. ?types=xml: to retrieve XML report

• E.g. ?types=xml,pdf: to retrieve XML, and PDF


reports (as a zip file)

• E.g. ?types=xls,json: to retrieve XLS, and


JSON reports (as a zip file)

• E.g. ?types=xlsx: to retrieve XLSX report

• E.g. ?types=statements: to retrieve original


statements

• E.g. ?types=incomeTaxDocuments: to retrieve


income tax Documents

• E.g. ?types=transactions: to retrieve Amount


balance mismatch details

11.3 Methods Accepted

GET

11.4 Content-Types Accepted

`application/xml`
`application/json`

11.5 List of API Error Codes

The following table lists API error codes applicable to this API.

v 2.0 28
Perfios Insights Statement Upload API 12 API : Reprocess Transaction

Table 22: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
ArtifactNotFound We could not find the Transaction artifact referred to by the client 404
BadParameter One or more parameters sent by the Client are wrong 400
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
MissingHeaders Client has not sent one or more mandatory request headers 400
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header value 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotCompleted The Perfios Transaction referred to by the Client has not been completed 400
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404

12 API : Reprocess Transaction

This API allows clients to reprocess online transactions. Transactions can be reprocessed for the following purposes:

• Case 1: To fix a class of errors. Examples:

– No bank transactions in date range (Status: failure, ErrorCode: E_DATE_RANGE).


– Transaction was not accepted because of a stringent acceptance policy (Status: failure, ErrorCode:
E_NOT_ACCEPTED).

• Case 2: To enhance generated reports by providing additional information. Examples:

– A successfully completed transaction (Status: success, ErrorCode: E_NO_ERROR).

The API behaves differently based on the status of the transaction being reprocessed.

• An erroneous transaction (Case 1) is first updated and then reprocessed.

– The API response will return the existing transaction’s ID.

• An already completed transaction (Case 2) is first copied into a new transaction, and the new transaction is re-
processed. This allows clients to retrieve the original and enhanced reports from the existing and newly created
transactions respectively.

– The API response will return the new transaction’s ID.

v 2.0 29
Perfios Insights Statement Upload API 12 API : Reprocess Transaction

12.1 Example 1

Consider a transaction, say EALK1399956044292. The particulars are as follows:

• Date range is Dec 2016 through Mar 2017

• Acceptance policy is atLeastOneTransactionPerMonthInRange

• User did not have statements for year 2016

• Consequently transaction failed with E_NOT_ACCEPTED

The customer decides to reprocess this transaction by modifying it as follows:

• Change date range to Jan 2017 through Mar 2017

The transaction is modified, reports are generated, and the API responds as follows:

<?xml version="1.0" encoding="UTF-8"?>


<Status>
<perfiosTransactionId>EALK1399956044292</perfiosTransactionId>
</Status>

Note how the Perfios transaction ID is unchanged.

12.2 Example 2

Consider a transaction, say EALK1399956044292. The particulars are as follows:

• Date range is Dec 2016 through Mar 2017

• Acceptance policy is atLeastOneTransactionPerMonthInRange

• Transaction was successfully completed and reports generated

The customer decides to reprocess this transaction after providing some more additional parameters.

A new transaction is created (say AAAA1400067155303), reports are generated, and the API responds as follows:

<?xml version="1.0" encoding="UTF-8"?>


<Status>
<perfiosTransactionId>AAAA1400067155303</perfiosTransactionId>
</Status>

Note how the Perfios transaction ID changes. The API has responded with the transaction ID of the new transaction.

v 2.0 30
Perfios Insights Statement Upload API 12 API : Reprocess Transaction

12.3 URL

• /organisations/{organisationName}/transactions/reprocess

12.4 URL Parameters

Table 23: Reprocess Transaction URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios

12.5 Methods Accepted

POST

12.6 Requires Signature

Yes

12.7 Payload Structure

<?xml version="1.0" encoding="UTF-8"?>


<payload>
<perfiosTransactionId>EALK1399956044292</perfiosTransactionId>
<!-- The following are optional. Supply them as necessary to update the transaction. -->
<yearMonthFrom>2015-11</yearMonthFrom>
<yearMonthTo>2016-02</yearMonthTo>
<acceptancePolicy>atLeastOneTransactionInRange</acceptancePolicy>
</payload>

12.8 Payload Elements

Table 24: Reprocess Transaction Payload.

Element Name Description


perfiosTransactionId Perfios Transaction Id of the transaction to reprocess
yearMonthFrom yearMonthTo (Optional) Change the date range for which data should be fetched through
netbanking, or uploaded by user in case of statement upload. Must be a
valid year-month in YYYY-MM format. Maximum and minimum values are
current month, and current month minus two years respectively. If one of
these is given, the other must also be supplied.

v 2.0 31
Perfios Insights Statement Upload API 12 API : Reprocess Transaction

Element Name Description


acceptancePolicy (Optional) Change the condition under which the user’s
data should be accepted and report generated. Can be
one of two possible values:
atLeastOneTransactionInRange: proceed if the user
has at least one transaction in the expected date range.
atLeastOneTransactionInStartAndEndMonths:
proceed if the user has at least one transaction in the
start and end months of expected date range.
atLeastOneTransactionPerMonthInRange:
proceed if the user has at least one transaction per month
in the expected date range.

12.9 Success Response

<?xml version="1.0" encoding="UTF-8"?>


<Status>
<perfiosTransactionId>EALK1399956044292</perfiosTransactionId>
</Status>

12.10 Sample Error Response

See an earlier section for a complete listing of API Error Codes.

<?xml version="1.0" encoding="UTF-8"?>


<Error>
<code>TransactionDataDeleted</code>
<message>Original data associated with the Perfios Transaction referred to by the Client have been del
</Error>

12.11 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 25: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
AccessDisabled Client access is disabled 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
BadParameter One or more parameters sent by the Client are wrong 400
CannotProcessTransaction
The Perfios Transaction referred to by the Client cannot be processed 400

v 2.0 32
Perfios Insights Statement Upload API 13 API : List Institutions

HTTP
Status
Error Code Description Code
DateRangeTooLarge The date range specified by the Client exceeds the contractually permitted 400
limit
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
LimitExceeded Client has reached or exceeded the limit for making this request 403
MalformedXML Client has sent malformed XML for the API 400
MethodNotAllowed The specified method is not allowed for the API 405
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionDataDeleted Original data associated with the Perfios Transaction referred to by the 410
Client have been deleted
TransactionDeleted The Perfios Transaction referred to by the Client has been deleted 410
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404
TransactionLimitExceeded
Client has exceeded the limit for number of transactions. 403

13 API : List Institutions

Provides List of institutions supported by organisation.

13.1 URL

• /organisations/{organisationName}/institutions?processingType={}&dataSource={}

13.2 URL Parameters

Table 26: Institutions list supported by organisation.

Element Name Description


organisationName Client’s vendorId provided by Perfios

v 2.0 33
Perfios Insights Statement Upload API 13 API : List Institutions

Element Name Description


processingType Processing Type for which supported institutions to
fetch.

• E.g. ?processingType=STATEMENT: to fetch


supported institutions for STATEMENT
processing type

• E.g. ?processingType=NETBANKING_FETCH: to
fetch supported institutions for
NETBANKING_FETCH processing type

dataSource (Optional) Optional parameter dataSource for which supported


institutions to fetch. Data source defaults to
STATEMENT if the parameter is missing.

• E.g. ?dataSource=STATEMENT: to fetch


supported institutions for STATEMENT data
source

• E.g. ?dataSource=NETBANKING_FETCH: to fetch


supported institutions for NETBANKING_FETCH
data source

13.3 Methods Accepted

GET

13.4 Content-Types Accepted

`application/xml`
`application/json`

13.5 Success Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<institutions>
<institution>
<id>3</id>
<institutionType>bank</institutionType>
<name>ADCB, India</name>

v 2.0 34
Perfios Insights Statement Upload API 14 API : Transaction Status

</institution>
</institutions>

JSON:

{
"institutions": {
"institution": [
{
"id": 3,
"institutionType": "bank",
"name": "ADCB, India"
}
]
}
}

13.6 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 27: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
MethodNotAllowed The specified method is not allowed for the API 405
MissingHeaders Client has not sent one or more mandatory request headers 400
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header value 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
UnsupportedProcessingType
Client is not permitted this processing type 415

14 API : Transaction Status

Clients can use this API to find out the status of the Transaction.

v 2.0 35
Perfios Insights Statement Upload API 14 API : Transaction Status

14.1 URL

• /organisations/{organisationName}/transactions/{perfiosTransactionId}/status

14.2 URL Parameters

Table 28: Transaction Status URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
perfiosTransactionId perfiosTransactionId obtained from the Initiate Transaction API
response Or returned during transaction callback

14.3 Methods Accepted

GET

14.4 Content-Types Accepted

`application/xml`
`application/json`

14.5 Success Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<transactions>
<transaction>
<clientTransactionId>PQ1342687YTX</clientTransactionId>
<errorCode>E_NO_ERROR</errorCode>
<perfiosTransactionId>ZZZZ1234567890123</perfiosTransactionId>
<reason></reason>
<reportAvailable>true</reportAvailable>
<status>COMPLETED</status>
</transaction>
</transactions>

JSON:

{
"transactions": {
"transaction": [

v 2.0 36
Perfios Insights Statement Upload API 14 API : Transaction Status

{
"clientTransactionId": "PQ1342687YTX",
"errorCode": "E_NO_ERROR",
"perfiosTransactionId": "ZZZZ1234567890123",
"reason": "",
"reportAvailable": true,
"status": "COMPLETED"
}
]
}
}

14.6 Sample Error Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>TransactionNotFound</code>
<message>We could not find the Perfios Transaction referred to by the Client</message>
</error>

JSON:

{
"error": {
"code": "TransactionNotFound",
"message": "We could not find the Perfios Transaction referred to by the Client"
}
}

14.7 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 29: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
MethodNotAllowed The specified method is not allowed for the API 405

v 2.0 37
Perfios Insights Statement Upload API 15 API : Bulk Transaction Status

HTTP
Status
Error Code Description Code
MissingHeaders Client has not sent one or more mandatory request headers 400
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header value 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TooManyRequests Client has exceeded number of requests allowed per minute 429
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404

15 API : Bulk Transaction Status

Clients can use this API to find out the status of the Transactions in bulk.

15.1 URL

• /organisations/{organisationName}/transactions/status?startTime={startTime}&endTime={endTime}

15.2 URL Parameters

Table 30: Bulk Transaction Status URL Parameters.

Element Name Description


organisationName Client’s vendorId provided by Perfios
startTime startTime is a query parameter. Status of those transactions which were
done after this time will be fetched. This should be in ISO 8601 format
(yyyy-mm-ddThh:mm:ss).
endTime endTime is a query parameter. Status of those transactions which were
done before this time will be fetched. This should be in ISO 8601 format
(yyyy-mm-ddThh:mm:ss).

15.3 Methods Accepted

GET

15.4 Content-Types Accepted

`application/xml`
`application/json`

v 2.0 38
Perfios Insights Statement Upload API 15 API : Bulk Transaction Status

15.5 Success Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<transactions>
<transaction>
<clientTransactionId>PQ1342687YTX</clientTransactionId>
<errorCode>E_NO_ERROR</errorCode>
<perfiosTransactionId>NCZ61551262987290</perfiosTransactionId>
<reason></reason>
<reportAvailable>true</reportAvailable>
<status>COMPLETED</status>
</transaction>
</transactions>

JSON:

{
"transactions": {
"transaction": [
{
"clientTransactionId": "PQ1342687YTX",
"errorCode": "E_NO_ERROR",
"perfiosTransactionId": "NCZ61551262987290",
"reason": "",
"reportAvailable": true,
"status": "COMPLETED"
}
]
}
}

15.6 Sample Error Response

XML:

<?xml version="1.0" encoding="UTF-8"?>


<error>
<code>TransactionNotFound</code>
<message>We could not find the Perfios Transaction referred to by the Client</message>
</error>

JSON:

v 2.0 39
Perfios Insights Statement Upload API 16 Notes on Some Topics

{
"error": {
"code": "TransactionNotFound",
"message": "We could not find the Perfios Transaction referred to by the Client"
}
}

15.7 List of API Error Codes

The following table lists API error codes applicable to this API.

Table 31: API Error Codes.

HTTP
Status
Error Code Description Code
AccessDenied Client is not permitted to access this URL 403
ApiVersionNotPermitted Client is not permitted to access this Api Version 403
InternalError We encountered an internal error. Please try again. 500
InvalidEncryption We are unable to decrypt the signature using the RSA public key for this 400
client
MethodNotAllowed The specified method is not allowed for the API 405
MissingHeaders Client has not sent one or more mandatory request headers 400
NotSignedUp Client has not signed up for the Perfios Insights Service 403
RemoteAddressNotPermitted
Client is not permitted to access the API from this remote address 403
ResourceNotFound Resource not found 403
Sha256SumMismatch Calculated SHA256 checksum of the payload does not match header value 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you 400
provided.
TransactionNotFound We could not find the Perfios Transaction referred to by the Client 404

16 Notes on Some Topics

16.1 A note on date range

• If the client does not supply yearMonthFrom and yearMonthTo, then the date range is calculated using informa-
tion (number of months of data required) specified by the client at the time of signing up with Perfios.

• If the client supplies yearMonthFrom and yearMonthTo then the start and end dates are calculated as follows:

– Start date will be the first day of the month of yearMonthFrom


– End date will be the least (min) of last day of the month of yearMonthTo, and current date..

v 2.0 40
Perfios Insights Statement Upload API 16 Notes on Some Topics

16.2 A note on acceptance policy

• If the client does not supply acceptancePolicy, then the acceptance policy is calculated based on the
processingType as follows:

Processing Type Default acceptance policy


netbankingFetch atLeastOneTransactionInRange
statement atLeastOneTransactionPerMonthInRange
creditCardStatement atLeastOneStatementPerMonthInRange

• Only FULL months in the given range are considered while testing for acceptance. See the below for examples.

Table 33: Acceptance examples for atLeastOneTransactionInRange

monthFrom monthTo Current Date Full Months Transaction available for Accepted?
Feb 2016 May 2016 11 May 2016 3 (Feb-Apr) May NO
Feb 2016 May 2016 31 May 2016 4 (Feb-May) May YES
Feb 2016 May 2016 31 May 2016 4 (Feb-May) Feb, Mar YES

Table 34: Acceptance examples for atLeastOneTransactionInStartAndEndMonths

monthFrom monthTo Current Date Full Months Transaction available for Accepted?
Feb 2016 May 2016 11 May 2016 3 (Feb-Apr) Feb, May NO
Feb 2016 May 2016 11 May 2016 3 (Feb-Apr) Feb, Apr, May YES
Feb 2016 May 2016 31 May 2016 4 (Feb-May) Feb, Apr YES

Table 35: Acceptance examples for atLeastOneTransactionPerMonthInRange

monthFrom monthTo Current Date Full Months Transaction available for Accepted?
Feb 2016 May 2016 11 May 2016 3 (Feb-Apr) Feb, Mar, May NO
Feb 2016 May 2016 11 May 2016 3 (Feb-Apr) Feb, Mar, Apr, May YES
Feb 2016 May 2016 31 May 2016 4 (Feb-May) Feb, Mar, Apr, May YES

16.3 A note on Transaction Complete callback

• The Callback request will have following parameters.

v 2.0 41
Perfios Insights Statement Upload API 16 Notes on Some Topics

Table 36: Header sent as part of callback.

Header Name Description


X-Perfios-Callback-TypeType of callback request.

Table 37: possible values for X-Perfios-Callback-Type parameter.

X-Perfios-Callback-TypeDescription
TRANSACTION_COMPLETE Callback happened after transaction completed (successfully or otherwise).

The content of callback request differs based on X-Perfios-Callback-Type parameter.

16.4 Type TRANSACTION_COMPLETE

• Request content type will be application/json or application/xml. All data will be sent as part of request
parameters. See next tables for request parameters details.

Table 38: List of parameters sent as part of callback

Parameter Name Description


perfiosTransactionId Perfios Transaction Id
clientTransactionId Client-specified transaction identifier
status Status of the transaction. See below for possible values
errorCode Error code associated with the transaction. See below for possible values
errorMessage Error message associated with the transaction

Table 39: Possible values of status parameter.

status Description
COMPLETED Transaction completed successfully
ERROR There was an error processing the transaction
ERROR_USER Transaction did not succeed due to an user error
ERROR_SITE Transaction did not succeed due to a (bank) website error
ERROR_SESSION_EXPIRED User walked away without providing any useful inputs
CANCELLED User cancelled the transaction
REJECTED Perfios rejected the transaction

v 2.0 42
Perfios Insights Statement Upload API 16 Notes on Some Topics

Table 40: Possible values of errorCode parameter.

errorCode Description
E_AMOUNT_BALANCE_MISMATCH Calculated amounts/balances do not match actual values
E_API_SESSION_EXPIRED API session expired without the client taking any further action
E_BALANCE_SHEET_MISMATCH Assets and liabilities do not match in the balance sheet
E_AA_CONSENT_REJECTED Consent rejected while fetching data from account aggregator
E_AA_DATA_FETCH Error while fetching data from account aggregator
E_AA_INVALID_HANDLE User provided invalid AA handle
E_AA_SESSION_EXPIRY User session expired at AA page
E_DATE_RANGE No bank transactions in the expected date range
E_FILE_EDITOR_BLACKLISTED User uploaded a file edited by a blacklisted editor
E_FILE_IO Cannot open uploaded file
E_FILE_MALWARE Detected malware in uploaded file
E_FILE_NOT_STATEMENT Uploaded file is not a valid bank statement
E_FILE_NO_PASSWORD No password provided to open a password protected file
E_FILE_UNSUPPORTED_FORMAT Unsupported file format
E_FILE_WRONG_PASSWORD Wrong password provided to open a password protected file
E_INCOMPLETE_MONTHS Statement(s) uploaded contain incomplete months
E_MISSING_TRANSACTIONS One or more transactions are missing in the specified date range
E_MULTIPLE_ERRORS There were multiple errors
E_NOT_ACCEPTED Transaction did not meet the criteria set by acceptance policy
E_NO_ACCOUNT User has no bank accounts
E_NO_ERROR No errors
E_OTHER Some other error occurred
E_PL_MISMATCH Profit and loss mismatch
E_SITE Site error
E_STATEMENT_DUPLICATE User has uploaded duplicate statements
E_STATEMENT_ERRONEOUS_DATA Statement contains erroneous data
E_STATEMENT_MULTIPLE_ACCOUNTS Statement contains data from more than one bank account
E_STATEMENT_NO_TRANSACTIONS Statement contains no transactions
E_STATEMENT_POOR_QUALITY Cannot process statement due to poor quality
E_STATEMENT_TOO_MANY_PAGES Statement uploaded by user contains more pages than allowed
E_STATEMENT_UNSUPPORTED_FORMAT Unsupported statement format
E_STATEMENT_UNSUPPORTED_INSTITUTION
User uploaded statement for an institution not supported by Perfios
E_STATEMENT_WRONG_FORMAT Wrong statement format
E_STATEMENT_WRONG_INSTITUTION User uploaded statement for wrong institution
E_SYSTEM System (Perfios) error
E_USER_ACTION Error caused by User action
E_USER_BLOCKED User blocked for providing wrong user name or password for
institution(s) multiple times
E_USER_CANCELLED Perfios transaction was cancelled by user
E_USER_MULTIPLE_ACCOUNTS User has uploaded statements from multiple accounts
E_USER_SESSION_EXPIRED Session expired without the user taking any further action
E_WRONG_CREDENTIALS User provided wrong user name or password for institution

• Perfios expects an HTTP 200 OK response from the URL on receipt of callback request

v 2.0 43
Perfios Insights Statement Upload API 16 Notes on Some Topics

• If the first attempt fails, Perfios will try again two more times at regular intervals of five minutes (300 seconds)

• If a transaction concludes successfully, use the Retrieve Reports and Statements API to download the generated
report(s) and other artifacts.

• If a transaction does not conclude successfully, use the Transaction Status API to find out more details about why.

16.5 Callback URL Whitelisting

Transaction callback URLs must be whitelisted with Perfios before integration. Perfios will reject API requests that ask
for callbacks to non-whitelisted URLs (API will respond with HTTP 400 Bad Request).

Perfios will suspend callbacks to an URL if three attempts to execute callback to that URL fails (i.e. returns any response
other than HTTP 200 OK) Perfios will reject API requests that ask for callbacks to suspended URLs.

v 2.0 44

You might also like