What Is an API and How It Connects Your Systems
TL;DR
An API (Application Programming Interface) is the set of rules that allows two systems to communicate, acting like a translator between programs. Here we show how APIs provide access to AI models, the difference between access tokens and text tokens, authentication, rate limits, and pricing, with practical examples.
Direct answer: An API (Application Programming Interface) is the set of rules that allows one system to request something from another and receive a response, without needing to know how the other system works on the inside. It is through an API that your website talks to your CRM, an automation calls an AI model, and an AI agent executes tasks.
What Is an API
An API defines what can be requested, in what format, and what comes back as a response. In simple terms, it works like an agreed-upon translator between two programs: both sides follow the same rules, and that is why they understand each other.
In practice, this lets you integrate ready-made capabilities (payments, maps, email delivery, AI models) without building everything from scratch.
How an API Call Works
- Request: the application asks for a specific operation.
- Endpoint: the address (URL) that receives that request. Each endpoint corresponds to a specific function or resource of the API.
- Method: the requested action, such as GET (read data), POST (send data), PUT (update), and DELETE (remove).
- Response: what the server returns, including a status code (success or error) and the requested data.
An everyday example: WordPress has a native REST API. External tools use it to read and publish content on a site, which is why older protocols like XML-RPC are no longer needed in most cases. I explain that security risk in why XML-RPC can be a risk in WordPress (in Portuguese).
API, Webhook, and SSH Key: What Is the Difference
All three show up together in almost any integration, yet they do very different things:
- API: your system requests and the other system executes: reading, creating, updating, or deleting data. The request always passes through the endpoint and only goes as far as the key permissions allow. The caller never touches the other system’s database directly. And many API calls only read data without changing anything. Example: your website checks the status of a payment.
- Webhook: an automated notification. When an event happens, the source system sends a payload (the event data) to a URL you registered, and its job ends there. The receiving system decides what to do next and can trigger an action on its own side. Example: the payment gateway notifies the CRM that a purchase was approved, and the CRM grants the customer access. If the receiver responds with HTTP 200, that only confirms the notification arrived, not that it was processed.
- SSH Key: not an API. It is a key pair (one public, one private) that authenticates a person or system to access a server via the command line without typing a password. It is used for server administration, not for application integration.
In an API, one system asks and the other executes. In a webhook, one system notifies and the other decides what to do with the notification.
APIs and Artificial Intelligence
AI providers expose their models via API. That way, a website, an app, or an automation can use speech recognition, text generation, computer vision, and machine learning without training any model in-house.
If the fundamentals are not clear yet, it is worth starting with what Artificial Intelligence is and what LLMs are.
Security: Authentication and Authorization
Authentication confirms who is making the request. Authorization defines what that system is allowed to do once authenticated. The most common standards are:
- API key: a unique secret key that identifies whoever calls the API.
- OAuth 2.0: a protocol that lets you authorize an application to access your resources without handing over your password.
- JWT (JSON Web Token): a compact format for transmitting cryptographically signed information between parties, widely used in authentication.
Never share your access token. A leaked token allows someone else to use your account: burning through your credits, accessing your data and your clients’ data, and creating serious legal liability. Store keys in environment variables or a password vault, never in public code repositories or screenshots.
An Access Token Is Not a Text Token
The word is the same, but the concepts are completely different. An access token is an API credential. A text token is the unit into which a language model splits text for processing, and it is what most AI providers bill you for. I break down that second type in tokens in language models.
Rate Limits and Cost
APIs typically enforce a limit on requests per time window (per minute or per day). When you exceed that limit, the standard response is HTTP status code 429 (Too Many Requests), and your integration needs to know how to back off, wait, and retry.
In AI APIs, cost usually scales with request volume, the number of tokens processed, and the model selected. That is why, before building an integration, you need to make the math work: real ROI accounts for time, capital, tools, subscriptions, and the people involved, not just the price per API call.
Practical Use Cases
- Customer service: a website form sends the lead straight to the CRM and to the team’s WhatsApp.
- Payments: when a purchase is approved, the payment gateway sends a webhook to the CRM with the amount, transaction ID, and currency. The CRM verifies the notification and grants the customer access without anyone copying data by hand.
- AI automation: a cloud workflow calls a language model to classify or reply to incoming messages. To run that reliably, see VPS for AI automation.
- Local listing management: the Google Business Profile API manages business locations in bulk, but it does not act as website SEO, as I explain in WordPress and Google Business Profile (in Portuguese).
- Knowledge base for agents: before answering, an AI agent queries a vector database such as Supabase via API and retrieves the document chunks closest to the user’s question. Vector databases in Supabase are a topic I will cover in greater depth here soon.
- Switching AI assistants: moving conversation history from one assistant to another tool depends on what each provider allows you to export, either as a file or via API. Data portability across AI assistants will also get its own dedicated guide here.
Where I Use APIs in Practice
In my day-to-day work, APIs and webhooks show up constantly. I have integrated the WordPress REST API as well as payment APIs and webhooks from Stripe, Mercado Pago, and PagSeguro so that an approved sale reaches the right system without anyone copying data manually.
The discipline I carry from one project to the next is always the same: every key stored outside the codebase, scoped to the minimum required permissions, and every webhook verified before trusting the notification. That is what separates an integration that truly works from one that only looks like it works.
APIs and AI Agents
An AI agent only acts in the real world through APIs: that is how it reads a spreadsheet, creates a draft in WordPress, or queries a CRM. For anyone using agents as operational support, three practical safeguards apply:
- give the agent a key scoped only to the permissions it actually needs (read-only instead of read-write whenever possible);
- require human approval before irreversible actions such as publishing, sending, or deleting;
- log every call the agent makes so you can audit and roll back changes.
Final Considerations
An API is the component that connects your website, CRM, payment gateway, automations, and AI. Understanding the basics (endpoint, method, authentication, rate limits, and cost) prevents fragile integrations, leaked keys, and budgets that do not close. It is the kind of foundation I organize in my Applied Technology practice area.
At the top of this page there is a button with the option to download the entire content in Markdown, so you can use it as a reference when working with your AI agent. The download is free, asks for no registration or email address, and puts you on no mailing list. It is 100% public content for anyone to access and download.
Frequently asked questions
What is an API, in one sentence?
It is the set of rules that allows one system to request something from another and receive a response, without needing to know how the other system works internally.
What is the difference between an access token and a text token?
An access token is the credential that authenticates whoever calls the API. A text token is the unit into which a language model splits text for processing, and it is typically the billing unit for AI APIs.
What happens if my API token leaks?
Someone else can use your account: spend your credits, access your data, and act on your behalf. Revoke the key in the provider's dashboard, generate a new one, and replace it across your integrations.
What does a 429 error mean in an API?
It means you exceeded the request limit for that time window. Your integration should wait and retry rather than repeating the call nonstop.
Do AI agents need an API?
Yes. An agent reads and writes data in external systems through APIs. That is why you should grant it only the permissions it needs and keep human approval for irreversible actions.
References
WordPress Developer Resources: REST API Handbook
MDN Web Docs: HTTP request methods
MDN Web Docs: 429 Too Many Requests
IETF RFC 6749: The OAuth 2.0 Authorization Framework
IETF RFC 7519: JSON Web Token (JWT)
IBM Cloud: watsonx.ai API documentation