Docs v0.2.0
v0.2.0 · Beta REST API REST API

Driftn Documentation

Driftn is an infrastructure observability platform for solo developers and small teams — it watches your stack's security, cost, uptime, and deploys in one place. This reference covers every API endpoint, authentication, rate limits, and integration patterns.

💡 The base API is publicly accessible with an API secret key. All endpoints return JSON. Authentication for user-specific resources uses Supabase JWT tokens.

Platform pillars

🗺
Infrastructure Platform
Infra Graph, Time Machine and Root Cause Timeline — see your whole stack, how it changed, and why it broke.
💰
Cloud Cost
Audit Vercel, Supabase and AWS costs. Get waste reports, savings predictions and automatic optimisations.
🔒
InfraSec
Security scanning powered by vErtex. SSL monitoring, HTTP header analysis, OWASP Top 10 checks.
📡
Continuous Monitoring
Driftn watches your stack on a schedule and alerts you before something breaks — not just when you check.
🛠
DevTools
Stack Comparator, ENV Validator, Regex Tester, JSON Tools, Cron Builder — all in-browser.
📊
Business
MRR dashboard and revenue forecasting from your Stripe account in real time.

Quickstart

The fastest way to try the API is a direct curl to the health endpoint — no auth required:

# Check API status
curl https://api.driftn.io/health

To call authenticated endpoints, pass your API secret in the header:

curl -X POST https://api.driftn.io/audit \
  -H "Content-Type: application/json" \
  -H "X-API-Secret: YOUR_SECRET" \
  -d '{"vercel_key":"vk_..."}'
⚠️ Never expose your API secret in client-side code. All authenticated requests should go through your backend.

Authentication

Driftn uses two authentication mechanisms depending on the endpoint:

API Secret (server-to-server)

Pass the secret in the X-API-Secret header. This is the primary auth method for all backend-to-backend integrations.

X-API-Secret: YOUR_API_SECRET

User JWT (Supabase Auth)

For user-scoped endpoints (profile, savings history, etc.), pass the Supabase access token:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Obtain a token via magic link:

curl -X POST https://api.driftn.io/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"dev@example.com"}'
200 OK POST /auth/register
{ "status": "ok", "message": "Check your email to access." }

Base URL & versioning

https://api.driftn.io

The API is currently at v0.1 with no URL versioning prefix. Breaking changes will be announced in the changelog and communicated via email to active subscribers.

All endpoints accept and return application/json. Timestamps are ISO 8601 in UTC.

Error handling

Driftn uses standard HTTP status codes. Error responses always include a detail field:

{
  "detail": "Proporciona al menos una API Key"
}
StatusMeaning
200Success
400Bad request — malformed body or invalid signature
401Unauthorized — missing or invalid API secret / JWT
422Validation error — field missing or value out of range
429Rate limit exceeded
500Internal server error

Rate limits

Rate limits are applied per IP address using slowapi:

Endpoint groupLimit
Default (all endpoints)60 / minute
/audit, /predict, /score10 / minute
/security/scan3 / minute
/waitlist, /auth/register5 / minute
/monitor/spike30 / minute
Demo endpoints20 / minute
ℹ️ When the rate limit is exceeded, the API returns 429 Too Many Requests. Implement exponential backoff in your client.

Cloud Cost

POST /audit Run a full cost audit

Audits Vercel, Supabase and/or AWS for cost waste and optimisation opportunities. At least one API key is required.

FieldTypeRequiredDescription
vercel_keystringoptionalVercel personal access token
supabase_keystringoptionalYour Supabase project API key
aws_keystringoptionalAWS access key ID
aws_secretstringoptionalAWS secret access key
aws_regionstringoptionalAWS region (default: us-east-1)
user_emailstringoptionalUsed to store history in Supabase
# Example: Vercel + Supabase audit
curl -X POST .../audit \
  -H "X-API-Secret: YOUR_SECRET" \
  -d '{"vercel_key":"vk_live_...", "supabase_key":"eyJ..."}'
200 OKResponse schema
{ "total_waste": 142.50, "findings": [...], "platforms": { "vercel": { "monthly_cost": 85.00, "waste": 32.00 }, "supabase": { "monthly_cost": 25.00, "waste": 8.00 } }, "recommendations": [...] }
POST /audit/pdf Download the audit report as a PDF

