Python SDK Setup
This guide mirrors what you expect from a premium SDK setup (inspired by Apitally-class DX) and applies to FastAPI, Flask, and Django Ninja.1) Install
Use extras to pull the right integration in one line.- install package:
apilenss - import modules:
apilens.*(recommended) - compatibility aliases:
apilenss.*also work
2) Configure environment
Add these to your secrets manager or.env:
3) Framework wiring
FastAPI (recommended)
Flask
Django Ninja
4) Identify consumers (optional but recommended)
Associate requests with user/device identity to unlock consumer filters. FastAPI example:5) Verify traffic
- Deploy/restart your service.
- Hit a few endpoints.
- Open Endpoints in API Lens; you should see data in under a minute.
6) Troubleshooting
- No data: confirm API key matches the app and env; check network egress to
api.apilens.ai. - 500 on ingest: verify migrations are applied and ClickHouse/Postgres env are present.
- Payloads missing: ensure
enable_request_loggingand body logging flags areTrue.