GPT Actions: Connecting to External Services
Learn to connect your GPT to external APIs using Actions. Understand OpenAPI schemas, authentication, and practical integration patterns.
Premium Course Content
This lesson is part of a premium course. Upgrade to Pro to unlock all premium courses and content.
- Access all premium courses
- 1000+ AI skill templates included
- New content added weekly
Everything you’ve built so far — instructions, knowledge files, capabilities — works within ChatGPT’s world. Actions break that boundary. They let your GPT reach out to the internet, call APIs, and interact with external services in real time.
This is how you build GPTs that check live inventory, look up customer records, create calendar events, or send notifications.
🔄 Quick Recall: In the previous lesson, you configured capabilities and conversation flows. Actions go further — instead of using built-in tools, you connect your GPT to any external service with an API.
What Are GPT Actions?
Actions convert natural language into API calls. Here’s the flow:
- User says: “What’s the current stock price of Apple?”
- GPT translates: Calls a stock price API with the parameter “AAPL”
- API responds: Returns
{"price": 198.50, "change": "+1.2%"} - GPT presents: “Apple (AAPL) is currently trading at $198.50, up 1.2% today.”
The user never sees the API call. They just have a natural conversation, and the GPT handles the technical work behind the scenes.
The OpenAPI Specification
Actions are defined using the OpenAPI specification (formerly called Swagger). It’s a standard format that describes an API’s endpoints, parameters, and responses.
Here’s a simplified example for a weather API:
openapi: 3.1.0
info:
title: Weather API
version: 1.0.0
servers:
- url: https://api.weather.example.com
paths:
/current:
get:
summary: Get current weather for a city
operationId: getCurrentWeather
parameters:
- name: city
in: query
required: true
schema:
type: string
description: The city name
responses:
'200':
description: Weather data returned
Don’t worry about writing this from scratch — you can ask ChatGPT itself to generate an OpenAPI schema for any API you describe.
✅ Quick Check: What is an OpenAPI specification? (Answer: A standard format in JSON or YAML that describes an API’s endpoints, parameters, request formats, and response structures — used by GPT Actions to know how to call external services.)
Setting Up an Action
In the GPT Builder, go to Configure → scroll to Actions → click Create new action.
Step 1: Define the schema
Paste your OpenAPI specification. If you don’t have one, describe the API to ChatGPT:
“Generate an OpenAPI 3.1 specification for a weather API. The endpoint is GET https://api.weather.example.com/current with a required query parameter ‘city’ that returns temperature, condition, and humidity.”
Step 2: Configure authentication
Choose from:
- None — For public APIs with no authentication
- API Key — You provide a key that’s sent with every request
- OAuth — For services where each user authenticates individually
Step 3: Add instructions
Tell your GPT when and how to use the action:
When the user asks about weather:
→ Use the getCurrentWeather action with the city name
→ Present the results as: "In [city], it's currently
[temperature]°F and [condition]. Humidity is [humidity]%."
Authentication Deep Dive
| Method | Use Case | How It Works |
|---|---|---|
| None | Public APIs (no key needed) | Direct calls, no credentials |
| API Key | Shared access to a service | You store the key; it’s sent in headers or query params |
| OAuth | Per-user access | Each user authenticates with their own account |
API Key is the most common choice. You get a key from the API provider, paste it into the GPT builder, and every request includes it automatically.
OAuth is for advanced cases where each user needs their own credentials — like accessing their personal Google Calendar or Slack workspace.
✅ Quick Check: When should you use OAuth instead of an API Key for your GPT Action? (Answer: When each user needs to authenticate with their own account — like accessing their personal email, calendar, or workspace — rather than sharing a single API key.)
Practical Action Ideas
| GPT Type | Action | What It Does |
|---|---|---|
| Sales assistant | CRM API | Look up customer records, update deal status |
| Support bot | Ticketing API | Create and check support ticket status |
| Research assistant | Search API | Fetch current news or academic papers |
| Productivity tool | Calendar API | Check availability, create events |
| E-commerce bot | Inventory API | Check stock levels, get pricing |
When Actions Aren’t the Right Choice
Actions have limitations:
- Latency: API calls take time — responses are slower than knowledge-file lookups
- Reliability: External APIs can go down, rate-limit, or change
- Complexity: Debugging API issues requires some technical knowledge
- Privacy: Data flows through OpenAI’s servers to the API
For static information that doesn’t change often, knowledge files are simpler and more reliable. Use Actions when you specifically need live, real-time data.
Practice Exercise
Even without a custom API, you can practice Actions:
- Open your GPT in Configure → Actions → Create new action
- Ask ChatGPT: “Generate an OpenAPI specification for a public joke API at https://official-joke-api.appspot.com/random_joke"
- Paste the generated schema into the Action editor
- Set authentication to None
- Add instructions: “When the user asks for a joke, use the joke action”
- Test in the Preview panel
This gives you hands-on experience with the Action setup flow using a simple, free API.
Key Takeaways
- Actions convert natural language into API calls, letting GPTs interact with external services
- They use the OpenAPI specification format — ask ChatGPT to generate schemas for you
- Three authentication options: None, API Key, and OAuth
- Use Actions for live data; use knowledge files for static reference material
- Always add instructions telling the GPT when and how to use each action
Up Next
In the next lesson, you’ll learn the systematic approach to testing and debugging your GPT — turning a rough prototype into a polished, reliable tool.
Knowledge Check
Complete the quiz above first
Lesson completed!