Form Data Params
- token - token received from Authenticate call
- appid - string with loan application number/name
- product - licensed product abbreviation, 'pdfinsights' or 'pdfinsightstp'
- structured - boolean for type of date returned:
- false (default) will give a simple list of transactions, similar to csv
- true will give a JSON structured list of accounts/statements/transactions
- Error Response:
- Code 401 if token/appid do not match
Sample Call:
Using curl
curl --location --request POST 'https://online.moneythumb.com/webapi/analyze/transactions' --form 'product=pdfinsights' --form 'token=_token_' --form 'appid=_appid_'
Using Javascript
var form = new FormData();
form.append("appid", "123"); form.append("token", "__token__"); var settings = { "async": true, "crossDomain": true, "url": "https://online.moneythumb.com/webapi/analyze/transactions", "method": "POST", "headers": {}, "processData": false, "contentType": false, "mimeType": "multipart/form-data", "data": form } $.ajax(settings).done(function (response) { console.log(response); });
6. Set Profile Information
Set profile information for a specific user
- URLhttps://online.moneythumb.com/webapi/profile/setvalue
- Method:POST
- URL ParamsNone
- Form Data Paramstoken - token received from Authenticate calluseremail - (optional). If present the email of an additional sub-account under this license. If not present the profile option applies to the licensed account, and is the default for all sub-accounts.name - string with name of profile value to set (see below for valid names)value - string with profile value
- Success Response:
- Error Response:
- Code: 400 if invalid names/values
Profile Names and Values
repeating_trans_min - minimum amount when finding repeating transactions. This is used so that very small values such as a small retail charges are ignored. Default value is 50.
repeating_trans_occur - number of times a transaction needs to repeat in order to considered repeating. Default is 5.
show_myaccount - whether the My Account button is visible for this license. Values are true or false, default is true.
show_remaining - whether the number of conversions remaining is shown for this license. Values are true or false, default is true.
statement_columns - the columns to be used in the Scorecard for each statement.
value is a comma separated string with column names from the following list. The order of values in this list will be the order used in the scorecard.
- account - account number
- startdate - start date of statement
- endate
- totalcredits
- numbercredits
- totaltruecredits
- numbertruecredits
- numberdebits
- totaldebits
- averagebalance
- startbalance
- endbalance
- daysnegative
- numbernsf
- numberod
- numbertransfers
Note that having too many columns will cause the display to be cut off.
trans_add - whether users of this license can add new transactions. Values are true or false, default is true.
trans_edit - whether users of this license can edit transactions. Values are true or false, default is true.
Sample Call:
Using Javascript
var profileformdata = new FormData();
profileformdata.append("token", token);
profileformdata.append("name", "statement_columns");
profileformdata.append("value", "account,endate,totalcredits,numbercredits,totaltruecredits,
totaldebits,averagebalance,startbalance,daysnegative,numbernsf,numberod");
$.ajax({
type : "POST",
url : baseurl + "webapi/profile/setvalue",
data: profileformdata,
processData: false,
contentType: false,
success : function()
{
....
},
error : function(jqXHR, textStatus, errorThrown)
{
alert("Error ");
}
});
7. Convert a PDF file for an application
Convert a bank statement PDF file and save the results in the current application
-
- URL: /webapi/pdfconvert/makecsv
- Method: POST
- URL Params: None
- Data Params: Mulitpart form parameters. An asterisk indicates required parameters.
token* - token received from Authenticate call
appid* - string with loan application number/name
product* - licensed product abbreviation, 'pdfinsights' or 'pdfinsightstp'
pdf-filename* - file to upload for conversion
webhook – url to call when conversion is complete, useful when some conversions are using OCR. For example 'www.mysite.com/done.php'. The page is called with the same JSON formatted data that is returned on a completed conversion.
readUSdates - flag - true for US Date format (M-D-Y), false for D-M-Y
language - statement language - ISO abbreviations: en, es, fr, de, ln, pt, it
accounttype - one of Bank, CCardt
doocrfile - flag to run OCR if the statement does not reconcile. Default (0) is to run OCR if statement is primarily an image. Set to 1 to always run OCR if the statement does not reconcile.
neverocr – flag to never run OCR. Default (0) is to run OCR if the file is an image file, or uses an encrypted font. Set to 1 to never run OCR.
nosepdates – flag if should treat a number like 0102 as January 2nd, rather than a plain number, such as a check number. Normally false, there are only 3 known banks that use this convention.
accountseqno - account number in the statement to process. 1 for first, etc. To process all accounts in a statement use -1.
monthseqno -statement number in the document to process. 1 for first, etc. To process all statement in the document use -1.
firstpage - first page number to process (if not page 1).
lastpage - last page number to process (if not last page in document).
combinelines - flag to combine description lines into one long description.
outputtype - transaction output format. Choices are “csv” or”json”. Default is csv. (not used for PDF Insights)
logtype - type of log to create. Choices are "txt", "htm" or "none". Default is htm.
fixedcolumns - flag as to whether standard CSV columns are used. If not set, then the columns will in the same order found in the PDF file. Setting outputtype to json automatically sets this flag as well.
alloweddiff - value for allowing small balance differences to be ignored. Default is 0. A value such as 100 would mark the statement as reconciled if the balances were accurate within $100.00
finduntrue - flag to automatically find untrue transactions. Default is false.
asyncocr - flag to run OCR asynchronously. Default is true. This also is used to determine whether an email is sent at the completion of a long OCR conversion.
- Success Response:
- Code: 200
Content: { JSON Structure with conversion results} see below
- OR
- Code: 202 ACCEPTED
Content: { tracking id with format "M-*.res" }
- OR
- Code: 401 UNAUTHORIZED
Content: { error : "Invalid license code" }
- OR
- Code: 500 INTERNAL SERVER ERROR
Content: { error : "You are unauthorized to make this request." }
JSON Fields
results - Array of results, one for each statement converted in this conversion
numtransactions - number of transactions found. If negative is an http-like error code.
reconciled - whether statement reconciled against balances or totals
donegate - whether statement values need to be negated in order for the statement to balance, typically true for credit card statements
balanceValid - whether the balance values are valid (a 0.00 balance could be accurate)
numcredits - number of credits found
numdebits - number of debits found
totcredits_bd - total value of credits
totdebits_bd - total value of debits
startbalance_bd - start balance found in statement
endbalance_bd - end balance found in statement
endbalancecalc_bd- end balance calculated. Could be different than endbalance if the statement did not reconcile
accountnumber - account number
nmonths - number of monthly statements in the PDF
monthseq - index number of statement processed (0 is first)
naccounts - number of accounts found in the statement
accountseq - index number of account processed (0 is first)
isOCR - true if processed with OCR
isImage- true if statement looks like a scanned document
doctype - 0 for bank/credit card statement, 1 for tax form
typos - number of typos fixed by PDF+ PinPoint
suspectcount - number of currency values with a low confidence digit
minresolution - if a scanned image, minimum resolution of pages
maxresolution - if a scanned image, maximum resolution of pages
firstdate - earliest date found in a transaction
lastdate - latest date found in a transaction
startdate - start date of statement (defaults to firstdate if not found)
enddate- end date of statement (defaults to lastdate if not found)
bankname - name of bank statement is from, if looked up
bankurl - url of bank, generally the most reliable way to identify the bank
accountowner - owner address block from statement
address1 - first line of address
city - city
state - state
postalcode - postal code
filepath - full filename of the file just processed
transactions - list of transactions
date - date of transaction
description - description of payee for transaction
amount - amount of transaction
memo - subsequent transaction description lines (in a single line of text)
checknumber - check number of check
type - transaction type if the PDF statement had such a column
ocrmissinginfo - for OCR, a flag indicating an incomplete transaction, missing either a date or an amount
ocrsuspect - for OCR, a flag indicating the currency value has one or more low confidence characters
logurl - url of log file for conversion
csvurl - url of csv file with transactions
convertedstatements - number of statements converted on this conversion
appinfo - info about this application
naccounts - number of accounts in this application
owner - account owner
naccounts - number of accounts in this application
totalstatements - total number of statements in this application
totalstatements_reconciled - number of statements reconciled
totaltaxforms - number of tax forms in this application
Sample Call
Using curl
curl --location --request POST 'https://online.moneythumb.com/webapi/pdfconvert/makecsv' --form 'token=_token_' --form 'product=pdfinsights' --form 'appid=_appid_' --form 'readUSdates=true' --form 'pdf-filename=@filename.pdf'
Using curl from PHP
$url='https://online.moneythumb.com/webapi/pdfconvert/makecsv';
$data['product']='pdfinsights';
$data['license']='3XBGaPRHE6KrJ5GYHB....GHRS';
$pdf=curl_file_create('pdfiles/statement.PDF', 'application/pdf');
$data['pdf-filename']=$pdf;
$data['readUSdates']='true';
$data['outputtype']='json';
$data['logtype']='text';
$request_headers[] = ‘Content-Type: multipart/form-data’;
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL,$url);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_request, CURLOPT_TIMEOUT, 30);
curl_setopt($curl_request, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($curl_request, CURLOPT_POST, true);
curl_setopt($curl_request, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($curl_request);
if(curl_errno($curl_request))
print curl_error($curl_request);
else
curl_close($curl_request);
$json_results = json_decode ($results, true);
echo ‘Number transactions found ‘ . $json_results[‘results’][0][‘numtransactions’] . ‘<br>’;
echo ‘Csv is at ‘ . $json_results[‘logurl’] . ‘<br>’;
echo ‘Log is at ‘ . $json_results[‘logurl’] . ‘<br>’;
Using Javascript
First create formdata in some combination of a form and/or code options
var form = document.getElementById('convert-form');
var formdata = new FormData(form);
formdata.append("readUSdates", true);
Then make the ajax call
ajax({
type: 'POST',
url: url,
data: formdata,
processData: false,
contentType: false,
dataType: 'json',
success: function(data){
echo 'Number of transactions: ' + data.results[index].numtransactions;
...
}
error: function(jqXHR, textStatus, errorThrown){
...
}
});
Example JSON Output
{"results":[{"numtransactions":135,"reconciled":true,"donegate":false,"balanceValid":true, "numcredits":5,"numdebits":130,"startbalance_bd":3086.29, "endbalance_bd":1756.05,"endbalancecalc_bd":1756.05, "totcredits_bd":31519.54,"totdebits_bd":32849.78000000001,"accountnumber":"001234567899", "bankname":"","bankurl":"Chase.com","accountowner":["SOME NAME","SOME ADDRESS","CITY ST 12345"], "nsfcount":0,"trackingid":"Chase checking", "firstdate":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "lastdate":{"iLocalMillis":1526860800000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "startdate":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "enddate":{"iLocalMillis":1526860800000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "filepath":"C:\\Ralph\\MoneyThumb\\Chase checking.pdf", "nmonths":1,"monthseq":0,"naccounts":1,"accountseq":0,"isOCR":false,"isImage":false, "doctype":0,"typos":0,"address1":"SOME ADDRESS","company":"SOME NAME", "city":"CITY", "state":"ST","postalcode":"12345","suspectcount":0,"remaining":10000,"imgfiles":[], "taxforms":[],"transactions":[ {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Card Purchase 04/18 Viva Italiano Pacifica CA Card 4215","amount":-16.88,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}, {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Card Purchase 04/20 Sand Dollar Restaura Stinson Bea CA Card","amount":-29.92,"memo":"4215","checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}, {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Card Purchase 04/21 P Town Cafe Pacifica CA Card 4215","amount":-5.80,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}, {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Card Purchase With Pin 04/21 Oreilly Auto PA Pacifica CA Card 4215","amount":-32.46,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}, {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Non-Chase ATM Withdraw 04/21 *Coastside Pacifica CA Card 4215","amount":-102.00,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}, {"date":{"iLocalMillis":1524441600000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Card Purchase 04/21 Granucci's Pacifica CA Card 4215","amount":-16.20,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false},
.....
{"date":{"iLocalMillis":1526860800000,"iChronology":{"iBase":{"iMinDaysInFirstWeek":4}}}, "description":"Interest Payment","amount":0.03,"checknumber":0,"ocrmissinginfo":false,"ocrsuspect":false}]}], "logurl":"https://online.moneythumb.com/results/M-IXBJJbN-5211652930396749203.htm", "csvurl":"https://online.moneythumb.com/results/M-IXBJJbN-5211652930396749203.csv", "error":"", "tid":"M-IXBJJbN-5211652930396749203", "outputurl":"","statementid":20768, "convertedstatements":0,"statementseq":0, "appinfo":{"appnumber":"123457","appid":230,"naccounts":1, "owner":"SOME NAME", "totalstatements":1,"totalstatements_reconciled":1, "totaltaxforms":0, "address1":"SOME ADDRESS","address2":"","citystate":"CITY STATE", "accountlist":["001234567899 - May 21, 2018"]}}
8. Check Conversion Status
PDF files requiring OCR can take longer to convert. In these cases, the conversion API call will return the HTTP 202 - Accepted status. The body will contain a tracking ID ending with ".res". To track the conversion status, the following API call should be used. To avoid generating too many calls to the server, it is recommended to wait at least 5 seconds between API calls. Note: it is recommended to use webhook when calling webapi/pdfconvert/makecsv instead of using this API method to check status.
- URL: https://online.moneythumb.com/webapi/pdfconvert/check
- Method: GET
- URL Params:
resfile - tracking ID returned by pdfconvert/makecsv API call
- Cookies:
JSESSIONID - cookie returned by pdfconvert/makecsv API call
product - licensed product abbreviation, 'pdfinsights' or 'pdfinsightstp'
appid - Application ID returned by application/new API call
- Success Response:
- Code: 200
- JSON data as returned by pdfconvert/makecsv
- Code: 206
- Text string with percentage complete
- Error Response:
- Codes 400, 410, 500
- Error message with descriptive error
Sample Call
Using curl
curl --location --cookie file_with_cookies --request GET "${server}/webapi/pdfconvert/check?resfile=trackingid"
9. Example bash script to upload a PDF file
The example script below will authenticate (replace userid@domain.com and SecretPassword with your login and password), get the new/existing appid, upload the PDF files and retrieve the scorecard and transactions. After you create the script on your machine (don't forget to make it executable), the first parameter passed should be the Application Number, and the rest of the parameters are thte PDF files to update. This example shows how to check the output of the upload, and wait until the PDF conversion is complete.
Command example: ./uploadexample.sh "My application test" testfile1.pdf testfile2.pdf ...
Sample script
#!/usr/bin/bash
server="https://online.moneythumb.com"
cookiejar="mycookies"
product="pdfinsights"
# add product to cookiejar
echo "${server#https://} FALSE / TRUE 0 product ${product}" > ${cookiejar}
echo "Authenticating"
licode=$(curl --silent --location \
--cookie-jar tmpjar \
--request POST "${server}/webapi/authenticate" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=userid@domain.com' \
--data-urlencode 'password=SecretPassword' \
--data-urlencode "product=${product}")
# add sessionid to cookiejar
grep "JSESSIONID" tmpjar >> ${cookiejar}
rm tmpjar
echo "Retrieving appid for "
appid=$(curl --silent --location \
--cookie ${cookiejar} \
--request POST "${server}/webapi/application/new" \
--form "token=${licode}" --form "appnumber=")
appid=${appid#*appid\":}
appid=${appid%%,*}
echo "appid=${appid}"
# add appid to cookiejar
echo "${server#https://} FALSE / TRUE 0 appid ${appid}" >> ${cookiejar}
# remove appnumber from commandline params
shift
# upload each file
for file in "$@"
do
echo "Uploading file ${file}"
curl --silent --location \
--cookie ${cookiejar} \
--request POST "${server}/webapi/pdfconvert/makecsv" \
--form "token=${licode}" --form "product=${product}" --form "asyncocr=false" \
--form "appid=${appid}" --form "readUSdates=true" --form "pdf-filename=@\"${file}\"" \
--no-keepalive --no-buffer \
--output ${file%.pdf}_summary.json
# check the output to see if it was completed
output=$(cat ${file%.pdf}_summary.json)
# if it wasn't completed, then the output is the tracking ID
resfile=${output}
# complete output is large, so if it is a small amount of text, do the checks
while [[ ${#output} -lt 50 ]]
do
# don't check more than once per second
sleep 1
curl --silent --location \
--cookie ${cookiejar} \
--request GET "${server}/webapi/pdfconvert/check?resfile=${resfile}" \
--no-keepalive --no-buffer \
--output ${file%.pdf}_summary.json
# new output will with be a percentage status or the JSON output
newoutput=$(cat ${file%.pdf}_summary.json)
if [[ ${newoutput} != ${output} ]]
then
if [[ ${#newoutput} -lt 50 ]]
then
# show the percentage
echo "${newoutput}"
fi
output=${newoutput}
fi
done
done
echo "Getting scorecard"
curl --silent --location \
--cookie ${cookiejar} \
--request POST "${server}/webapi/analyze/scorecard" \
--form "product=${product}" --form "token=${licode}" \
--form "appid=${appid}" --output ${appid}_scorecard.json
echo "Getting transactions"
curl --silent --location \
--cookie ${cookiejar} \
--request POST "${server}/webapi/analyze/transactions" \
--form "product=${product}" --form "token=${licode}" \
--form "appid=${appid}" --output ${appid}_transactions.json