Quotes from an invoice
Upload a purchase invoice, get every line item read, categorised and quoted, then correct a line and check eligibility rules.
Use these endpoints when a customer brings a receipt instead of a product in your catalog: a direct-to-consumer registration, a service counter, or an in-store sale of a plan for something bought elsewhere. SureBright reads the invoice, categorises each line, prices plans for each line, and keeps the result as a lead you can edit line by line. A separate endpoint applies the eligibility rules on their own.
No authentication header is needed for these endpoints.
The two invoice endpoints share a limit of 50 requests per minute across all callers. Over the limit they return 429 with a Retry-After header (seconds).
Upload an invoice#
POST https://{HOST_NAME}/quote/api/lead/invoice/upload
Send the invoice as multipart/form-data.
The invoice. PDF, PNG, JPEG, WebP or TIFF, up to 20 MB.
Your store identifier.
US or CA.
Invoice currency.
Your account identifier. Resolved from the store when omitted.
State or province, when prices vary by region.
Default CUSTOM.
An existing lead to replace with this invoice instead of creating a new one.
curl -X POST 'https://{HOST_NAME}/quote/api/lead/invoice/upload' \
-F 'file=@receipt.pdf;type=application/pdf' \
-F 'storeId=example-pos-store' \
-F 'country=US'Response#
leadIdstringThe lead holding this invoice. Use it to edit lines.
invoiceAssetIdstringReference to the processed file.
customerobjectWhat was read from the invoice: firstName, lastName, email, mobilePhone, and address (addressLine1, addressLine2, city, state, country, zip). Empty strings when not found.
lineItemsListobject[]One entry per line read from the invoice.
Errors#
Correct a line item#
PUT https://{HOST_NAME}/quote/api/lead/{leadId}/invoiceLineItem/{lineItemId}
Send any subset of the editable fields. A changed productTitle or description re-classifies the line unless you also send sbCategoryId, which wins. The line is always re-priced.
lineItemsList.curl -X PUT 'https://{HOST_NAME}/quote/api/lead/7f3a9c2e-4b1d-4e8f-9a6c-2d5b8e1f0a3c/invoiceLineItem/0c9e8d7b-6a5f-4e3d-2c1b-0a9f8e7d6c5b' \
-H 'Content-Type: application/json' \
-d '{ "productPrice": 1299.00, "productTitle": "Aero 2 Electric Scooter" }'Response: {"isError": false, "leadId": "...", "lineItem": {...}} where lineItem has the same fields as an entry of lineItemsList.
Check eligibility rules#
POST https://{HOST_NAME}/quote/api/eligibility/evaluate
Runs the eligibility rules for an invoice and its lines without quoting. The rules that apply depend on the calling application, identified by the site-id header; SureBright gives you the identifier for yours. The same rules run inside By Category when that call carries a site-id header: an invoice-level block returns 422, and blocked lines are listed in blacklistedItems.
purchaseDate (MM/DD/YYYY or YYYY-MM-DD), and optionally retailerName and totalAmount.
Each with productTitle and manufacturerName; other fields are passed through unchanged.
curl -X POST 'https://{HOST_NAME}/quote/api/eligibility/evaluate' \
-H 'site-id: YOUR_APP_ID' -H 'Content-Type: application/json' \
-d '{ "invoice": { "purchaseDate": "2026-10-20" },
"lineItemList": [ { "productTitle": "Aero 2 Electric Scooter", "manufacturerName": "Aero" } ] }'Rules#
A rule is skipped, not failed, when the field it needs is missing (purchaseDate for the age rule, productTitle for the product rule, manufacturerName for the manufacturer rule). Not every application runs the age rule.
Response#
Returned with 200 for eligible and ineligible results alike.
invoiceobjectisEligible, error (the invoice-level hit or null), notices.
lineItemListobject[]Your lines, each with isEligible, error (the blocking hit or null) and notices. Empty when the invoice itself is blocked.
summaryobjectblockedInvoice, blockedLineItemCount, and userMessage, a sentence you can show the customer.
A hit is {ruleId, errorCode, severity, message, match}.