API Documentation - Parsevault

Loading...

Parsevault API

Extract structured data from any financial document using our AI-powered API

Overview

The Parsevault AI Document Intelligence API allows you to programmatically extract structured data from financial documents in PDF, JPG, PNG, or TIFF formats into structured formats like CSV, Excel, QuickBooks Online, Xero, or Word.

This enterprise-grade API is available to premium users and requires authentication using secure API tokens.

Authentication

API Token Authentication

All API requests must include an API token for authentication. Tokens can be generated in your account dashboard under the API Tokens section.

How to Generate an API Token

  1. Log in to your account
  2. Navigate to the API Tokens section in your dashboard
  3. Click "Create New Token" and provide a name for your token
  4. Copy and securely store the generated token (it will only be shown once)

Using Your API Token

Include your API token in the Authorization header of your requests:

Authorization: Bearer YOUR_API_TOKEN

API Endpoints

EndpointMethodDescription
/api/uploadPOSTUpload bank statements for conversion
/api/conversion-status/{jobId}GETCheck the status of a conversion job
/api/userGETGet information about the authenticated user

Upload Endpoint

POST /api/upload

This endpoint allows you to upload bank statements for conversion. The conversion process is asynchronous, and you'll receive a job ID to check the status later.

Request Parameters

ParameterTypeRequiredDescription
formatstringYesOutput format: csv, excel, qb_online, xero, or word
statementfile arrayYesBank statement files (PDF, JPG, PNG, or TIFF)
separate_debit_creditbooleanNoWhether to separate debit and credit columns (default: false)
combine_filesbooleanNoWhether to combine multiple files into a single output (default: false)

Status Endpoint

GET /api/conversion-status/{jobId}

This endpoint allows you to check the status of a conversion job. You should poll this endpoint until the job is completed.

Path Parameters

ParameterTypeDescription
jobIdstringThe job ID returned from the upload endpoint

User Endpoint

GET /api/user

This endpoint returns information about the authenticated user, including subscription status and available credits.

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests.

Status CodeDescription
200 OKThe request was successful
400 Bad RequestThe request was invalid or missing required parameters
401 UnauthorizedAuthentication failed or token is invalid
403 ForbiddenThe authenticated user doesn't have permission to access the resource
422 Unprocessable EntityValidation errors occurred
500 Internal Server ErrorAn error occurred on the server

Rate Limits

To ensure fair usage of the API, rate limits are applied based on your subscription plan:

  • Premium users: 100 requests per minute
  • Maximum file size: 20MB per file
  • Maximum files per request: 5 files

Code Examples

1// Upload a bank statement file
2const axios = require('axios');
3const FormData = require('form-data');
4const fs = require('fs');
5
6// Your API token from the dashboard
7const API_TOKEN = 'your_api_token_here';
8
9// Create a form data object
10const formData = new FormData();
11formData.append('format', 'csv');
12formData.append('statement', fs.createReadStream('bank_statement.pdf'));
13formData.append('separate_debit_credit', 'true');
14formData.append('combine_files', 'false');
15
16// Make the API request
17axios.post('https://parsevault.com/api/upload', formData, {
18  headers: {
19    'Authorization': `Bearer ${API_TOKEN}`,
20    ...formData.getHeaders()
21  }
22})
23.then(response => {
24  const jobId = response.data.job_id;
25  console.log(`Conversion job started with ID: ${jobId}`);
26
27  // Poll for job status
28  checkJobStatus(jobId);
29})
30.catch(error => {
31  console.error('Error uploading file:', error.response ? error.response.data : error.message);
32});
33
34// Function to check job status
35function checkJobStatus(jobId) {
36  axios.get(`https://parsevault.com/api/conversion-status/${jobId}`, {
37    headers: {
38      'Authorization': `Bearer ${API_TOKEN}`
39    }
40  })
41  .then(response => {
42    console.log('Job status:', response.data.status);
43
44    if (response.data.status === 'completed') {
45      console.log('Download URL:', response.data.download_url);
46      // Download the converted file
47      downloadFile(response.data.download_url);
48    } else if (response.data.status === 'processing') {
49      // Check again after 5 seconds
50      setTimeout(() => checkJobStatus(jobId), 5000);
51    }
52  })
53  .catch(error => {
54    console.error('Error checking job status:', error.response ? error.response.data : error.message);
55  });
56}
57
58// Function to download the converted file
59function downloadFile(url) {
60  const outputPath = 'converted_statement.csv';
61
62  axios({
63    method: 'get',
64    url: url,
65    responseType: 'stream',
66    headers: {
67      'Authorization': `Bearer ${API_TOKEN}`
68    }
69  })
70  .then(response => {
71    response.data.pipe(fs.createWriteStream(outputPath));
72    console.log(`File downloaded to ${outputPath}`);
73  })
74  .catch(error => {
75    console.error('Error downloading file:', error.message);
76  });
77}