Runs the same audit as POST /audit and returns a branded PDF document instead of JSON. Accepts the same parameters.

POST /predict Cost prediction & forecast

Runs an audit then generates a 30/90-day cost forecast based on historical data. Accepts the same body as /audit.

# Response includes both audit + prediction
{
  "audit": { ... },
  "prediction": {
    "next_30_days": 310.00,
    "next_90_days": 980.00,
    "trend": "increasing",
    "confidence": 0.82
  }
}
POST /score Driftn infrastructure score

Calculates a 0–100 Driftn Score based on cost efficiency, deployment health, security posture and prediction risk. Stored in Supabase if user_email is provided.

200 OK
{ "score": { "total": 73, "grade": "B", "dimensions": { "cost_efficiency": 68, "deployment_health": 85, "security": 70, "prediction_risk": 72 } } }
POST /apply Execute a one-click fix

Applies a suggested remediation from an audit or score result — for example, removing an idle Lambda function or fixing a missing security header. The set of allowed actions is restricted server-side via an allowlist.

FieldTypeRequiredDescription
actionstringrequiredMust match an allowed action id
resource_idstringrequiredThe resource the action targets

InfraSec

POST /security/scan Full security scan via vErtex

Runs a security scan using the vErtex engine. Covers 12 modules including SSL, OWASP Top 10, headers, WAF, CMS detection, exposed files and API endpoints.

