Document incoming OpenAPI webhooks in FastAPI
Answer: OpenAPI webhooks describe incoming requests that the API consumer may choose to implement. They are closely related to the callbacks feature, but they are not tied to one parent operation. FastAPI can document them when you use OpenAPI 3.1.0 and above.
Webhooks in the specification
The webhooks field is a map. The incoming webhooks that MAY be received as part of this API are the ones the API consumer MAY choose to implement. The key name is a unique string to refer to each webhook. The Path Item Object describes a request initiated by the API provider, for example after an out of band registration.
Documenting webhooks in FastAPI
In FastAPI this is normally called a webhook: your app sends requests to another system. You define the message and the body of the request in your code. Users define the URL for those requests. How you register the URLs is up to you. The webhooks attribute on the application is where you define webhooks for the OpenAPI document.
| webhooks | callbacks | |---|---| | webhooks | Incoming requests the API consumer may implement | | callbacks | Out-of band callbacks related to a parent operation | | Path Item Object | Describes a request the API provider may initiate | | OpenAPI 3.1.0 | Webhooks are available in OpenAPI 3.1.0 and above |
See also
Claims
- id: C1 claim: OpenAPI webhooks are requests the API consumer may choose to implement, closely related to callbacks. source: S1 evidence: "The incoming webhooks that MAY be received as part of this API"
- id: C2 claim: The Path Item Object describes a request the API provider may initiate. source: S1 evidence: "describes a request that may be initiated by the API provider"
- id: C3 claim: FastAPI supports documenting webhooks in OpenAPI 3.1.0 and above. source: S2 evidence: "Webhooks are available in OpenAPI 3.1.0 and above"
Sources
- [S1] OpenAPI Specification. OpenAPI Initiative. https://spec.openapis.org/oas/latest.html . License: Apache-2.0. Accessed 2026-11-19.
- [S2] OpenAPI Webhooks. FastAPI. https://fastapi.tiangolo.com/advanced/openapi-webhooks/ . License: MIT. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: OpenAPI Initiative, OpenAPI Specification; FastAPI, OpenAPI Webhooks. Apache-2.0; MIT. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: OpenAPI Initiative, OpenAPI Specification; FastAPI, OpenAPI Webhooks. Apache-2.0; MIT.
Cite this
iinventedlight. 2026. "Document incoming OpenAPI webhooks in FastAPI." iinventedlight Library, iil:note:begxdmr6, version of 2026-11-19. https://iinventedlight.com/library/notes/openapi-webhooks/. License: CC-BY-4.0.
@misc{iil_note_begxdmr6,
author = {{iinventedlight}},
title = {{Document incoming OpenAPI webhooks in FastAPI}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/openapi-webhooks/},
note = {Permanent ID iil:note:begxdmr6. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- openapi-webhooks.table.json (table; CC-BY-4.0)
- openapi-webhooks.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/openapi-webhooks.md.