Module 09Lesson 1

Lesson 1. What Is an API and Why Your Agent Needs It

Hands-on: Zapier

Lesson 1. What Is an API and Why Your Agent Needs It#

Goal: understand what an API is and how it helps your agent communicate with other services.

What Is an API in Plain Terms#

API (Application Programming Interface) is an "interface for programs"—a way for one program to talk to another.

For non-technical users, an API is like:

  • a restaurant menu for programs: you don't go into the kitchen, you just pick a dish from the menu → the chef cooks → the waiter brings it
  • a power outlet for programs: you don't mess with the electrical grid, you just plug in → you get power

An API lets your agent:

  • read data from another service (e.g., get a list of clients from a CRM)
  • write data to another service (e.g., create an order in a store)
  • perform actions (e.g., send an email, create a calendar event)

How It Works#

Example: an agent sends an email via the Gmail API.

  1. The agent builds a request: "Send an email to ivan@example.com with subject 'Hello' and body 'How are you?'"
  2. The request is sent to the Gmail API (over the internet)
  3. Gmail API checks authorization (whether the agent has permission to send email on your behalf)
  4. Gmail API performs the action (sends the email)
  5. Gmail API returns a response: "Email sent successfully" (or an error if something went wrong)

Flow:

Agent → Request (JSON) → Gmail API → Gmail sends email → Response (JSON) → Agent

Why Your Agent Needs an API#

Without an API, the agent would be isolated—it could only talk to the user.

With an API, the agent can:

  • read data from CRM, Google Sheets, knowledge bases
  • send notifications to Telegram, email, SMS
  • create tasks in Notion, Trello, Asana
  • accept payments via Stripe, YooKassa
  • make calls via Twilio
  • generate content via OpenAI, Midjourney

APIs turn your agent into a full automation tool.

Types of APIs#

1. REST API (most common)

  • works over HTTP (like a regular website)
  • requests and responses in JSON format
  • uses methods: GET (read), POST (create), PUT (update), DELETE (delete)

2. GraphQL API

  • more flexible than REST
  • you can request only the fields you need
  • used in modern services (Shopify, GitHub)

3. Webhook (callback)

  • the service sends data to your agent when an event happens
  • example: new order → store sends data to agent → agent processes the order

For most tasks, REST API is enough.

ServiceAPI for whatDocumentation
Google SheetsRead / write data in spreadsheetsdevelopers.google.com/sheets/api
GmailSend / read emaildevelopers.google.com/gmail/api
TelegramSend messages to botscore.telegram.org/bots/api
StripeAccept paymentsstripe.com/docs/api
OpenAIGenerate text (ChatGPT)platform.openai.com/docs/api-reference
TwilioSend SMS, make callstwilio.com/docs/usage/api
NotionRead / write data in the databasedevelopers.notion.com