Skip to main content

Apirelio FastAPI SDK

Native FastAPI/Starlette ASGI middleware for privacy-safe, customer-aware API analytics. It uses the resolved route template and only enqueues after the response completes.

pip install apirelio-fastapi
import os

from fastapi import FastAPI
from apirelio_fastapi import install_apirelio

app = FastAPI()

install_apirelio(
    app,
    api_key=os.environ.get("APIRELIO_API_KEY", ""),
    endpoint=os.environ.get("APIRELIO_ENDPOINT", "https://apirelio.com"),
    service="billing-api",
    environment="production",
    include_routes=("/api/**",),
    exclude_routes=("/api/health", "/api/internal/**"),
    resolve_customer=lambda request: {
        "id": str(request.state.user.company_id),
        "plan": request.state.user.plan,
    } if hasattr(request.state, "user") else None,
)

The installer stores the client at app.state.apirelio and flushes it during FastAPI shutdown. Bodies, query strings, cookies, authorization values, email addresses and IP addresses are never captured. Python 3.9+, FastAPI 0.100+ and FastAPI versions below 1.0 are supported.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apirelio_fastapi-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apirelio_fastapi-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file apirelio_fastapi-0.2.0.tar.gz.

File metadata

  • Download URL: apirelio_fastapi-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for apirelio_fastapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8ce4a1c23e8269d5aadce1ccf2ebef6b399efe6a281bc39623f68baf8fda8312
MD5 bbfc0200ecce976cd0da43b92b9e316e
BLAKE2b-256 fa3bf84be2da70effd8c25b135b716213c1f78c03a495c75f4a0b953ee44d5f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for apirelio_fastapi-0.2.0.tar.gz:

Publisher: release-packages.yml on pryznar/apirelio-app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file apirelio_fastapi-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for apirelio_fastapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75abab6ef7d30e776e467688cc41a44a4c9d65aa6bcb94975400073b69a81337
MD5 9d3a3b97aad78d0ebb0947954a1cb8fe
BLAKE2b-256 be3b9af471d2ac1379edd1ea3052716baa8ae05b4b7a4a91730646d9119feb11

See more details on using hashes here.

Provenance

The following attestation bundles were made for apirelio_fastapi-0.2.0-py3-none-any.whl:

Publisher: release-packages.yml on pryznar/apirelio-app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page