A set of rules that allows different software applications to communicate with each other.
An API (Application Programming Interface) is a set of rules and protocols that allows different software applications to communicate with each other. Think of it as a contract between two programs - one requests data or functionality, and the other responds according to predefined rules.
When you use a mobile app to check the weather, book a ride, or make a payment, APIs are working behind the scenes. The app sends a request to a server, the server processes it, and sends back the response - all through an API.
For example, when you log into a website using your Google account, that website uses Google's API to verify your identity without ever seeing your password.
APIs enable modern software development by allowing applications to leverage existing functionality without rebuilding everything from scratch. A payment processing company like Stripe provides APIs so thousands of businesses can accept payments without building their own payment infrastructure.
Key benefits:
REST APIs are the most common, using standard HTTP methods (GET, POST, PUT, DELETE) and are simple to understand and implement.
GraphQL APIs allow clients to request exactly the data they need, reducing over-fetching and improving performance.
WebSocket APIs enable real-time, bidirectional communication for applications like chat systems and live updates.
Consider how Swiggy or Zomato works: The mobile app uses APIs to communicate with restaurant databases, payment gateways, delivery tracking systems, and user authentication services. Each of these is a separate system communicating through well-defined APIs.