FieldTypeRequiredDescription
targetstringrequiredFull URL to scan (https://...)
modestringoptionalfast | normal | deep (default: fast)
vt_keystringoptionalVirusTotal API key for enhanced checks
shodan_keystringoptionalShodan API key for network intelligence
⚠️ Localhost, 127.0.0.1 and internal IPs are blocked. Only scan targets you own or have permission to test.
200 OK
{ "target": "https://example.com", "security_score": 85, "grade": "A", "vuln_counts": { "critical": 0, "high": 1, "medium": 3, "low": 2 }, "vulnerabilities": { "critical": [], "high": [...], ... }, "technologies": ["Nginx", "React"], "ssl_info": { "valid": true, "days_until_expiry": 74 }, "waf_detected": "Cloudflare", "api_endpoints": [...], "backup_files": [], "scan_date": "2026-06-19T08:00:00Z" }
POST /infrasec/ssl/check SSL certificate check (batch)

Check SSL certificates for up to 20 domains at once.

{ "domains": ["example.com", "api.example.com"] }
POST /infrasec/headers/analyze HTTP security header analysis

Analyses HTTP security headers and generates a remediation config. Pass generate: "vercel" or "nginx" to get a ready-to-paste config file.

{
  "url": "https://example.com",
  "generate": "vercel"
}
POST /deployments List recent deployments

Returns recent deployments from a connected Vercel project, including status, duration, and commit metadata. Used to power the Pipeline Health and overview deploy list in the dashboard.

FieldTypeRequiredDescription
vercel_keystringrequiredVercel personal access token
limitintegeroptionalDefault 10

API Monitor

POST /api-monitor/ping Server-side endpoint ping

Pings a URL from the backend server. More reliable than browser-based pings — avoids CORS and client-side network issues.

FieldTypeDefaultDescription
urlstringrequiredURL to ping
methodstringGETHTTP method
timeoutint8Timeout in seconds (max 30)
200 OK
{ "status": "up", // up | slow | down "latency_ms": 42, "http_status": 200, "url": "https://api.example.com/health", "timestamp": "2026-06-19T08:00:00Z" }
GET /api-monitor/endpoints List monitored endpoints

Returns all endpoints registered for monitoring for a given user_id.

GET /api-monitor/endpoints?user_id=default
GET /api-monitor/history/{endpoint_id} Latency history for an endpoint

Returns the last limit ping results (default 50) for an endpoint, ordered newest first.

Infrastructure Platform

Driftn models your infrastructure as a graph of nodes (services, databases, APIs, deployments) and edges (calls, dependencies). Every security scan, deploy, and cost audit emits an event onto a shared timeline, which powers the Infra Graph, Time Machine, and Root Cause Timeline features in the dashboard.

💡 All /infra/* endpoints use X-API-Secret auth and accept a user_id query param to scope results to a specific account.
GET /infra/graph Get the user's infrastructure graph

Returns all nodes and edges for the authenticated user. Use /infra/graph/demo (no auth) to preview the graph shape with sample data.

200 OKResponse schema
{ "nodes": [ { "id": "n1", "type": "project", "name": "driftn-web", "provider": "vercel", "health": "healthy", "cost": 0 } ], "edges": [ { "id": "e1", "source": "n1", "target": "n2", "relationship": "calls", "latency_ms": 45 } ] }
POST /infra/graph/sync Rebuild the graph from connected platforms

Re-derives nodes and edges from your connected Vercel/Supabase/AWS credentials and emits a graph_sync event onto the timeline.

FieldTypeRequiredDescription
vercel_keystringoptionalUsed to derive project/deployment nodes
supabase_keystringoptionalUsed to derive database/auth nodes
user_idstringoptionalDefaults to "default"

Events & Root Cause Timeline

Every meaningful change in your infrastructure — a deploy, a CPU spike, a security finding, a rollback — is recorded as an event. Events with related causes are automatically correlated within a 5-minute window into incident chains.

GET /infra/events List recent events

Supports filtering by severity (critical/high/medium/low/info) and type (deployment, cpu_spike, api_error, incident_opened, etc). /infra/events/demo returns a realistic 10-event incident chain with no auth required — useful for previewing the Root Cause Timeline UI.

GET /infra/events/chain/{event_id} Full causal chain for an incident

Recursively follows an event's related_ids (max depth 10) and returns the full chain sorted chronologically — e.g. deploy → CPU spike → memory spike → Redis timeout → API errors → rollback → recovered.

Time Machine

A snapshot captures the full state of your infrastructure graph (plus the latest score and security scan) at a point in time. Snapshots are created automatically on deploys and security events, or manually via the dashboard.

GET /infra/snapshots List snapshots

Returns lightweight snapshot summaries (not the full payload) ordered newest first. Use POST /infra/snapshots to create one on demand.

GET /infra/snapshots/diff/{snapshot_a}/{snapshot_b} Structured diff between two snapshots

Compares two snapshots and returns added/removed/modified nodes and edges, plus the cost and health deltas between them. Powers the "Yesterday → Today" comparison view.

200 OKResponse schema
{ "diff": { "nodes": { "added": [...], "removed": [...], "modified": [...] }, "edges": { "added": [...], "removed": [...] }, "cost_delta": -12.5, "has_changes": true } }

Monitoring & Cron

Continuous monitoring is what turns Driftn from a tool you check manually into a platform that watches your stack on its own. A scheduled job (e.g. a cron service of your choice) calls these endpoints on a fixed interval.

⚠️ Cron endpoints use a separate X-Cron-Secret header — distinct from X-API-Secret — so a compromised frontend secret cannot trigger monitoring sweeps or drain your email quota.
POST /cron/sweep Run a monitoring sweep

Iterates over users with monitoring_enabled = true, pings their tracked endpoints, and emits api_error or latency_spike events for failures. Recommended schedule: every 6 hours.

HeaderRequiredDescription
X-Cron-SecretrequiredMust match CRON_SECRET env var
POST /cron/weekly-digest Send the weekly summary email

Sends each monitored user an email with their week's event count, critical alerts, deploys, and incidents. Recommended schedule: Mondays at 9am.

POST /profile/monitoring Update monitoring preferences

Toggles continuous monitoring, email alerts, and the weekly digest for a user. Emits a config_change event so the change shows up in the activity feed.

FieldTypeRequiredDescription
user_emailstringrequired
monitoring_enabledbooleanoptionalDefault false
alert_emailbooleanoptionalDefault true
weekly_digestbooleanoptionalDefault true

TeamSpace

🚧 The TeamSpace UI is currently marked "under construction" in the dashboard while real-time sync is rebuilt to fix data persistence issues. These API endpoints remain fully functional and stable — only the dashboard tabs are temporarily hidden.
GET /teamspace/tasks List tasks

Returns tasks filtered by user_id (default) or team_id. Also available: POST, PATCH /{id}, DELETE /{id}.

Field (POST)TypeDescription
titlestringTask title (required)
statusstringbacklog | todo | inprogress | done
prioritystringlow | medium | high | critical
assigneestringDisplay name of assignee
due_datestringISO date string (YYYY-MM-DD)
GET /teamspace/events List calendar events

Returns events ordered by date. Event types: task | deadline | meeting | release.

GET /teamspace/messages/{channel} Get channel messages

Returns up to limit messages (default 50) for a channel and team_id. Use POST /teamspace/messages to send.

Business

GET /mrr MRR & subscription metrics from Stripe

Returns live MRR, ARR, churn rate and per-plan breakdown from your Stripe account. If STRIPE_SECRET_KEY is not configured, returns mock data with "source": "mock".

200 OK
{ "mrr": 2840, "arr": 34080, "customers": 124, "churn_rate": 3.1, "arpu": 22.9, "plans": [ { "name": "Dev", "count": 84, "revenue": 756 } ], "source": "stripe" }
GET /mrr/customers List paying customers from Stripe

Returns active Stripe subscriptions with plan, amount, and start date — the customer-level breakdown behind the /mrr summary.

POST /stripe/webhook Stripe webhook handler

Receives Stripe events and logs them to Supabase. Configure in your Stripe Dashboard → Webhooks pointing to this endpoint. Requires STRIPE_WEBHOOK_SECRET.

Handled events: customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.payment_failed.

Platform

POST /waitlist Add email to waitlist

Adds an email to the beta waitlist and sends a confirmation email via Resend. Idempotent — calling it again with the same email returns {"status": "already_registered"} instead of an error.

{ "email": "dev@example.com" }
POST /checkout/ltd Create a Lifetime Deal checkout session

Creates a Stripe Checkout session in one-time payment mode (not a subscription). Limited to 50 seats — once claimed, the endpoint returns 409.

ℹ️ Payments are currently paused for the beta launch. This endpoint is implemented and tested but not yet linked from the UI — the beta landing page directs signups to the waitlist instead.
FieldTypeRequiredDescription
emailstringoptionalPre-fills the Stripe checkout email field
200 OKResponse schema
{ "checkout_url": "https://checkout.stripe.com/...", "seats_remaining": 37 }
POST /payments/checkout Create Stripe checkout session
FieldTypeDescription
planstringpro | agency
emailstringCustomer email (optional if authenticated)
200 OK
{ "checkout_url": "https://checkout.stripe.com/pay/cs_..." }
GET /health API health check
200 OK
{ "status": "ok", "version": "0.1.0", "supabase": "connected", "env": "production" }

Plans & limits

ℹ️ Driftn is in beta — all plans are currently free to join. Payments will open after the initial beta feedback period; the table below reflects what each plan will unlock when payments are live.
Feature Free Lifetime Deal $50 Agency €79/mo
Security scannerDemo data✓ Real data✓ Real data
Cloud Cost auditDemo data✓ Real data✓ Real data
Continuous monitoring + alerts
Infra Graph, Time Machine, Root CauseDemo only✓ Real data✓ Real data
Full security PDF report
Weekly infrastructure digest
Client workspaces✓ Unlimited
White-label reports
Monitored endpoints5UnlimitedUnlimited
BillingOne-time, foreverMonthly

Changelog

v0.2.0 — June 2026

  • Pivoted from a security/cost tool to a full infrastructure observability platform
  • Infrastructure Platform: Infra Graph, Time Machine, and Root Cause Timeline
  • Shared event bus (infra_events) — every module now emits events that power correlation and the live activity feed
  • Continuous monitoring: scheduled /cron/sweep checks endpoints automatically and emits alerts
  • Weekly digest email summarising the week's infrastructure activity
  • Lifetime Deal ($50 one-time) checkout flow — currently paused while payments are off for the beta launch
  • Dedicated beta waitlist landing and 3-step onboarding flow
  • TeamSpace UI marked "under construction" while real-time sync is rebuilt (API unaffected)
  • Security hardening: SSRF protection on the scanner, request body size limits, global exception handler
  • Privacy Policy and Terms of Service published

v0.1.0 — June 2026

  • Initial MVP launch with 6 platform pillars
  • Cloud Cost: Vercel, Supabase and AWS auditing
  • InfraSec: vErtex security scanning, SSL monitor, header analyser
  • DevTools: Stack Comparator, ENV Validator, Regex Tester, JSON Tools, Cron Builder
  • API Monitor: server-side ping with Supabase history
  • TeamSpace: Kanban tasks, calendar events, team chat
  • Business: MRR dashboard and revenue forecasting from Stripe
  • Public security scanner at /security-check
  • Stripe subscriptions with webhook sync
  • Supabase Auth (magic link)