Skip to main content

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.
Import path note:
  • 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

Flask

Django Ninja

Associate requests with user/device identity to unlock consumer filters. FastAPI example:

5) Verify traffic

  1. Deploy/restart your service.
  2. Hit a few endpoints.
  3. 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_logging and body logging flags are True.