An API is the connection point that allows two programs to exchange information in an orderly way. The acronym stands for Application Programming Interface. An interface is the place where two things meet. Here, one program makes a request following clear rules, and another responds with the data or the action that was requested.
APIs are used every day without users knowing it. When a shop shows the status of your delivery, when a website lets you log in with your account from another platform or when a weather app shows you the forecast, there is an API in the middle. It is the invisible glue that joins services together and lets the internet work as a whole rather than as separate islands.
An API is the waiter who takes your order to the kitchen and brings back the answer. You do not see how it is prepared, you just ask for what is allowed and receive the result.
What is an API?
The simplest way to understand what an API is comes from the image of a restaurant. You are the customer and the kitchen is a complex system that you neither want nor need to know about. The waiter hands you a menu with what you can order. You choose, he writes it down and takes it to the kitchen. A little later he brings you the dish. If you ask for something that is not on the menu, he tells you it is not possible.
The same thing happens in the world of software. A company has a service, such as maps, payments or deliveries. Instead of letting anyone into its systems, it publishes an API with a list of allowed requests. Other programs can ask for those things, always following the company’s rules. The inside of the service stays protected and only what is necessary is exposed.
Opening up a service through an API has a great practical advantage. Whoever builds a website does not have to invent a mapping or payment system. They connect to one that already exists and works. They save months of work and gain the quality of specialised companies. That is why almost every website or app today is made up, to a large extent, of third-party pieces connected through interfaces.
Endpoints, requests and data formats
An API defines three basic things, and each one takes shape in an endpoint, the exact address to which each type of request is sent. What can be requested, how it has to be requested and what response will be received. For example, a mapping service may accept a request for the coordinates of an address. Whoever uses it must send the address in a specific format, and in return will receive the exact position, also in an agreed format. Requests travel across the internet in the same way as when you visit a website. The difference lies in what comes back. A website returns designed pages for a person to read. An API returns clean data, with no decoration, for another program to use. That program can then display it in its own style, combine it with other data or store it.
Almost every API also requires the caller to identify itself. Services usually give a key to whoever wants to use their API, a kind of password that says who is making the requests. With it they can limit how many requests are allowed, see how the API is used and even charge for it. That is why keys must be guarded as carefully as a banking password.
HTTP methods and status codes
Web APIs use the methods of the HTTP protocol to indicate what is to be done. GET requests data without modifying it, POST creates a new item, PUT and PATCH replace or modify it and DELETE removes it, so the same address, such as that of an order, accepts different actions depending on the method.
The response from an API always carries a three-digit status code. Codes starting with 2 indicate success, such as 200 or 201 for an item created, those starting with 4 signal an error by the caller, such as 401 for missing identification, 403 for permission denied, 404 for a resource that does not exist or 429 for too many requests, and those starting with 5 indicate a server failure.
How an API call works
Every exchange with an API follows a similar cycle. The program that needs something sends a request to the service, stating what it wants and who it is. The service checks that it has permission, looks up or calculates what was requested and returns a response with the result or with an error message. It all happens in a fraction of a second and without the user seeing it. An everyday example is the map on a website. When someone opens the page, it asks a mapping service for the area it should display and receives the image and the data. If the service does not respond or responds late, the map does not appear, even though the rest of the website works. This dependency explains why an outage at one provider can affect thousands of websites at once.

