Expand description
The official Rust client for the Invoist API: turn invoices into structured data, read a household’s bills, and verify the webhooks Invoist sends.
§A business workspace
use invoist::{Client, UploadFile, WaitOptions};
let client = Client::from_env()?; // INVOIST_API_KEY
let file = UploadFile::from_path_async("invoice.pdf").await.expect("readable file");
let done = client.extract_and_wait(file, WaitOptions::default()).await?;
println!("{:?} owes {:?} cents", done.extraction.vendor_name, done.extraction.total_cents);§A household
use invoist::{Client, ListBillsParams};
let client = Client::from_env()?;
let unpaid = client
.bills()
.list(ListBillsParams { paid: Some(false), ..Default::default() })
.await?;
for bill in unpaid {
println!("{:?}: {:?} due {:?}", bill.vendor_name, bill.total_cents, bill.due_date);
}§Errors, retries, cancellation
Every failure is an Error with an HTTP status (0 when
no response arrived), a stable code, and the response’s
request_id. Failures worth retrying (no response,
429, 5xx) are retried up to twice, honouring Retry-After (a wait above
60 seconds fails at once instead), otherwise
backing off from 500ms with jitter. Dropping a call’s future cancels it.
§Features
rustls-tls(default): TLS through rustls. No OpenSSL.native-tls: TLS through the platform’s library instead.http2: HTTP/2 when the server offers it.blocking:blocking::Client, for code without an async runtime.
Money is always an i64 in minor units (cents), never a float.
Re-exports§
Modules§
- blocking
blocking - A synchronous client, for programs without an async runtime.
- error
- The one error type every call returns.
- models
- Request and response types, generated from the API’s OpenAPI document.
- webhooks
- Verifying the webhooks Invoist sends.
Structs§
- Bills
- A household’s bills (Invoist Personal), from
Client::bills. - Bills
Stats Params - Options for
Bills::stats. - Bills
Summary Params - Options for
Bills::summary. - Client
- The Invoist API client.
- Client
Builder - Configures a
Client. Start withClient::builder. - Create
Webhook Endpoint - A webhook endpoint to register with
Client::create_webhook_endpoint. - Extract
Options - Options for
Client::extract. - Extracted
Document - A document and its finished extraction, from
Client::extract_and_wait. - File
Download - A downloaded file: its bytes exactly as uploaded, and its media type.
- Held
Emails - Emails forwarded to a household that wait for approval, from
Client::held_emails. - List
Bills Params - Filters for
Bills::list. - List
Documents Params - Filters for
Client::list_documents. - List
Review Queue Params - Filters for
Client::list_review_queue. - Month
- A calendar month, sent to the API as
YYYY-MM. - Upload
File - A file to upload: its bytes, a filename, and optionally a media type.
- Wait
Options - How long
Client::wait_for_extractionwaits, and how often it asks.
Enums§
- Review
Resolution - How
Client::resolve_review_itemcloses an item.
Constants§
- DEFAULT_
BASE_ URL - The production API.
- DEFAULT_
MAX_ RETRIES - How many times a retryable failure is retried (so at most three attempts).
- DEFAULT_
TIMEOUT - How long one attempt may take before it fails with code
timeout. - USER_
AGENT - The
User-Agentevery request sends.