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

# Configuration

> Configure the Apitally Serverless SDK for Python.

```python FastAPI {7-10} theme={null}
from fastapi import FastAPI
from apitally_serverless.fastapi import ApitallyMiddleware

app = FastAPI()
app.add_middleware(
    ApitallyMiddleware,
    log_request_headers=True,
    log_request_body=True,
    log_response_body=True,
    # other parameters ...
)
```

## Parameters

The following configuration parameters are available.

| Parameter              | Description                                                                                                                           | Type        | Default |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :---------- | :------ |
| `enabled`              | Whether to enable the Apitally integration.                                                                                           | `bool`      | `True`  |
| `log_request_headers`  | Whether to include request headers in the logs. Default masking for common sensitive headers (e.g. `Authorization`) applies.          | `bool`      | `False` |
| `log_request_body`     | Whether to include the request body in the logs. Only JSON and text are supported, up to 10 KB.                                       | `bool`      | `False` |
| `log_response_headers` | Whether to include response headers in the logs.                                                                                      | `bool`      | `True`  |
| `log_response_body`    | Whether to include the response body in the logs. Only JSON and text are supported, up to 10 KB.                                      | `bool`      | `False` |
| `mask_headers`         | List of regular expressions for matching headers to mask. These are in addition to the default masking patterns.                      | `list[str]` | `[]`    |
| `mask_body_fields`     | List of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns. | `list[str]` | `[]`    |
| `exclude_paths`        | List of regular expressions for matching paths to exclude from logging.                                                               | `list[str]` | `[]`    |
