Back to Dashboard

API Guide

Everything you need to connect scrapers, automate imports, and send email reports.

Quick Start

Every API call to the import/automation endpoints needs an API key sent as a header:

# Your API key goes in the X-API-Key header
curl -X POST YOUR_APP_URL/api/import/bills \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Manage your API keys in the API Keys section below.

Import Bills from a Scraper

This is the main endpoint your scraper calls. Send all the bills for one company at once.

Tip: Set "replace_existing": true to wipe and reload all outstanding bills each run. This is the simplest approach — your scraper just dumps everything fresh each time.

# POST /api/import/bills
# Imports bills for one company

curl -X POST YOUR_APP_URL/api/import/bills \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "company_name": "Paddock Equine",
  "replace_existing": true,
  "bills": [
    {
      "vendor_name": "Covetrus",
      "amount": 15455.07,
      "balance": 15455.07,
      "due_date": "2026-09-09",
      "status": "overdue"
    },
    {
      "vendor_name": "BCBS",
      "amount": 8313.33,
      "balance": 8313.33,
      "due_date": "2026-10-01",
      "status": "autopay"
    }
  ]
}'

Status Values:

overdue making_payments due_today billpay_scheduled due_later autopay paid

Company Names (use any of these):

"Paddock Equine" "Paddock" (short) "Paddock Paws" "Paws" (short) "La Serena" "Sofluk" "Pelham"

Generate Email Report

Get the "Outstanding Bills — By Company" email body as styled HTML, ready to paste into your email or send via API.

# Get email HTML (rendered page — open in browser)
GET YOUR_APP_URL/api/report/email?format=html

# Get email HTML as JSON (for automation)
GET YOUR_APP_URL/api/report/email
# Returns: { "html": "<div...>...</div>", "generated_at": "..." }

# After sending the email, log it:
curl -X POST YOUR_APP_URL/api/report/email-sent \
  -H "Content-Type: application/json" \
  -d '{"recipient": "boss@company.com", "count": 20}'

Read Data (no API key needed)

# Get all companies
GET /api/companies

# Get invoices for one company
GET /api/companies/1/invoices?show=outstanding
GET /api/companies/2/invoices?show=all

# Get all invoices across all companies
GET /api/invoices?show=outstanding

# Get summary stats
GET /api/summary

# Get saved vendors for a company
GET /api/companies/1/vendors

Complete Scraper Workflow

Here's what your automated flow looks like end-to-end:

1
Scraper logs into QB

Your agent navigates to QB Online, logs in, goes to Unpaid Bills / Recurring

2
Scraper reads the bills

Extracts vendor name, amount, balance, due date from the QB page

3
Scraper sends to this app

POST /api/import/bills with the bills array. Use replace_existing: true for a clean refresh.

4
You review & set statuses

Open the dashboard, click status badges to update them, add any manual bills

5
Generate & send the email

GET /api/report/email?format=html gives you the exact formatted email to send her

API Keys

Manage API keys for your scrapers. Each scraper should have its own key.

Import History

Loading...