Types of API by access and architecture
Public, partner and third-party APIs
Public APIs are the ones companies offer for other developers to use. Google offers maps, translation and search. Social networks offer posting content and checking statistics. Payment gateways make it possible to take payments without storing card details. They are very convenient, but they create a dependency, because the company can change its terms, its prices or shut down the service.
Most small business websites already depend on several of them. A contact form sends the data to an email service, a map comes from another company and the analytics from yet another. If one of them fails, that part of the website stops working. Knowing your dependencies lets you react quickly when something changes or breaks.
Between public and internal APIs sit partner APIs. A company opens them only to its partners, such as an insurer that gives access to its brokers or a manufacturer that connects its catalogue with its distributors, with specific contracts and keys for each one.
Private APIs, internal APIs and microservices
Companies also use APIs inside their own organisation. The order system talks to the warehouse, the billing system to accounting, and the website to all of them. Each department maintains its own program and they all communicate through agreed interfaces. It is a way of organising large systems into independent pieces that can be improved without breaking the rest. This approach is the foundation of many modern architectures. It allows different teams to work in parallel and lets one piece be replaced without rebuilding everything. But it demands discipline, because every API has to be documented and kept stable. A careless change to an internal interface can break several systems at once, and sometimes it takes days to discover.
REST API, the dominant style on the web
Among the design styles for APIs, the most widespread on the web is called REST. It relies on the same addresses and mechanisms as the browser, and it usually returns data in a lightweight format. Its simplicity and its similarity to the web explain its success. Today, when people talk about an API, they almost always mean one of this kind.
Content management systems such as WordPress, Drupal or Joomla and shop platforms such as PrestaShop, Magento or Shopify include a REST API. It lets other applications read and publish content or orders, and it is the basis of many editors, mobile apps and integrations. But, like any door, it needs protection. A careless configuration can reveal information that should be private, such as the list of users of a website, which is why it is worth reviewing what is exposed.
SOAP, GraphQL, gRPC and WebSocket
REST is not the only design style for an API, and others are better suited to certain uses. SOAP is an older and stricter protocol, based on XML messages with a formal contract, which is still present in banking, insurance and public administration. GraphQL, created at Facebook and released in 2015, lets the client ask for exactly the fields it needs in a single query. gRPC, from Google, prioritises speed between internal services, and WebSocket APIs keep a connection open for chats, stock prices or real-time games.
Operating system, library and database APIs
Not every API travels over the internet, because many work inside a single machine. An operating system offers an API so that programs can open files, draw windows or use the network without talking directly to the hardware. Libraries and frameworks publish their own so that other developers can use their functions, and database management systems offer interfaces to query and store data from any language. The principle is the same as on the web, a stable contract between whoever offers a function and whoever uses it.
Keys, benefits and security of a programming interface
API keys, usage limits and versions
Most APIs require you to identify yourself with an access key, a kind of ID card that lets the provider know who makes each request, apply permissions and charge if applicable. That key must be treated like a password. If it leaks, anyone can use the service at the owner’s expense. Providers also set usage limits, a maximum number of requests per minute or per day, to protect their systems. Exceeding them causes temporary blocks. That is why a sensible design temporarily stores responses that do not change often and does not overuse queries. APIs also evolve. Serious providers publish numbered versions and keep the previous one for a while, but a version change can break integrations that used to work, so it is worth following their announcements. Many organisations place an API gateway in front, which centralises keys, limits, versions and usage logs.
API authentication with OAuth and tokens
An API key identifies an application, but not the person using it. When an API has to act on behalf of a user, such as posting to their social network or reading their calendar, OAuth 2.0 is used, the standard by which the user authorises the application without handing over their password and the application receives an access token with limited permissions and an expiry date.
Many of those tokens follow the JWT format, a signed text that contains who the user is, what they can do and until when, and that the server verifies without querying a database. If a token is stolen, it can be used until it expires, which is why it is best to keep their lifetime short.

