Getting Started

Learn how to integrate SmartBills API into your application and start extracting invoice data.

Getting Started

Learn how to integrate SmartBills API into your application and start extracting invoice data.

Prerequisites

Before you begin, make sure you have:

  • A SmartBills account with API access
  • Your API key (available in your dashboard)
  • Basic understanding of REST APIs

Installation

Using cURL

No installation required! You can use cURL to make requests directly:

curl -X POST https://api.smartbills.com/v1/invoices/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@invoice.pdf"

Using JavaScript/Node.js

Install our JavaScript SDK:

npm install @smartbills/sdk

Using Python

Install our Python SDK:

pip install smartbills-python

Quick Start

1. Upload an Invoice

Upload an invoice file for processing:

POST/v1/invoices/extract
POST

Extract data from an invoice file

::code-example{ curlExample="curl -X POST https://api.smartbills.com/v1/invoices/extract \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "file=@invoice.pdf""

javascriptExample="const SmartBills = require('@smartbills/sdk');

const client = new SmartBills('YOUR_API_KEY');

const result = await client.invoices.extract({ file: fs.createReadStream('invoice.pdf') });

console.log(result);"

pythonExample="import smartbills

client = smartbills.Client('YOUR_API_KEY')

with open('invoice.pdf', 'rb') as file: result = client.invoices.extract(file=file)

print(result)"

responseExample="{ "id": "inv_123456789", "status": "processing", "created_at": "2024-01-15T10:30:00Z", "file_url": "https://files.smartbills.com/inv_123456789.pdf\" }" } ::

2. Get Extraction Results

Check the status and retrieve the extracted data:

GET/v1/invoices/{id}
GET

Get invoice extraction results

::code-example{ curlExample="curl -X GET https://api.smartbills.com/v1/invoices/inv_123456789 \ -H "Authorization: Bearer YOUR_API_KEY""

javascriptExample="const result = await client.invoices.get('inv_123456789'); console.log(result.extracted_data);"

pythonExample="result = client.invoices.get('inv_123456789') print(result.extracted_data)"

responseExample="{ "id": "inv_123456789", "status": "completed", "extracted_data": { "invoice_number": "INV-2024-001", "date": "2024-01-15", "total_amount": 1250.00, "currency": "USD", "vendor": { "name": "Acme Corp", "address": "123 Business St, City, State 12345" } } }" }

Rate Limits

The SmartBills API has the following rate limits:

PlanRequests per minuteRequests per hour
Free10100
Pro1001,000
Enterprise1,00010,000

Rate Limit Headers

Each API response includes rate limit headers to help you track your usage:

  • X-RateLimit-Limit: Your rate limit ceiling
  • X-RateLimit-Remaining: Remaining requests in the current window
  • X-RateLimit-Reset: UTC timestamp when the rate limit resets

Error Handling

The API returns standard HTTP status codes. Here are the most common ones:

Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Next Steps