An OpenAPI specification is a machine-readable description of an HTTP API. It records endpoints, operations, responses, and data schemas so tools and assistants can understand how to call the service. section 3.3.1
Use a specification to:
- Describe a FastAPI endpoint, including its HTTP method, path, response structure, and data schema. section 3.3.1
- Connect an external service to a GPT assistant by pasting the specification into a custom action and adding its server URL. section 3.3.2
- Update the assistant’s action configuration whenever the connected API changes. section 3.3.2
Daily tasks API
A GET /tasks endpoint returns daily tasks as JSON. Its OpenAPI document identifies OpenAPI 3.1.0, describes the successful response as an array, and defines each Task with id, description, and completed fields. The document can be retrieved from FastAPI’s /openapi.json endpoint and saved as YAML or JSON. section 3.3.1
Listing 3.12 OpenAPI specification for the task API
openapi: 3.1.0
info:
title: FastAPI
version: 0.1.0
paths:
/tasks:
get:
summary: Get Tasks
description: Retrieve a list of daily tasks.
operationId: get_tasks_tasks_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Task'
title: Response Get Tasks Tasks Get
components:
schemas:
Task:
type: object
properties:
id:
type: integer
title: Id
description:
type: string
title: Description
completed:
type: boolean
title: Completed
required:
- id
- description
- completed
title: Task
Inspect the complete OpenAPI document for the task endpoint, including its path, response schema, and Task component. section 3.3.1











