Skip to main content
POST

Authentication

All requests to this endpoint must include a valid JWT in the Authorization header.

What this endpoint does

This endpoint queries the VendorConfig table for all active vendors, then searches the user’s Gmail account for matching invoice emails within the determined date range. HTML content from matching emails is uploaded to S3. Duplicate emails (already present in S3) are skipped. If no custom date range is provided, the search window is determined automatically:
  • First fetch: last 30 days.
  • Subsequent fetches: from the last_retail_invoice_fetch timestamp stored on the user record.
After a successful run, the user’s last_retail_invoice_fetch timestamp is updated. The Gmail account must be connected before calling this endpoint. See Store Gmail tokens.

Request body

The request body is optional. All fields are optional.
string
Start of the custom search date range, in YYYY-MM-DD format. Must be provided together with end_date.
string
End of the custom search date range, in YYYY-MM-DD format. Must be provided together with start_date.
string
Optionally restrict processing to a single vendor category. Valid values: food-delivery, clothing, technology, subscriptions, grocery, utility, miscellaneous, travel.

Response

string
A human-readable confirmation message. Example: "Retail invoices fetched successfully"
number
HTTP status code. 200 on success.
object

Error responses

Error responses follow this structure: