> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.rebase.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Endpoints

> Serve an API endpoint

{/*
Inspired by: 
https://docs.ray.io/en/latest/serve/getting_started.html
https://modal.com/docs/guide/webhooks
*/}

```python
from pydantic import BaseModel
from fastapi.responses import HTMLResponse

from modal import Image, App, web_endpoint

image = Image.debian_slim().pip_install("boto3")
app = App(image=image)  # Note: prior to April 2024, "app" was called "stub"


class Item(BaseModel):
    name: str
    qty: int = 42


@app.function()
@web_endpoint(method="POST")
def f(item: Item):
    import boto3
    # do things with boto3...
    return HTMLResponse(f"<html>Hello, {item.name}!</html>")
```
