Draft OpenAPI 3.1 Schemas for Custom GPT API Actions

Generate production-ready OpenAPI 3.1 YAML specifications from plain-English descriptions of your API endpoints to use in ChatGPT Custom GPT actions.

Text prompt

Prompt

Prompt
Act as an API Architect. I will provide a description of the API tool I need to build for a Custom GPT. You will convert this into a complete, valid OpenAPI 3.1 YAML schema. Rules: 1. Use strictly typed properties for all query parameters and JSON bodies. 2. Include a components section with reusable schemas for common objects. 3. Define a securitySchemes section using Bearer Auth. 4. Provide a realistic response example for each path. 5. Ensure the structure is ready to paste directly into the ChatGPT Action configuration. Output format: 1. A brief summary of the API purpose. 2. The full OpenAPI YAML block. 3. A list of required server headers. This is not legal or technical advice; consult a developer before deploying to production environments. Please ask me these three questions first and wait: 1. What is the base URL of your API? 2. What are the specific endpoints and their primary functions? 3. What data fields are required for each request and what is the expected JSON response structure?

Example output

Parts of the generated OpenAPI 3.1 schemaWeather API example for a Custom GPT action
  1. API PurposeZip code in, temperature, humidity, precipitation out
  2. Info and serverLocal Weather API v1.0.0 at api.weather-service.com/v1
  3. Path /current (GET)Required zip_code query parameter, returns WeatherResponse
  4. ComponentsBearerAuth (JWT) and WeatherResponse schema
  5. Required headersAuthorization Bearer key and Content-Type application/json

Example for: a local weather service API integration.

API Purpose

This schema defines a weather retrieval tool that accepts zip codes and returns current temperature, humidity, and precipitation probability for the ChatGPT Actions interface.

OpenAPI YAML

openapi: 3.1.0
info:
title: Local Weather API
version: 1.0.0
servers:

  • url: https://api.weather-service.com/v1
    paths:
    /current:
    get:
    summary: Get current weather
    parameters:

    • name: zip_code
      in: query
      required: true
      schema:
      type: string
      responses:
      '200':
      description: Successful response
      content:
      application/json:
      schema:
      $ref: '#/components/schemas/WeatherResponse'
      components:
      securitySchemes:
      BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      schemas:
      WeatherResponse:
      type: object
      properties:
      temperature:
      type: number
      humidity:
      type: integer
      precipitation:
      type: number
      security:
  • BearerAuth: []
Required Headers
  • Authorization: Bearer <your-api-key>
  • Content-Type: application/json
Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces strict typing to prevent common API integration errors in ChatGPT.
  • Uses a component-based structure for clean and reusable API definitions.
  • Ensures security headers are defined upfront for authenticated requests.

Use this prompt to generate the Action schema for any Custom GPT that needs to interact with an external service. Paste the resulting YAML directly into the ChatGPT Actions configuration interface. Supported in ChatGPT.

Common edits

  • Add additional path parameters if your API requires specific location IDs.
  • Modify the security scheme if your API uses API Keys instead of Bearer tokens.

Reuse it: Use in a workflowTurn into a skillAdapt in the builder

More in ChatGPT

Generate API Client Patches from OpenAPI Schema Diffs

This prompt analyzes OpenAPI diffs to generate precise code patches and unit test assertions for your API client SDK.

Reconcile OpenAPI Schema Drift with Backend Logic

Get a three-column alignment matrix that identifies discrepancies between your OpenAPI spec, TypeScript client types, and actual backend request validation logic.

AI Tools & Prompt Engineering

Create a Reusable Library of Personal AI Prompts

Get three ready-to-use prompts with no fill-in brackets, each with a task name and a follow-up question, after you answer three questions about your weekly work.

WritingClaude

Turn a Dense Technical Memo into a Plain-English Executive Briefing

Rewrites a technical memo as a two-minute executive briefing that keeps every number and risk, maps jargon to business impact, and ends with the decision needed.

Customer SupportGemini

Write a Customer Troubleshooting Guide for Specific Error Codes

Get a customer-facing troubleshooting guide that maps each error code to a plain-English cause, three numbered fix steps, and a clear escalation trigger.

Writing

Turn Engineering Notes Into Clear API Documentation

Convert raw technical notes into a structured, professional API endpoint specification including request headers, payload examples, and response codes.