Glossary Background Image

No Bad Questions About API

Definition of API calls

What are API calls?

API calls are requests made by a client to a server using an application programming interface (API). They allow one software system to request data or services from another. API calls are essential for integrating different applications to enable features like retrieving data, submitting information, or triggering actions.

How do API calls work?

API calls work by sending a request from a client to a server and then receiving a response from the server. The request typically includes an endpoint (URL), an HTTP method (such as GET, POST, PUT, DELETE), headers (which may include authorization tokens), and sometimes a payload (data being sent to the server). The server processes the request, performs the necessary actions, and sends back a response, usually in a format like JSON or XML. This response contains the requested data or confirmation that the action was completed successfully. To ordinary users, these actions are undetectable.

Examples of API calls

When a user searches for airline tickets on a travel website, API calls are sent from the client (the website) to API endpoints at the servers of airline companies and tourist agencies. These return information on ticket availability and prices. Another example is a weather app that sends API calls to servers of weathering monitoring agencies and stations to collect information and return weather data to the user.

How can API calls be used in attacks?

Threat actors can use API calls to attack APIs through Denial-of-service (DoS) and distributed denial-of-service (DDoS) attacks, sending several API calls at a time to a server to slow down or even stop its operations. Another means by which threat actors exploit API calls is through vulnerabilities that allow them to trick an API into revealing sensitive data and open unauthorized access.

How to protect API calls?

Protecting API calls involves implementing several security measures to ensure that data and functionality are not compromised. Authentication and authorization ensure that only legitimate users can access the API, often using tokens or API keys. Encryption (using HTTPS) secures the data transmitted between the client and server. Rate limiting and throttling prevent abuse by restricting the number of requests a client can make in a given time frame. Additionally, input validation and sanitization protect against common attacks like SQL injection and cross-site scripting (XSS). Finally, logging and monitoring API activity can help detect and respond to suspicious behavior promptly.

More terms related to API