TutorialFollow along and build something end to end. Start here if Bosbec is new to you.

Build an AI-Queryable Order System API

This guide demonstrates how to set up a simple order system in Bosbec and expose its data through an API.

The example stores customers, products, and orders 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 more expressive questions about your data without having to create a dedicated endpoint for every possible question.

For example:

  • Which customers have not placed an order recently?
  • What products has a specific customer ordered?
  • Show me the latest orders for customer CUST3.
  • Which products are currently low in stock?
  • Create a new customer and place an order for them.

The example is also intended as a starting point. If the AI has difficulty working with a large amount of data, the workflow and API can easily be extended with additional endpoints, filters, or query parameters.


GET STARTED FOR FREE


How it works

The solution consists of three types of data stored in Bosbec:

  • Customers
  • Products
  • Orders

Each type is stored in its own Bosbec group.

The workflow exposes HTTP endpoints that allow an external client to create and retrieve these resources.

The API currently supports:

Method Endpoint Description
GET /products Retrieve products
GET /orders Retrieve orders
GET /customers Retrieve customers
POST /products Create a product
POST /orders Create an order
POST /customers Create a customer

The GET endpoints support pagination and additional filters. For example, orders can be retrieved by either order_id or customer_id, while customers can be filtered based on when their last order was placed.

The API documentation contains the complete list of endpoints, parameters, request bodies, and examples.

DOWNLOAD API DOCS

Create the groups

First, create the groups that will contain the data used by the order system.

Create the following three groups in your Bosbec account:

  1. Customers
  2. Orders
  3. Products

Once they have been created, copy the ID of each group.

Add the group IDs to Account Settings

Go to Settings and open Account Settings.

Under the account settings, add the following keys:

KeyValue
customer_group_idID of the Customers group
order_group_idID of the Orders group
product_group_idID of the Products group

Use the IDs from the groups you created in the previous step.

The workflow reads these settings whenever it needs to access the corresponding data.

Set up the workflow

Open Workflow Builder and navigate to View > Workflow Library.

Under Tutorials, find and import the template named “Bosbec: Orders 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/products
GET  https://example.in.bosbec.io/orders
GET  https://example.in.bosbec.io/customers

POST https://example.in.bosbec.io/products
POST https://example.in.bosbec.io/orders
POST https://example.in.bosbec.io/customers

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.

DOWNLOAD API DOCS

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-order-api.in.bosbec.io

update the documentation to:

Base URL: https://my-order-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
  • HTTP methods
  • Query parameters
  • Pagination
  • Request bodies
  • Expected data types
  • Relationships between customers, products, and orders

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 data.

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 is to ask the AI assistant to create some example data for you.

Because the API documentation contains the POST endpoints for customers, products, and orders, the AI already knows how to create these resources.

For example, you could ask:

Create five example customers with realistic names and addresses.

The assistant can use POST /customers to create the requested customers.

You could then ask:

Create ten example products across a few different product categories.

The assistant can use POST /products to add the products.

Once customers and products exist, you can ask the assistant to create orders between them:

Create some example orders for the customers and products we just created. Use a mixture of order dates, statuses, and payment methods.

The assistant can retrieve the IDs that were created and use them when calling POST /orders.

An order requires both a customer_id and a product_id, so the assistant may need to retrieve existing customers and products before creating the order.

Ask questions about your data

Once data exists in the system, you can start asking questions using normal language.

For example:

  • Show me the five most recent orders.
  • What information do we have about customer CUST1?
  • Which customers have not placed an order since July 1st?
  • What did customer CUST3 order?
  • How much stock is available for PROD5?

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:

Which products has customer CUST3 ordered?

the AI can first retrieve the customer’s orders:

GET /orders?customer_id=CUST3

It can then use the returned product IDs to retrieve information about the relevant products:

GET /products?product_id=PROD2

The exact requests depend on the question being asked. This makes it possible to explore structured data using much more expressive questions than a traditional fixed search interface.

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 filtering options rather than always returning every record.

For example:

GET /orders?page=1&page_size=10

returns a limited number of orders, while:

GET /orders?customer_id=CUST3

limits the response to orders belonging to a particular customer.

Similarly, customers can be filtered based on the date of their last order:

GET /customers?last_order_before=2026-07-01 00:00:00Z

This becomes particularly important as the amount of data stored in the account grows.

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 records 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
  • Date-range filters for orders
  • Product category filters
  • Order status filters
  • Sorting
  • Different page sizes
  • Search by customer email
  • Endpoints that return aggregated information
  • Endpoints designed for a particular recurring question

For example, if the AI regularly needs to retrieve hundreds of orders just to find orders from a certain period, adding parameters such as:

/orders?order_date_after=...
/orders?order_date_before=...

would allow the workflow to perform that filtering before the data is returned to the AI.

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 account data, and AI.

The order system itself is only an example. The same approach can be applied to many other types of data.

You can:

  1. Store structured information in Bosbec.
  2. Create workflow endpoints for retrieving and modifying that information.
  3. Update the API documentation with the HTTP-in channel’s Base URL.
  4. Give the documentation to an AI assistant.
  5. Ask the AI to create, retrieve, and analyze data through the API.
  6. Let the AI combine several API operations to handle more expressive requests.
  7. Extend the API when you discover new data-access patterns.
  8. 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.


GET STARTED FOR FREE