Skip to main content

How APIs work

1. Making a Request​

  • A client (your application) sends a request to an API endpoint.
  • Requests typically include:
    • URL: Specifies the endpoint.
    • HTTP Method: Defines the action (e.g., GET, POST).
    • Headers: Include metadata like authentication tokens.
    • Body: Contains data for POST/PUT requests.

2. Receiving a Response​

  • The API responds with a status code and data.
  • Status Codes:
    • 200: Success
    • 404: Not Found
    • 500: Server Error
  • The response body often includes JSON or XML data.

Request: You send a message to the API with what you need (e.g., check if funds are available in a bank account). This is called an API request.

Response: The API sends back the information or action you requested. This is called an API response.