OpenAPI Callbacks and Webhooks
OpenAPI Callbacks
Section titled “OpenAPI Callbacks”Callbacks define the schema for outbound requests your API makes:
from justapi import JustAPIAppfrom pydantic import BaseModel
class Order(BaseModel): id: int status: str
app = JustAPIApp()
@app.post("/orders", callbacks={ "on_order_complete": { "http://localhost:8000/webhook": { "post": { "requestBody": { "content": { "application/json": { "schema": Order.model_jsonschema() } } } } } }})def create_order(order: Order): return {"id": 1, "status": "pending"}OpenAPI Webhooks
Section titled “OpenAPI Webhooks”Define outbound webhook schemas:
@app.webhooks.post("new-order")def new_order_webhook(order: Order): """ This webhook is triggered when a new order is created. """ passSee Also
Section titled “See Also”- Additional Responses in OpenAPI — error responses
- Metadata & Docs URLs — app metadata
- OpenAPI Callbacks Reference — full reference