Adding AI to Existing Software: Data, APIs and the First Feature
TL;DR
APIs connect a model to existing software, but your application must still own permissions and validation. Follow a read-only customer-portal example, inspect a response contract and plan the failure states before adding write actions.
Updated . Expanded API and content-API guidance, a read-only integration example, a response contract and failure-handling checks.
You do not need to replace a working application to add an AI feature. You need a useful task, access to the right data and a clear boundary between what the model proposes and what your software is allowed to do.
APIs provide much of the plumbing. They let an existing product retrieve information, request a model output and pass a validated result back into the interface. But an API connection alone does not make an AI feature accurate, secure or worth using.
This guide explains the role of APIs in AI integration, then follows a fictional customer-portal feature from request to response. The architecture is an illustrative design, not a claim about a deployed Pixelfield client system.

What is an API in AI integration?
An application programming interface defines how one piece of software requests information or an action from another. In an AI feature, several APIs may be involved, each with a different responsibility.
The model provider's API accepts an input and returns a prediction or generated output. Your existing application's API exposes business records or operations. An integration layer connects them while enforcing the rules of your product.
For example, an account manager might ask for a summary of open customer issues. The application first decides which customer records that person is allowed to see. It retrieves those records, sends an appropriate subset to the model and checks the returned summary before displaying it. The model does not need unrestricted access to the entire CRM.
| Interface | Typical responsibility | Boundary to retain |
|---|---|---|
| Existing product API | Retrieve orders, tickets or account records | The user's permissions and tenant boundaries |
| Content API | Supply approved help articles or product documentation | Version, publication status and audience restrictions |
| Model API | Summarise, classify or generate a proposed answer | Treat the response as untrusted output |
| Integration API | Coordinate retrieval, validation and workflow state | Enforce product rules outside the model |
| Action API | Create or modify a business record | Authorisation, confirmation and retry controls |
These roles can live in a small backend service or within an existing application. They do not require five separate products. What matters is that responsibilities remain explicit.
How content APIs support AI features
A content API gives software a way to retrieve material from a CMS, knowledge base or other managed source. For an AI assistant, this can be more useful than relying on what a model may have learned during training.
Suppose your returns policy changed last week. An assistant should retrieve the currently published policy for the right market and customer group. It should not merge an old internal draft with today's public guidance and present the combination as official policy.
Keep identifiers and timestamps alongside retrieved passages so the application can show sources and detect stale material. Filter access before passing content to the model. Asking the model not to reveal an unauthorised document is weaker than never retrieving that document for the user.
Retrieval also has limits. Finding a relevant-looking passage does not prove it answers the question. If the supplied material does not support an answer, the product needs an honest fallback: show the relevant documents, ask for clarification or route the question to a person.
Choose a first feature with a bounded job
Start with a task whose output a user can judge. Summarising selected support tickets, suggesting document categories or extracting fields for review are easier to scope than “an assistant that runs the business”.
For the worked example, take a B2B customer portal. An account manager opens a customer record and clicks Summarise open issues. The feature returns a short summary with links to the tickets used. It cannot close tickets, send messages or change the account.
The success criterion is concrete: the summary faithfully represents the permitted open tickets and points back to the evidence. A polished paragraph that omits the highest-priority issue is a failure, even if it reads well.
This is different from building a general chatbot. The context is selected by the application, the task is narrow and the user can inspect the underlying records. Broader AI workflow examples can help identify a suitable starting task, but the first release should have one clear finish line.
Follow the request through the existing application
Here is a proposed flow for that portal feature:
- Authenticate the user. Use the application's existing identity system rather than a separate identity invented for the AI feature.
- Authorise the account access. Check that the user may read this customer's tickets. Do not trust a customer identifier supplied by the interface on its own.
- Retrieve permitted records. Apply tenant and record-level restrictions in the data access layer, then select only the fields needed for the summary.
- Prepare the model input. Separate instructions from ticket content, minimise unnecessary personal data and retain source identifiers.
- Request structured output. Ask for a summary and the source identifiers supporting each point.
- Validate the response. Check its structure, allowed identifiers, missing fields and presentation safety. Flag unsupported or inconsistent statements for review.
- Display the result with sources. Show when the source records were retrieved and make clear that the original tickets remain authoritative.
The backend owns these steps. The model must not be able to widen access by returning a different account ID or a request to fetch unrelated records.
For long-running jobs, the interface can show a pending state and allow the user to leave the screen. That design is often less frustrating than a spinner that eventually loses the result when the page is closed.
Specify a small response contract
Define what the application expects before polishing the prompt. For the fictional portal, a response might contain:
{
"status": "ready_for_review",
"summary": "Two open tickets concern delayed deliveries.",
"source_ticket_ids": ["T-184", "T-191"],
"source_snapshot": "snapshot-42"
}
These are illustrative values. The application should check that both ticket IDs were in the authorised input and that snapshot-42 matches the job being processed. A provider's structured-output feature may help with JSON shape; it does not prove the sentence is factually supported.
If the two tickets actually concern unrelated issues, the response is still wrong despite being valid JSON. Test content accuracy separately from schema validation and retain a user-visible route to the underlying evidence.
Download the AI integration contract checklist. It covers input ownership, permissions, source versions, failure behaviour and the evidence needed to accept the feature. Use it with whoever owns the existing product, not only the person connecting the model API.
Plan for failures before adding more features
A useful integration has explicit states for more than success. Define what the user sees and what the system does when each dependency fails.
| Situation | Expected product behaviour |
|---|---|
| No permitted tickets exist | Say there are no available records to summarise; do not invent activity |
| Retrieval fails | Keep the existing portal usable; show a retryable retrieval error |
| The model request times out | Record the job state and offer a controlled retry; do not display a partial result as complete |
| Output contains an unknown ticket ID | Reject or flag the response; do not create a link to an unauthorised record |
| Tickets change while the job runs | Show the snapshot time and require refresh where freshness is material |
| The user loses account access | Recheck access before returning or displaying a stored result |
A read-only feature reduces some risks, but it can still expose confidential information or mislead a user. Permissions must apply to stored summaries and cached results as well as the original query.
If you later add write actions, treat that as a new capability. Decide how approval works, how duplicate requests are detected and how an uncertain result is reconciled. Stripe's documented idempotent requests are an example of an API offering retry semantics; they are not evidence that every CRM or helpdesk endpoint behaves the same way.
Keep security checks outside the prompt
For a document-search feature, the worked RAG example and test pack shows how to check current sources, two access roles and what happens after permission is removed.
Before connecting business information, trace the AI data route through prompts, logs, retrieval stores and deletion arrangements.
Ticket descriptions, uploaded documents and retrieved web content are data supplied by other people. They may contain instructions that the model should not act on. Do not give a summarisation feature tools for sending emails or changing records just because those tools are available elsewhere in the application.
Validate and safely render model output before displaying it or passing it downstream. OWASP's improper output handling guidance describes the risks of treating generated output as trusted input to other systems. A response should not become executable HTML, a database command or a shell instruction simply because it came from a model API.
Use server-side secret storage, bounded access and an agreed retention policy. Record enough operational information to investigate failures—job ID, source version, model configuration and validation outcome—without defaulting to permanent copies of every raw request and response.
Review the provider's data-handling terms and deployment options against the actual information being processed. Choosing an API, or hosting one component yourself, is not by itself a compliance guarantee.
Integrate a model or build something custom?
This is not a binary choice between a generic subscription and training your own model. Many products use a hosted model behind a custom integration layer because their permissions, interface and business workflow are specific.
A custom API may simply expose a controlled operation such as “summarise the tickets this user can read”. It does not imply that you need a custom-trained language model. Equally, an off-the-shelf connector may be sufficient when the data access and review steps already match your needs.
Compare approaches using representative inputs. Check factual accuracy, response time, failure handling, operating cost and the effort needed to maintain the integration. Use the same acceptance set when changing the model or prompt so a seemingly better answer does not hide a regression elsewhere.
Keep a version record for prompts, retrieval rules and model settings. A stable API endpoint does not guarantee identical generated output over time, and changing a retrieval filter can matter as much as changing the model.
What to prepare before development starts
You do not need a complete technical specification for an initial discussion. You do need a few concrete answers: which user is doing the task, which records they may access, what a useful output looks like and what must happen when the system cannot produce it.
Bring an anonymised example input and an expected output, the owner of each source system, any available API documentation and the failure cases that would make the feature unacceptable. Mark synthetic examples as synthetic rather than presenting them as customer evidence.
For the portal example, the first milestone is a read-only summary that survives the acceptance checks above. Expanding into automated actions comes after that boundary works reliably.
Pixelfield's AI integration service focuses on connecting AI capabilities to existing software. The useful starting question is not which model to buy. It is which part of your product would become measurably easier to use if the right data and a carefully bounded AI step were connected.
7 Comments