Connect Your GPT to External APIs
On this page
Status as of November 5, 2026: GPTs are in their final weeks. OpenAI is retiring custom GPTs on December 11, 2026 (February 11, 2027, for certain Enterprise workspaces with an exemption). Personal, Free, Go, Plus, and Pro accounts can no longer create or publish new GPTs; in Business, Enterprise, and Edu workspaces, creation depends on settings, and it ceased on October 26, 2026, in affected Enterprise workspaces. Existing GPTs remain usable and editable if your plan allows until retirement; your conversations with them will remain accessible afterward. The migration (Migrate to plugin, in My GPTs) converts instructions into a skill, the knowledge base into reference files, and connected apps into apps; custom actions are not transferred. This lesson explains how GPTs work to help you maintain them, migrate them, and adapt their principles to a plugin (Lessons 15–17).
Moving Beyond the Standalone GPT
So far, your GPT has operated in a silo: its instructions define its behavior, and its Knowledge provides your documents. That’s powerful, but it remains cut off from the live world. It can’t check your CRM in real time, create a calendar event, or query your database—it only knows what you uploaded, frozen at the time of upload. Actions remove this limit: they let your GPT call external APIs to read and write data in your tools during a conversation.
What Is an Action?
An Action is a connection between your GPT and an external service via its API. The flow is always the same: the user asks a question or gives an instruction, the GPT identifies that it needs external data to answer, it calls the service’s API, then receives the response and integrates it into its final reply. Consider a sales GPT connected to a CRM: when a user asks, “What’s the status of the Dupont file?”, the GPT queries the CRM API, retrieves the client record, and answers with today’s data—not a memory of a file uploaded three months ago. All of this happens transparently to the user, who simply feels like they’re talking to a well-informed assistant.
The OpenAPI Schema
For the GPT to call an API, you must describe it. That’s the role of the OpenAPI schema (formerly Swagger), a JSON or YAML file that serves as the API’s instruction manual. It describes the endpoints—the URLs your GPT can call—the associated methods (GET to read, POST to create, PUT to update, DELETE to delete), the parameters expected by each endpoint, and the format of the responses returned. Based on this document, the GPT decides on its own, during the conversation, which endpoint to call and with which parameters.
Here’s what a minimal schema looks like for a fictional weather API:
openapi: 3.1.0
info:
title: Weather API
version: 1.0.0
servers:
- url: https://example.com
paths:
/forecast:
get:
operationId: getForecast
summary: Get weather forecast for a city
parameters:
- name: city
in: query
required: true
schema:
type: string
responses:
"200":
description: Weather forecast
Good news: you’ll almost never have to write this file from scratch. Many services publish their OpenAPI schema directly in their API documentation. If not, tools like Swagger Editor—or ChatGPT itself, if you describe the API to it—can generate it. And if your technical team works with Postman, its collections export to OpenAPI format.
Configuring an Action in the GPT Editor
Setup happens in your GPT editor on the web: go to the Actions section, click Create new action, paste your OpenAPI schema into the provided field, configure authentication (covered in the next lesson), then test the action from the preview panel.
Your schema’s quality determines the quality of the calls. Keep three habits in mind. First, give explicit names to operationId values: the GPT relies on these to decide which action to call, and getForecast guides it far better than op_42. Next, write clear descriptions for each endpoint and parameter—in natural language, as if explaining the API to a colleague. Finally, expose only the endpoints you actually need: if your GPT only needs two or three routes, don’t expose all forty routes of the full API. Every exposed endpoint takes up space in the GPT’s context and increases the risk it picks the wrong one.
Your Turn: A Public API
Your first action, or its plan. The best training ground is a free, public API—weather, exchange rates, news—that doesn’t require complex authentication. Pick one, retrieve or create its OpenAPI schema, and add it as an Action in your GPT. Don’t forget to link the Action to your instructions by specifying when to use it: “When the user asks for the weather, use the getForecast action.” Then test with several different phrasings to verify the GPT triggers the call at the right time.
A few pitfalls await first attempts. A malformed schema—a single missing comma in the JSON—blocks everything: always validate your schema in Swagger Editor before pasting it. Missing descriptions leave the GPT blind: without them, it doesn’t know when an action is relevant. Also plan for API errors, which will happen sooner or later: specify the behavior in your instructions, for example, “If the API doesn’t respond, tell the user to try again later”—otherwise the GPT will improvise, sometimes by inventing data. And don’t rely solely on the preview panel: test in real conditions, with real data and real user phrasings.
Know two limits before you start: a GPT uses connected apps or actions, not both, and actions don’t work in Pro mode. Most importantly, custom actions don’t carry over to a plugin during migration: first check whether the plugin directory already offers an app for your target service; if not, you’ll need to rebuild the integration, for example with an MCP server.
Official sources: Configuring actions in GPTs (OpenAI Help Center: authentication, OpenAPI schema, testing, limits) · Custom GPT retirement and migration FAQ (actions not transferred) · OpenAPI Specification (schema format)
Key Takeaways
- Actions connect your GPT to external services via their APIs
- You must provide an OpenAPI schema describing the available endpoints
- Descriptions in the schema are essential—the GPT uses them to decide which action to call
- Start with a free public API to get familiar with the process
- Limit exposed endpoints to the strict minimum for your use case