This guide demonstrates how to set up a simple invoice system in Bosbec and expose its data through an API.
The example stores incoming supplier invoices, outgoing customer invoices, and invoice review flags in your Bosbec account. A pre-built workflow exposes endpoints for retrieving and creating this data.
By giving the API documentation to an AI assistant or agent, the AI can use the API as a tool for retrieving information from the system. This lets you ask practical accounting questions in natural language without creating a dedicated endpoint for every question.
For example:
- Do we have any incoming invoices from Nordic Office AB over 50,000?
- Which invoices may have been registered twice?
- What is the total amount for account 5410 this month?
- Show me unpaid outgoing invoices in the Equipment category.
- Create a review flag for an invoice with an unusual VAT amount.
The example is also intended as a starting point. As your accounting processes develop, the workflow and API can be extended with additional filters, summaries, or endpoints for recurring questions.
How it works
The solution consists of two types of data stored in Bosbec:
- Invoices
- Invoice Flags
The workflow exposes HTTP endpoints that allow an external client to create, retrieve, filter, and summarize these resources.
The API currently supports:
| Method | Endpoint | Description |
|---|---|---|
GET |
/invoices |
Retrieve invoices using filters and pagination |
POST |
/invoices |
Create an invoice |
GET |
/invoice-summary |
Return an aggregated invoice summary |
GET |
/invoice-flags |
Retrieve invoice review flags |
POST |
/invoice-flags |
Create an invoice review flag |
The invoice endpoint supports pagination and filters for fields such as counterparty, direction, status, account, category, date, and amount. Summaries and filtering are calculated by the API before the data is returned to the AI.
The API documentation contains the complete list of endpoints, parameters, request bodies, and examples.
Set up the workflow
Open Workflow Builder and navigate to View > Workflow Library.
Under Tutorials, find and import the template named Bosbec: Invoice API.
If you created your account using the button on this page, you may already have selected this template when launching Workflow Builder and can skip this step.
Configure its HTTP triggers to use an HTTP-in channel on your account.
If your HTTP-in channel has the base URL:
https://example.in.bosbec.io
the API endpoints exposed by the workflow will look similar to:
GET https://example.in.bosbec.io/invoices
POST https://example.in.bosbec.io/invoices
GET https://example.in.bosbec.io/invoice-summary
GET https://example.in.bosbec.io/invoice-flags
POST https://example.in.bosbec.io/invoice-flags
Save and activate the workflow when the configuration is complete.
Update the API documentation
The API documentation supplied with this example contains a Base URL that must be updated to match the HTTP-in channel you configured.
By default, the documentation contains:
Base URL: https://example.in.bosbec.io
Replace this with the URL of your own HTTP-in channel.
For example, if your channel uses:
https://my-invoice-api.in.bosbec.io
update the documentation to:
Base URL: https://my-invoice-api.in.bosbec.io
This step is important because the AI assistant uses the API documentation to determine where requests should be sent. If the Base URL still points to the example address, the assistant will not be able to access your workflow.
Give the API documentation to your AI assistant
Once the workflow is running and the Base URL has been updated, provide the accompanying API documentation to an AI assistant or agent that is capable of making HTTP requests.
The documentation describes:
- The API Base URL
- Available endpoints and HTTP methods
- Query parameters and pagination
- Request bodies and expected data types
- Invoice summaries and review flags
The AI can use this information to determine which requests it needs to make based on what you ask it to do.
This applies to both reading data and creating review flags.
Instead of manually constructing API requests, you can interact with the system using natural language.
Add some example data using the AI assistant
A convenient way to populate the system for testing is to ask the AI assistant to create some example invoices for you.
For production use, you can integrate the workflow with an existing accounting, ERP, or invoice-management system instead of posting invoices through this API. The integration can synchronize invoices into Bosbec while the API provides a queryable layer for AI-assisted analysis and review.
Because the API documentation contains the invoice POST endpoint, the AI already knows which fields are required when creating an invoice.
For example, you could ask:
Create ten example incoming invoices from different suppliers. Use a mix of accounts, categories, amounts, invoice dates, and payment statuses.
You could then ask:
Create five outgoing customer invoices, including both paid and unpaid invoices.
Once invoices exist, you can add review flags to represent items that need attention:
Flag any invoices that look like possible duplicates and include the related invoice ID where applicable.
The API stores the flag, its risk level, and the reason it was created so that a person can review the item later.
Ask questions about your data
Once data exists in the system, you can start asking questions using normal language.
For example:
- Do we have any incoming invoices from Nordic Office AB over 50,000?
- How many incoming invoices did we receive for account 5410 this month?
- Which invoices have a high-risk possible duplicate flag?
- Show me overdue outgoing invoices from the last 30 days.
The AI determines which API calls are necessary, retrieves the relevant information, and uses the responses to answer your question.
For example, if you ask:
Do we have any incoming invoices from Nordic Office AB over 50,000?
the AI can retrieve the relevant invoices:
GET /invoices?direction=incoming&counter_party=Nordic%20Office%20AB&min_amount=50000
If you ask for invoices that may have been registered twice, it can retrieve the relevant review flags:
GET /invoice-flags?flag_type=possible_duplicate
For a period total, the AI can use the summary endpoint instead of downloading invoices and performing its own calculation:
GET /invoice-summary?direction=incoming&from_date=2026-08-01&to_date=2026-08-31&account=5410
The exact requests depend on the question being asked. This makes it possible to explore accounting data using more expressive questions than a traditional static report.
Working with larger amounts of data
AI models generally work best when they receive only the information relevant to the question.
For this reason, the example API includes pagination and several filters rather than always returning every invoice.
For example:
GET /invoices?page=1&page_size=10
returns a limited number of invoices, while:
GET /invoices?direction=incoming&status=unpaid
limits the response to unpaid supplier invoices.
Similarly, date and amount filters can keep the response focused:
GET /invoices?from_date=2026-08-01&to_date=2026-08-31&min_amount=50000
This becomes particularly important as the amount of invoice data stored in the account grows. Filtering, pagination, and aggregation should happen in the workflow so that the AI receives the smallest useful result set.
Keep human review in the loop
Invoice flags help surface items that may deserve attention, such as possible duplicates, unusual amounts, unexpected accounts, or VAT anomalies. A flag does not necessarily mean that an invoice is incorrect.
The AI can help identify and explain deviations, but a person should make the final assessment. This keeps the review process traceable: each flag identifies the invoice, the reason for the flag, and its risk level.
Extend the API for your AI
The API in this example is intentionally simple.
When testing it with an AI assistant, you may find questions where the AI needs to retrieve a large number of invoices and process them itself. This is often a good indication that the API could provide a more suitable way of retrieving that information.
Because the API is implemented as a Bosbec workflow, you can modify it just like any other workflow.
For example, you could add:
- Additional query parameters
- Supplier or customer history
- Budget comparisons
- Approval status filters
- Sorting by invoice date or amount
- Summaries by month, supplier, account, or category
- More flag types and risk rules
- Endpoints designed for recurring finance questions
After adding or changing endpoints or parameters, remember to update the API documentation as well. The AI can only make effective use of functionality that is described in the documentation it has been given.
The goal is not necessarily to predict every question in advance. Start with a useful general-purpose API and extend it when you identify situations where a more specialized endpoint or parameter would produce a better result.
Where to go next
This example demonstrates a useful pattern for combining Bosbec Workflows, APIs, structured accounting data, and AI.
The invoice system itself is only an example. The same approach can be applied to other financial data and review processes.
For help creating the underlying integration, see Building Your First API and Getting started: Integrations.
You can:
- Store structured invoice and review data in Bosbec.
- Create workflow endpoints for retrieving, summarizing, and modifying that data.
- Update the API documentation with the HTTP-in channel's Base URL.
- Give the documentation to an AI assistant.
- Ask the AI to retrieve, analyze, and flag invoices through the API.
- Keep human reviewers responsible for final decisions.
- Extend the API when you discover new data-access patterns.
- Update the documentation when the API changes.
This lets Bosbec act as both the data source and integration layer while the AI provides a flexible natural-language interface on top of it.