How to Turn Your Business Into an API with AI (Before a Competitor Does)
A plain walkthrough of turning one business process into a secure API with AI assistants, using a small print shop as the example, plus the mistakes to avoid.
You already have an API!
Any time a customer emails, or a partner inquires or someone calls to check on an order, you are providing an API manually. However, when Dave goes on holiday, this can be very difficult to manage. To turn your business into an API using AI, you do not need to create new teams, products or spend large amounts of money. All you need is a clear mind and some free time.
Creating a Drive Through
So far, your business may be similar to a restaurant. A customer can enter and talk to a member of staff to gain information about special offers and make alterations to their order. This is similar to having a sales and support team. These however do have limitations on hours and staff members.
By adding a drive through window, this becomes much more efficient. Orders can be made at any time of day, by anyone. The menu, ordering process and payment method is all fixed. Similarly, an API for your business means that any of the actions your business can do (quoting prices, checking stock levels, making bookings and tracking orders) can be requested in a simple, predictable way, by software. You are not giving away access to ‘the kitchen’, but are choosing exactly what should come through the drive through.
Why Software is becoming an Ideal Customer
There are two reasons why this is an important consideration for your business now.
Cost
Previously, creating a new feature or system would be expensive, requiring many hours of meetings, planning and coding. With AI assistants, however, we can understand messy processes, create a written contract and have a basic prototype in no time! The difficult part of this process is no longer the coding, but the problem solving. As a business owner you are in a great position to solve problems in this step.
Who is buying
AI agents are beginning to compare options, book services and even make purchases on behalf of people. New standards are being developed to allow AI agents to easily find and implement tools, such as Model Context Protocol. If you have a well documented API, an AI agent will easily be able to use your service. If you only have a contact form however, essentially the service will be invisible to an AI agent. In the future, you may receive 10,000 polite requests per hour from a customer who never sleeps. You will definitely have a new customer coming soon! The only question to ask is whether your door has a handle.
How to turn your business into an API with AI
We will use an example business to walk through this process. Let’s look at Maya’s print shop. Although Maya is not a developer, she has a part time freelancer, a self made spreadsheet for pricing, and many people asking how much 500 flyers will cost in her inbox.
Find frequently asked questions
Maya begins by asking her team what people in the inbox often ask. They quickly notice that people are asking for prices, delivery dates and “where’s my order?” Maya asks an AI assistant to find patterns in the requests. Maya takes a months worth of emails from customers, and removes personal information, before asking an AI assistant to group the requests. For each group, Maya wants to know what the customer is providing, what information Maya’s business is returning, what people are involved, and how many times this occurs.
She is left with two main request types.
Note: Never input customer data directly into AI tools. Remove all personal information. Check with the policies of your company, and any applicable privacy policies. (Check that these apply correctly to your industry and location before sharing customer data with any AI tools.)
Only open the smallest relevant window
Maya is tempted to expose the entire API. However, to start with it is better to create a window for a simple, clear process, that would cause little harm if errors occurred. Maya’s best option for this is pricing quotes. Refunds would not be a good option (although may be in the future!). Think of this as just creating one drive through, rather than an entire food court. More windows can be added easily once this one is running well.
Define the menu
Before coding, Maya needs to define the contract of what her service can take in, and what it can return. This is commonly given in OpenAPI format. Her customers know what they can order, the information required and what they receive.
This is a very important step. This document will be the basis for testing, documentation and coding by the AI. Maya asks for a simple definition. The customer will provide a product name, quantity and if the order is urgent. Maya will return a quote ID, price and expected delivery date. If an error occurs (incorrect input, missing key) Maya will return a clear error message. Maya carefully checks each line. Note that models may suggest extra features, so Maya removes any features she does not need. As all fields will be published, Maya must ensure she can deliver on all fields.
Allow AI to cook
Maya asks her freelancer to ask the AI assistant to create the service. The business rules are given in simple English. All inputs must be checked, products not sold by the business must be rejected, rush orders must cost more, prices must not be given by the customer, and all requests must include a key. Pricing rules are separated so that they can be easily changed and tested. Popular choices for this would be FastAPI for Python, or Express for NodeJS. Since many lines of code have been written with these tools by AI assistants, they are good choices.
Taste the food
As the head chef, the Freelancer checks the service to make sure everything is correct. They check that the prices are correctly calculated, unusual inputs are handled appropriately and that keys are required for all routes. Note that often, AI assistants will create a dummy key to make development run smoothly. Real keys should be stored in a secure key storage. Each key must be individual and revokable without affecting others. (Have an engineer test the service before it is launched, as there may be subtle issues in the logic written by AI).
Secure the window
If done correctly, Maya has created a great service. If done incorrectly, however, she may have created a problem. Everyone has individual keys so she knows who is accessing Maya’s service. If one person is misbehaving, they can be blocked without affecting others. An API Gateway is added so that limits can be placed on how many requests users can make. This means that if a script goes wrong, Maya’s system and bill will not be overwhelmed. The price calculations and permissions are done on Maya’s server. No trust is given to values provided in the request. All calls are logged, with sensitive data removed. If errors occur, they are clear, but do not give information on inner workings.
Maya opens a new AI chat and asks the AI assistant to perform penetration testing as an attacker. Starting in a new context ensures that, as the same AI made the code, it will not be biased. In less than an hour, the reviewer finds two vulnerabilities, as intended.
Testing as an outsider
Maya makes a normal request. Ordering 500 flyers as a rush order. As expected, she receives a quote ID, total price and estimated delivery time. To test for errors, Maya asks the AI to create tests for out of the ordinary inputs. Testing 0 items, negative numbers, missing keys, unknown products and very large orders. These are very likely to be encountered by real users (or bots) in the first week.
Easy to find for people and agents
Maya creates documentation based on the contract, so it will be updated automatically. For each request she includes an actual example. If Maya wants AI agents to use her service, she can consider exposing it via a standard agent friendly tool. A week later, an event planner in the local area uses booking software to request a quote at 2am. No-one in the print shop wakes up, but the sale is still made.
Common Mistakes in Business APIs
Too much too soon
Starting with a simple API that you can maintain is better than trying to do too much and ending up with nothing. Start with one feature and build from there.
No contract
If coding happens first and documentation is written afterwards, the code and documentation can get out of sync and cause confusion for customers.
Trusting client input
If prices come from client input, eventually someone will send in a price of 0.
No versioning
If customers begin to build systems on top of your API, you could cause them issues if you change things without informing them. Include a version in your web address from the beginning. Equally importantly, decide who will be alerted at 3am if issues occur. It cannot be no-one. Lastly, never deliver code you cannot explain. If no-one in your team can explain what a line does, no-one can justify it.
Note: Although AI is used, decisions must still be made carefully. Although code can be quickly created, you must decide what to expose, what price to charge, and for whom. This is a business decision.
Final thoughts
Businesses that will succeed in the next decade may not necessarily be the largest, but the easiest to work with (including non-human customers). As AI means it is cheap to create a window, it is up to you to decide what to put through, and to ensure that it is secure from others.
Written by The Olum Team. Olum (olum.ai) is an AI visibility platform for small businesses and agencies.