# CLI (/docs/cli) --- title: CLI description: Run Invoice Radar from a terminal or an AI agent. icon: command-line --- The Invoice Radar CLI is currently macOS only. Linux and Windows support is on the roadmap. ## Overview The Invoice Radar CLI turns the desktop app into a scriptable invoice collection backend for terminals and AI agents. Use it to: - Fetch invoices from any connected service on demand - Search, export, and sync your documents - Hand the keys to an AI agent so it can collect invoices for you - Build and test new plugins against real billing platforms ## Install Open Invoice Radar and go to **Settings → General → CLI Access**, then enable **Invoice Radar CLI**. Verify it's working: ```bash invoice-radar status ``` If your shell can't find `invoice-radar`, add this to your shell profile and reopen the terminal: ```bash export PATH="$HOME/.local/bin:$PATH" ``` If the desktop app isn't running, this opens it and waits until it's ready: ```bash invoice-radar open --wait ``` ## Quickstart Add an integration, run it, and export an invoice: ```bash invoice-radar integrations available stripe invoice-radar integrations add stripe invoice-radar run stripe invoice-radar docs search stripe --limit 5 invoice-radar docs export ./invoice.pdf ``` ### Targeting an organization Most commands use the organization selected in the desktop app. To target a different one: ```bash invoice-radar --org docs search aws ``` ### JSON output For machine-readable output, add `--json`: ```bash invoice-radar --json docs search aws ``` ## Managing integrations List connected integrations: ```bash invoice-radar integrations list ``` Browse available integrations: ```bash invoice-radar integrations available invoice-radar integrations available stripe ``` Add an integration: ```bash invoice-radar integrations add stripe ``` The display name defaults to the integration name, for example `Stripe`. To use a custom name: ```bash invoice-radar integrations add stripe --name "Stripe EU" ``` Show or remove one: ```bash invoice-radar integrations show invoice-radar integrations remove --yes ``` ## Running integrations Run the full integration flow: ```bash invoice-radar run ``` `` can be an instance ID, or a plugin ID when only one instance matches. Run only one mode: ```bash invoice-radar run --mode check-auth invoice-radar run --mode start-auth invoice-radar run --mode config-options invoice-radar run --mode documents ``` Debug a run: ```bash invoice-radar run --debug invoice-radar run --keep-browser-open invoice-radar run --verbose ``` Pause at a breakpoint. The value is a JSON array of step locations — each entry pauses before the step at `index` for `length` steps: ```bash invoice-radar run \ --breakpoint '[{"index":0,"length":1,"type":"step"}]' ``` Stop a running integration: ```bash invoice-radar stop ``` ## Documents Import a local PDF: ```bash invoice-radar docs import ./invoice.pdf ``` Search documents: ```bash invoice-radar docs search "aws" --limit 25 invoice-radar docs search "aws" --unsorted invoice-radar docs search "aws" --include-deleted invoice-radar docs search "aws" --deleted ``` Show document metadata or extracted PDF text: ```bash invoice-radar docs show invoice-radar docs show --text ``` Export a PDF: ```bash invoice-radar docs export ./out/invoice.pdf invoice-radar docs export ./out/invoice.pdf --force invoice-radar docs export ./out/invoice.pdf --dry-run ``` Sync unsynced invoices to an export destination: ```bash invoice-radar docs sync --destination invoice-radar docs sync --destination --invoice invoice-radar docs sync --destination --force ``` CLI export is not available for trial organizations when the export would need a watermark. ## Config and autofill ### Integration config Show, describe, or set saved config: ```bash invoice-radar integrations config get invoice-radar integrations config describe invoice-radar integrations config set accountId=acct_123 enabled=true ``` Pipe JSON: ```bash printf '%s' '{"accountId":"acct_123","mailboxes":["Invoices"]}' \ | invoice-radar integrations config set ``` Pipe one raw value for one key: ```bash printf '%s' "$PASSWORD" \ | invoice-radar integrations config set autofill.password ``` Replace the full config instead of merging: ```bash printf '%s' '{"accountId":"acct_123"}' \ | invoice-radar integrations config set --replace ``` ### Autofill Autofill lets Invoice Radar fill login forms. Plugins can expose username, password, OTP, and submit fields. To see what an integration supports: ```bash invoice-radar integrations autofill fields ``` Store autofill values in the app config by piping through stdin: ```bash printf '%s' "$USERNAME" | invoice-radar integrations autofill set username printf '%s' "$PASSWORD" | invoice-radar integrations autofill set password printf '%s' "$OTP_SECRET" | invoice-radar integrations autofill set otpSecret ``` Use `otpSecret` for a saved TOTP secret. The CLI also accepts `otp` as a short alias. For one run only, pass values as environment variables: ```bash IR_AUTOFILL_USERNAME="me@example.com" \ IR_AUTOFILL_PASSWORD="$PASSWORD" \ IR_AUTOFILL_OTP_SECRET="$OTP_SECRET" \ invoice-radar run ``` Or pipe a JSON object into `run` — useful for agents that keep secrets in their own vault: ```bash printf '%s' '{"autofill.username":"me@example.com","autofill.password":"secret"}' \ | invoice-radar run ``` When both are present, stdin JSON overrides `IR_AUTOFILL_*` environment variables for the same field. ## Using the CLI from an agent An agent can use Invoice Radar as a tool instead of visiting every billing site manually. First make sure CLI access is enabled, or start the app through the CLI: ```bash invoice-radar open --wait ``` For an existing integration, the typical agent loop is: ```bash invoice-radar run invoice-radar docs search "" --json invoice-radar docs export ./out/invoice.pdf ``` If a platform is not supported yet, the agent can create a plugin JSON file, point Invoice Radar at the folder, add the local integration, and test it: ```bash invoice-radar integrations dev use ./invoice-radar-plugins invoice-radar integrations available example invoice-radar integrations add example invoice-radar run example --debug ``` ## Local plugin development Use a folder of local plugin JSON files: ```bash invoice-radar integrations dev use ./plugins ``` Check or clear the active plugin folder: ```bash invoice-radar integrations dev current invoice-radar integrations dev clear ``` Local plugins show up in `integrations available`, so an agent can create or edit a plugin, test it, inspect the run, and keep improving it. ## Debugging A typical debug loop: pause a run at a breakpoint, take a screenshot or inspect state, then continue. List running or paused integrations: ```bash invoice-radar debug list ``` Show run status and state: ```bash invoice-radar debug status invoice-radar debug state invoice-radar debug step-state s-0 ``` Continue after a breakpoint: ```bash invoice-radar debug continue ``` Inspect the browser: ```bash invoice-radar debug screenshot --out ./screen.png invoice-radar debug get-html invoice-radar debug get-html --selector "#app" invoice-radar debug run-js --script "document.title" invoice-radar debug network --limit 50 invoice-radar debug network --url invoices --method GET --detailed ``` ## Command reference | Command | What it does | | --- | --- | | `status` | Checks whether the desktop app is connected and shows the current organization. | | `open` | Opens the desktop app. `--wait` waits until the CLI connection is ready. | | `org list` | Lists organizations. | | `docs import` | Imports a local PDF invoice. | | `docs search` | Searches saved, unsorted, or deleted documents. | | `docs show` | Shows document metadata or extracted PDF text. | | `docs export` | Exports one invoice PDF to a file. | | `docs sync` | Syncs invoices to an export destination. | | `integrations list` | Lists connected integrations. | | `integrations available` | Searches available local and remote integrations. | | `integrations add` | Adds a connected integration. | | `integrations show` | Shows one connected integration. | | `integrations remove` | Removes one connected integration. | | `integrations autofill fields` | Shows available autofill fields. | | `integrations autofill set` | Stores one autofill value from stdin. | | `integrations config get` | Shows saved integration config with secrets redacted. | | `integrations config describe` | Shows config and autofill fields. | | `integrations config set` | Sets config from key/value args, JSON stdin, or one raw stdin value. | | `integrations dev current` | Shows the active local plugin folder. | | `integrations dev use` | Uses a folder for local plugin development. | | `integrations dev clear` | Clears the local plugin folder. | | `run` | Runs an integration. | | `stop` | Stops a running integration. | | `debug list` | Lists running or paused integrations. | | `debug status` | Shows running debug status. | | `debug continue` | Continues from a breakpoint. | | `debug state` | Shows run state summary. | | `debug step-state` | Shows saved state for one step. | | `debug screenshot` | Saves a screenshot of the running browser. | | `debug get-html` | Prints HTML from the running browser. | | `debug run-js` | Runs JavaScript in the running browser. | | `debug network` | Shows captured network requests. | # Introduction (/docs) --- title: Introduction description: Automate invoice collection from web portals and emails with Invoice Radar. --- ## What is Invoice Radar? Invoice Radar automates invoice collection from web portals and emails, saving you hours of manual work. Whether you're managing personal finances or business accounting, Invoice Radar streamlines the entire process of gathering and organizing your financial documents. [Request Access to Invoice Radar](https://invoiceradar.com/) · [Browse Community Plugins](https://github.com/invoiceradar/plugins/tree/main/plugins) ## Key Features - **🤖 Automated Collection** - Downloads invoices from web portals and scans email inboxes with intelligent document recognition. - **🔒 Privacy & Security First** - Data collection happens locally on your computer. Your credentials never leave your device. - **✨ AI Document Processing** - Extract key information from your invoices using AI - **📤 Automatic Exports** - Forward invoices to accounting software like sevdesk, Lexware, and BuchhaltungsButler. ## Documentation ### Core Features - **[Invoices from Web Portals](/docs/invoices-from-web-portals)** - Automated invoice collection from web portals - **[Invoices from Emails](/docs/invoices-from-emails)** - Collect invoices from your email accounts - **[Automatic Export](/docs/export)** - Automatically forward invoices to accounting software - **[CLI](/docs/cli)** - Run Invoice Radar from a terminal or an AI agent - **[Security & Privacy](/docs/security-privacy)** - How Invoice Radar protects your data ### Plugin Development - **[Creating Your First Plugin](/docs/plugins)** - Get started with plugin development - **[Plugin Reference](/docs/plugin-reference)** - Complete plugin structure and configuration - **[Steps Reference](/docs/steps-reference)** - All available plugin actions - **[Useful Patterns](/docs/patterns)** - Common solutions and best practices ## Contributing Invoice Radar thrives on community contributions. Create plugins for new services, report issues, or suggest improvements on [GitHub](https://github.com/invoiceradar/plugins). --- Ready to get started? Check out the documentation sections above to find what you're looking for. # Invoices from Emails (/docs/invoices-from-emails) --- title: Invoices from Emails description: Automatically collect invoices from your email accounts with secure SMTP and Google integration icon: emails --- ## How it works Invoice Radar finds invoices across all your connected email accounts and displays them in a **unified inbox**. When you review an invoice, you have two options: - **Accept a single invoice** - Approve this invoice without any future automation - **Trust the seller** - Automatically accept all future invoices from this sender This gives you complete control over which companies you trust for automatic collection. ## Connecting your email accounts To set up your unified inbox, you need to connect your email accounts to Invoice Radar. You can connect your email accounts using SMTP or OAuth. #### SMTP connection SMTP connection works with any email provider (Gmail, Outlook, Yahoo, or your business email). It connects directly to your email server just like any email app on your phone or computer. Your emails stay private and are processed entirely on your device. #### Login with Google (Gmail) You can sign in with Google to connect to your email. You'll authenticate directly with Google, and you can revoke access anytime from your Google account settings. The authentication happens directly between the app and Google with no server in between, ensuring there's no way for us to read your email. #### Login with Microsoft (Outlook) You can connect your Microsoft account with secure OAuth authentication. The connection is made directly between the app and Microsoft, ensuring your email data never passes through our servers. ## Your email stays private All email scanning happens locally on your computer. Invoice Radar only saves the invoice attachments you approve - your actual emails are never stored or transmitted anywhere. Connections to your email provider use TLS/SSL encryption, just like any secure email client. When using OAuth for Google or Microsoft, the authentication happens directly between the app and the email provider, meaning no data passes through our servers. For more details about how Invoice Radar protects your data, see our [Security & Privacy](/docs/security-privacy) guide. ## Automatic downloads from payment providers Some companies like **Paddle** and **SumUp** send you email notifications with download links instead of attaching the actual invoice PDF. Invoice Radar handles this automatically. When you receive a Paddle invoice notification, Invoice Radar will detect it, visit the Paddle portal using the link in your email, and download the actual PDF for you. SumUp receipts work the same way. More payment providers will be supported in the future. ## Configuration Options You can customize how Invoice Radar scans your email: - **Folder Selection** - Scan specific folders like "Inbox" or "Receipts" instead of all folders - **Email Address Filtering** - Filter by recipient address when multiple emails forward to the same inbox (e.g., billing@company.com) ## FAQ ### Microsoft: "Needs admin approval" error If you're using Microsoft 365 or Outlook with a business or organization account, you might see a "Needs admin approval" error when trying to connect your email. This happens because your organization's IT administrator needs to approve Invoice Radar before employees can use it. **Solution for IT administrators:** To approve Invoice Radar for your organization, an administrator needs to grant consent by visiting this link: ``` https://login.microsoftonline.com/common/adminconsent?client_id=7e59d229-c9e5-44da-9199-ef6c2f94b171&redirect_uri=https://invoiceradar.com/microsoft/admin-consent/success&scope=https://graph.microsoft.com/.default ``` After the administrator completes the approval process, all users in the organization will be able to connect their Microsoft email accounts to Invoice Radar. **What permissions are requested:** - `offline_access` - Allows the app to maintain access without requiring frequent re-authentication - `email` - Read your email address - `openid` - Sign you in and read your basic profile - `IMAP.AccessAsUser.All` - Read-only access to your mailbox via IMAP to scan for invoices # Invoices from Web Portals (/docs/invoices-from-web-portals) --- title: Invoices from Web Portals description: Automatically collect invoices from web portals using Invoice Radar icon: web-portals --- ## Overview Invoice Radar helps you collect invoices from web portals in bulk. The only thing you need to do is to select the service, log in and you're done. ## How It Works Getting started with Invoice Radar is simple: 1. **Choose a Service** - Select from over 100 pre-built plugins for popular services like Amazon, ChatGPT, AWS, and more 2. **Press Start** - Invoice Radar will navigate to the service, log in, and collect your invoices automatically 3. **Optional: Add Credentials** - For convenience, you can securely store your login details to enable automatic authentication That's it! Invoice Radar handles all the complex web automation behind the scenes. You can also create [your own plugins](/docs/plugins) to support any service you use. ## Secure by default You have full control over how Invoice Radar handles your credentials. In any case, no credentials are shared with us, making it as secure as using your regular browser. ### A. Automatic Login Store your credentials and your two-factor authentication (OTP) secrets for completely hands-free operation. ### B. Enter OTPs Manually Store your credentials, but enter your two-factor authentication (OTP) manually each time you collect invoices. ### C. Manual Login Log in manually each time you collect invoices. Invoice Radar never touches your credentials - it's exactly like using a regular browser. ## Supported Services Invoice Radar supports a wide range of services including: - Cloud providers (AWS, Google Cloud, Azure) - Advertising platforms (Google Ads, Meta Ads, etc.) - AI platforms (ChatGPT, Claude, etc.) - And many more... You can find a full list of supported services in [website](/). You can also browse our [community plugins](https://github.com/invoiceradar/plugins/tree/main/plugins) or learn how to [create your own](/docs/plugins). ## Security & Privacy All automation happens locally on your computer. Invoice Radar never sends your credentials or financial data to external servers - it's as secure as using your regular browser. For detailed security information, see our [Security & Privacy](/docs/security-privacy) guide. ## Getting Started [Request access to Invoice Radar](https://invoiceradar.com/) to start automating your invoice collection from web portals. Check out our [Plugin Development](/docs/plugins) guide to extend Invoice Radar with custom integrations. # Security & Privacy (/docs/security-privacy) --- title: Security & Privacy description: How Invoice Radar protects your data through local processing and end-to-end encryption icon: lock --- ## Core Security Principles Invoice Radar is built with a privacy-first architecture. Unlike cloud solutions, all collection happens locally on your computer - similar to how your web browser works. Your sensitive data stays fully private with our end-to-end encrypted synchronization. ## Runs locally on your computer When you collect invoices with Invoice Radar, it does not depend on any external services. It runs locally on your computer, ensuring your data stays private. **Key security benefits:** - Your login credentials never leave your computer - No need to share passwords or emails with external services - Full control over your sensitive financial data ## Secure Syncing To allow you to access your data from multiple devices and collaborate with team members, Invoice Radar synchronizes your data using end-to-end encryption. All your data is encrypted on your device using a memorable passphrase that serves as your account login, ensuring that your data remains unreadable to anyone without your passphrase. Passwords and login sessions stay on each device only. Even if our servers get hacked, your data stays safe without your passphrase. ## Automatic Export When you use [automatic export](/docs/export) to forward invoices to accounting software, your API credentials are encrypted and synced across your organization's devices using the same end-to-end encryption as your other data. **Security measures:** - **Direct connections** - All destinations¹ connect directly from your device to the service provider's API with no intermediary - **Encrypted sync** - API keys are encrypted and synced across your organization using end-to-end encryption - **HTTPS/TLS** - All API calls use secure encryption ¹ Except for email forwarding, which is uses Invoice Radar's email server for sending the invoices. No data is stored on our servers. ## AI Data Extraction Invoice Radar offers optional AI-powered data extraction to automatically identify key information from your invoices, such as vendor details, amounts, and dates. This feature is completely opt-in and designed with privacy in mind. When used, your invoice documents are sent to our AI service for processing, then immediately returned to your device. No data is stored on our servers. # Useful Patterns (/docs/patterns) --- title: Useful Patterns description: Common patterns and best practices for Invoice Radar plugin development --- ## Authentication Patterns ### Common patterns for authentication checks (`checkAuth`) #### Pattern 1: Go to Dashboard and Check URL Many services automatically redirect to the login page if the user is not authenticated. We can use this behavior to check if the user is authenticated. ```json { "action": "navigate", "url": "https://example.com/login" }, { "action": "checkURL", "url": "https://example.com/account" } ``` Depending on the service, they may redirect you from the dashboard to the login page if you are not authenticated. In this case, you can use the `checkURL` step to check if the URL still matches after visiting the dashboard. ```json { "action": "navigate", "url": "https://example.com/dashboard" }, { "action": "checkURL", "url": "https://example.com/dashboard" } ``` Note that you can use glob patterns to match dynamic URLs: `https://example.com/dashboard/**`. #### Pattern 2: Check for Logout Button You can use a selector that is unique to the authenticated state to check if the user is authenticated, e.g. a logout button or profile link. ```json { "action": "navigate", "url": "https://example.com/home" }, { "action": "waitForElement", "selector": "#logout-button" } ``` #### Pattern 3: Wait for Condition You can use the `waitForCondition` step to wait for a custom JavaScript condition to become true. ```json { "action": "waitForCondition", "script": "document.cookie.includes('auth_token=')" } ``` #### Tip: Make sure the website is fully loaded In some cases, the website has not fully loaded when the `checkElementExists` step is executed. To avoid this, you can use the `waitForNetworkIdle` attribute to wait for the page to be fully loaded. ```json { "action": "navigate", "url": "https://example.com/home", "waitForNetworkIdle": true }, { "action": "checkElementExists", "selector": "#logout-button" } ``` ### Common patterns for start authentication (`startAuth`) #### Pattern 1: Go to Login Page and wait for logged in state Most authentication processes start by navigating to the login page and waiting for a specific element to appear after a successful login. Remember that the browser will be visible during the authentication process, allowing the user to interact with the login form. The authentication flow itself can be automated, but isn't required. ```json { "action": "navigate", "url": "https://example.com/login" }, { "action": "waitForElement", "selector": "#logout-button" } ``` To give the user enough time to log in, it's recommended to provide a long timeout to the wait step, with a default of 120 seconds. ## Advanced Patterns ### Running a fetch request Sometimes, you might need to run a fetch request inside a step to fetch data from an API. To do this, you can use the `extractAll` action. ```json { "action": "extractAll", "variable": "invoice", "script": "fetch('https://example.com/api/invoices').then(res => res.json())", "forEach": [ { "action": "downloadPdf", "url": "{{invoice.url}}", "document": { "id": "{{invoice.id}}", "date": "{{invoice.date}}", "total": "{{invoice.total}}" } } ] } ``` This will run the fetch request and return the result as a JavaScript object. ### Paginating with a "Next" button Use selector pagination when the UI has a next button or link. ```json { "action": "extractAll", "selector": ".invoice-row", "fields": { "id": ".invoice-id", "date": ".invoice-date", "total": ".invoice-total", "url": ".invoice-link[href]" }, "pagination": { "selector": "button.next-page", "waitForSelector": ".invoice-row" }, "forEach": [ { "action": "downloadPdf", "url": "{{item.url}}", "document": { "id": "{{item.id}}", "date": "{{item.date}}", "total": "{{item.total}}" } } ] } ``` If `waitForSelector` is omitted, Invoice Radar waits for network idle after clicking the next selector. ### Cursor-based pagination (script) Use script pagination for APIs that return a cursor or `nextPage` token. It also works for selector-based extraction when you want custom logic to decide whether to paginate (and can optionally click "next" inside the script). ```json { "action": "extractAll", "script": "async (prev) => { const cursor = prev?.nextCursor; return fetch(`https://example.com/api/invoices?cursor=${cursor ?? ''}`).then(res => res.json()) }", "transform": "(result) => result.items", "pagination": { "script": "(result) => Boolean(result.nextCursor)", "behavior": "paginateThenProcess" }, "forEach": [ { "action": "downloadPdf", "url": "{{item.pdfUrl}}", "document": "{{item}}" } ] } ``` In this pattern: - The `extractAll` script receives the previous raw result as `prev`. - The `pagination.script` receives the current raw result and returns `true` to continue. - `transform` maps the raw response to an array of items. For selector-based `extractAll`, `pagination.script` receives the extracted items array (after `transform`) and can also perform pagination actions like clicking a "next" button before returning `true`. ### Run steps inside an `