new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

FastAPI · Advanced · all subjects

openapi/webhooks

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Webhook definition in FastAPI

Webhooks allow your API to send requests to user applications to notify them of events. You define webhook names, HTTP methods, and request body schemas using @app.webhooks decorator. The webhook name (like 'new-subscription' in @app.webhooks.post('new-subscription')) is just an event identifier, not a URL path.

app.webhooks is an APIRouter

The app.webhooks object is an APIRouter instance, the same type used for structuring applications with multiple files. It allows you to define webhooks using decorator syntax like @app.webhooks.post() in the same way you define path operations.

Webhook documentation generation

Webhooks defined with FastAPI are automatically included in the OpenAPI schema and appear in the automatic docs UI at /docs alongside normal path operations.

OpenAPI webhooks availability

Webhooks are available in OpenAPI 3.1.0 and above, supported by FastAPI 0.99.0 and above.

Webhook implementation responsibilities

As the API developer, you define the webhook message bodies and moments when requests are sent. Users define the URL where your app should send webhook requests, typically through a web dashboard. The logic for registering webhook URLs and sending requests is implemented by you in your own code.

Give your agent this brain