dev-tools 4 min read

Apitally – Simple API Monitoring

Open-source API monitoring library for Python FastAPI Flask Django. Track metrics, request logs, traces, and alerts in minutes. MIT licensed.

By
Share: X in
Apitally API monitoring dashboard

TL;DR

TL;DR: Apitally is an open-source Python library that adds API monitoring to FastAPI, Flask, Django REST Framework, and Django Ninja in a few lines of code — no infrastructure changes needed.

Source and Accuracy Notes

⚠️ This section is MANDATORY. All links must be verified from actual source, not guessed.

What Is Apitally?

Apitally is an open-source API monitoring library for Python. It makes it easy to understand API usage, monitor performance, and troubleshoot issues — without requiring external infrastructure or complex setup.

The tagline from the README:

“Apitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues. Get started in minutes by just adding a few lines of code. No infrastructure changes required, no dashboards to build.”

Setup Workflow

Step 1: Install

pip install apitally

Requires Python 3.8 or higher.

Step 2: Get a Free API Key

Sign up at apitally.io to get a free API key. The free tier includes up to 100,000 requests per month.

Step 3: Add to Your App

FastAPI:

from fastapi import FastAPI
from apitally.fastapi import ApitallyMiddleware

app = FastAPI()
app.add_middleware(ApitallyMiddleware, apitally_key="your-api-key")

Flask:

from flask import Flask
from apitally.flask import apitally

app = Flask(__name__)
apitally(app, apitally_key="your-api-key")

Django REST Framework:

# settings.py
REST_FRAMEWORK = {
    'DEFAULTMiddleware': [
        # ... other middleware
        'apitally.drf.ApitallyMiddleware',
    ],
}
APITALLY_KEY = "your-api-key"

Django Ninja:

from ninja import NinjaAPI
from apitally.ninja import ApitallyMiddleware

api = NinjaAPI()
api.add_middleware(ApitallyMiddleware, apitally_key="your-api-key")

Deeper Analysis

What Gets Monitored

Once Apitally is added, it automatically tracks:

  • API analytics — traffic, error rates, and performance per endpoint and per consumer
  • Request logs — drill down to individual requests with method, path, status code, response time, request/response body sizes, and IP address
  • Error tracking — captures stack traces for 500 errors and links them to Sentry issues automatically
  • Uptime & heartbeat checks — configurable synthetic checks

Alerting

Apitally supports alerting via:

  • Email
  • Slack
  • Microsoft Teams

Alert types include custom threshold alerts and synthetic uptime checks.

Privacy Controls

Apitally lets you exclude specific paths from monitoring. This is important for health check endpoints, static file paths, or any route that should not have its metadata recorded.

Self-Hosting

For teams that want to keep data internal, Apitally offers a self-hosted option via Docker Compose. This is covered in the official documentation.

Pricing

Apitally offers three tiers:

| Tier | Price | Requests/month | Log retention | |------|-------|---------------|---------------| | Free | $0 | 100,000 | 7 days | | Pro | $49/month | 2,000,000 | 90 days | | Self-hosted | Free (open source) | Unlimited | Configurable |

The free self-hosted tier uses the MIT-licensed open-source codebase.

Practical Evaluation Checklist

  • Works with Python 3.8+
  • Supports FastAPI, Flask, Django REST Framework, Django Ninja
  • MIT license (verified via GitHub LICENSE file)
  • No infrastructure changes required
  • Community SDKs available for Node.js, Go, Java, and .NET
  • Free tier: 100k requests/month

FAQ

Q: Does Apitally send my request bodies to their servers? A: Apitally records metadata about requests (method, path, status code, timing, sizes, IP address) but does not record request bodies by default. You can exclude specific paths from monitoring entirely.

Q: How does Apitally compare to Datadog or New Relic? A: Apitally is a lightweight, focused library rather than a full observability platform. It works well for Python API developers who want quick insights without the complexity and cost of enterprise monitoring tools. The self-hosted option also makes it suitable for teams with strict data residency requirements.

Q: Is there a self-hosted option? A: Yes. Apitally is open source under the MIT license and can be self-hosted using Docker Compose. See the official docs for setup instructions.

Q: What frameworks does Apitally support natively? A: Python: FastAPI (0.94.1+), Flask (2.0.0+), Django REST Framework (3.10.0+), and Django Ninja (1.0.0+). Community SDKs also exist for Node.js, Go, Java, and .NET.

Conclusion

Apitally is a practical choice for Python developers who want API monitoring without the overhead of enterprise tools. The setup takes a few minutes, the free tier is generous, and the self-hosted option keeps data in-house. If you are running a FastAPI, Flask, or Django-based API and want quick visibility into traffic and errors, it is worth trying.

Source: github.com/apitally/apitally-py (MIT License)