Documentation with OpenAPI
An API without clear documentation is almost unusable for other developers. The OpenAPI specification, the successor of the Swagger project, describes in a single file every address, its parameters, its responses and its error codes, and from it you can generate interactive documentation pages, clients in several languages and automated tests.
Benefits of integrating services through interfaces
The great advantage of integrating an API into a project is not having to reinvent the wheel. A shop does not need to build its own payment or shipping system, and a website can show the weather, a map or a calendar without creating anything from scratch. You take advantage of the work of specialists and get a level of quality that would be out of reach for a small business. APIs also make it easy to connect a business’s tools automatically. The data from a form can flow into the customer management system, from there to email and from there to accounting, automatically. That integration saves errors and hours of manual work. The price is dependency, which is why it pays to choose solid providers and have a plan for when they fail. In a custom WordPress development project, decisions like these are made from the very beginning.
Security risks of a poorly protected API
An API is a way in, and as such it needs a lock. Access keys must never appear in visible places, such as public code or an open repository. There have been repeated episodes of companies that published their keys by mistake and received bills for thousands of euros in fraudulent usage before they noticed. Rotating them immediately is the first thing to do if they leak.
The most serious flaw usually lies in authorisation. The OWASP project ranks at the top of its API risks the case where a user can request another user’s data just by changing a number in the request, because the API checks who is calling but not whether that object belongs to them.
You also need to limit what each key can do. If a program only needs to read data, it should not be able to delete it. It is the same principle of least privilege that applies to user accounts. It is also worth monitoring usage volume. A sudden spike in requests may point to a programming error or to abuse, and catching it early saves money and trouble.
Risks of relying on an external service
Measuring how much a website depends on external APIs
The practical way to measure dependence on external APIs is to take an inventory of every external service the website uses, from email to maps, payments and analytics. For each one, note who provides it, how much it costs, what happens if it stops working and whether there is an alternative. It is a simple exercise that usually reveals more dependencies than anyone remembered.
Then you need to separate the essential parts from the secondary ones. If the payment system fails, you lose sales. If the map fails, you lose convenience, but the website keeps working. Critical pieces deserve more attention, with ready alternatives, clear contracts and failure alerts. Secondary ones can be handled more calmly, accepting that, if they change, you will have to react without panic.
Finally, it is wise to keep an eye on the terms of use of each external API. Companies announce price or behaviour changes in advance, usually by email or on their release notes pages. Subscribing to those notices, and making someone responsible for reading them, saves you from surprises. Many of the cases of websites broken by an API change would have been avoided with a single email read in time.
Changes in terms and data leaks in third-party APIs
In 2018, Google changed the terms of its mapping platform. It merged dozens of services into three large products, replaced free usage with a monthly credit of 200 dollars and required a credit card from every user. Many developers reported that their costs multiplied by ten, by a hundred or more. Some websites stopped showing maps overnight.
The figures varied widely from case to case and Google did not publish direct comparisons, but the reaction was huge. Small businesses, town councils and associations that used a contact map found themselves facing unexpected bills. Many migrated to alternatives such as Mapbox or OpenStreetMap. The lesson was clear. Depending on someone else’s API means accepting that the rules can change at any moment.
Another well-known case was Facebook in 2018. For years, its API allowed apps to access the data of the friends of whoever installed them. A personality quiz app collected information on millions of people this way, which ended up in the hands of the consultancy Cambridge Analytica. Facebook acknowledged that it affected up to 87 million users, and afterwards drastically restricted access.
The episode showed the other side of the problem. An API that is too open can turn into a large-scale data leak. Regulators in several countries opened investigations, and the company had to make formal commitments, such as the one it signed with Australia’s privacy regulator. Today, the large platforms require app reviews and expire the permissions of apps that are not used.
History and evolution of the API
The idea of a programming interface predates the internet. The term application program interface already appears in a 1968 paper by Ira Cotton and Frank Greatorex on computer graphics, presented at a conference of the American Federation of Information Processing Societies. In those years an API was mainly the set of functions that a library or a system made available to other programs on the same machine.
The leap to the web came in 2000. That year Salesforce and eBay opened interfaces so that other companies could connect to their services, and Roy Fielding presented the doctoral thesis at the University of California, Irvine that described the REST style. Amazon followed in 2002 with its first web services, and social networks completed the expansion in the middle of the decade. Today almost every digital service is built as a set of APIs that talk to each other.