Getting Started

Categorize and Analyse MPESA statement transactions

To categorize and analyze MPESA statement transactions, you will need:

  • A Credrails issued API key.
  • A valid MPESA statement PDF file.
  • Password to the file

You can use the API to get the analysis in either JSON format or as a PDF file download.

For a JSON result, make the following cURL request.

curl -X 'POST' \
  'https://<API_BASE_URL>/analyseAccountStatement' \
  -H 'X-API-KEY: <API_KEY> \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'data=@MPESA_Statement_20200604_to_20210604_2547XXXXXXXX.pdf;type=application/pdf' \
  -F 'fspId=mpesa' \
  -F 'password=12345677544

For a PDF file download, make the following cURL request.

curl -X 'POST' \
  'https://<API_BASE_URL>/analyseAccountStatementAndDownload' \
  -H 'X-API-KEY: <API_KEY> \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'data=@MPESA_Statement_20200604_to_20210604_2547XXXXXXXX.pdf;type=application/pdf' \
  -F 'fspId=mpesa' \
  -F 'password=12345677544