# API

> Application Programming Interface allowing two applications to communicate with each other.

- **Category**: Technical
- **URL**: https://www.romaindelfosse.fr/en/glossary/api/

---

**API** (Application Programming Interface) is a software interface that allows two applications to communicate with each other in a standardized way.

## How does it work?

An API defines:

- Possible **requests** (GET, POST, PUT, DELETE...)
- **Data formats** exchanged (JSON, XML...)
- **Authentication rules**

## Types of APIs

### REST API

REST APIs (Representational State Transfer) are the most common standard. They use the HTTP protocol and typically return data in JSON format.

### GraphQL API

GraphQL allows clients to specify exactly the data they need, avoiding over-fetching.

### WebSocket API

For real-time bidirectional communications.

## Usage examples

- **E-commerce**: payment integration (Stripe, PayPal)
- **Mapping**: displaying maps (Google Maps, Mapbox)
- **Social**: authentication via social networks

## Best practices

1. Clearly document endpoints
2. Version the API
3. Handle errors explicitly
4. Implement rate limiting



