Appearance
Connect your app
Add an API Glimpse connector so real traffic shows up as endpoints and schemas in the dashboard. Set your project API key and API Glimpse URL, then open the project after a few requests.
Your app
→ Connector
→ API Glimpse
→ Dashboard (endpoints, schemas, tags)Connectors
| Connector | Status | Install |
|---|---|---|
| Express | Available | npm install @apiglimpse/middleware |
| Fastify | Available | npm install @apiglimpse/fastify |
| NestJS | Available | npm install @apiglimpse/nestjs |
| Next.js | Available | npm install @apiglimpse/next |
| FastAPI | Available | pip install apiglimpse |
| Django | Available | pip install "apiglimpse[django]" |
| Flask | Available | pip install "apiglimpse[flask]" |
| Go (chi) | Available | go get …/connectors/go/apiglimpse |
| Spring Boot | Available | Maven starter |
| ASP.NET Core | Available | ApiGlimpse.AspNetCore |
| Node gateway sidecar | Available | @apiglimpse/gateway-proxy |
| Nginx (OpenResty) | Available | See repo docs/GATEWAY_NGINX.md |
| Kong | Available | See repo docs/GATEWAY_KONG.md |
| Hono | Coming soon | — |
All connectors send the same samples to https://collect.apiglimpse.com (one hosted collector).
Publish note: Public registry installs work after maintainers publish packages. Until then, use the demos under
demo/with local paths (see the repo integrating guide).
Express
Add the Express connector (@apiglimpse/middleware) to your app.
Your Express app
→ @apiglimpse/middleware
→ API Glimpse
→ Dashboard (endpoints, schemas, tags)Prerequisites
- An API Glimpse account and a project in the dashboard.
- A project API key (
ask_…) — shown once when you create it. - The API Glimpse URL:
https://collect.apiglimpse.com. API_SENSOR_KEYandAPI_SENSOR_AGENT_URLset in your app environment.
Install
bash
npm install @apiglimpse/middlewareEnvironment variables
bash
API_SENSOR_AGENT_URL=https://collect.apiglimpse.com
API_SENSOR_KEY=ask_YOUR_PROJECT_KEY_HERE
API_SENSOR_SAMPLE_RATE=1
# Optional but recommended — labels this app in caller topology:
API_SENSOR_SERVICE_NAME=my-serviceWire the middleware
Mount it early — after body parsers you care about (so JSON bodies are available), and before (or around) the routes you want discovered.
ESM
js
import express from 'express';
import { apiSensor } from '@apiglimpse/middleware';
const app = express();
app.use(express.json());
app.use(
apiSensor({
agentUrl: process.env.API_SENSOR_AGENT_URL || 'https://collect.apiglimpse.com',
apiKey: process.env.API_SENSOR_KEY || '',
sampleRate: Number(process.env.API_SENSOR_SAMPLE_RATE || 1),
}),
);
// ... existing routesCommonJS
The middleware package is ESM. Prefer converting the entry file, or use a dynamic import:
js
const express = require('express');
async function main() {
const { apiSensor } = await import('@apiglimpse/middleware');
const app = express();
app.use(express.json());
app.use(
apiSensor({
agentUrl: process.env.API_SENSOR_AGENT_URL || 'https://collect.apiglimpse.com',
apiKey: process.env.API_SENSOR_KEY || '',
sampleRate: Number(process.env.API_SENSOR_SAMPLE_RATE || 1),
}),
);
// ... existing routes, app.listen, etc.
}
main();Verify
- Hit a few of your routes
- Dashboard → project → endpoints should show method + path within a few seconds
- Optional:
curl -s $API_SENSOR_AGENT_URL/healthto confirm API Glimpse is reachable
Options reference
| Option | Default | Meaning |
|---|---|---|
agentUrl | https://collect.apiglimpse.com | API Glimpse base URL |
apiKey | '' | Project API key (ask_…) |
sampleRate | 1 | Fraction of requests to capture (0–1) |
flushIntervalMs | 1000 | How often the buffer flushes |
maxBatchSize | 50 | Samples per flush |
maxBufferSize | 500 | Cap; excess samples dropped |
requestTimeoutMs | 2000 | HTTP timeout when sending samples |
circuitFailureThreshold | 3 | Failures before pausing sends |
circuitOpenMs | 15000 | How long to wait before retrying when API Glimpse is unreachable |
What gets captured
- Method, path, status, latency, content-types, auth mode hints
- Truncated / redacted body field names and types
- Sensitive headers (
authorization, cookies) are removed before data leaves your app
API Glimpse stores inferred schemas and tags — not long-lived raw request bodies.
Placement tips
- Prefer mounting once at the app root so all routes are visible.
- For a subset, mount on a nested
Routerinstead ofapp. - Health checks you don’t care about can sit above the middleware:
js
app.get('/health', (_req, res) => res.send('ok'));
app.use(apiSensor({ /* ... */ }));Production apps
- Point
API_SENSOR_AGENT_URLathttps://collect.apiglimpse.com. - Set
API_SENSOR_KEYbefore you ship. Every batch needs a valid project API key.
Troubleshooting
No endpoints after traffic
- Confirm
API_SENSOR_KEYmatches a key for the project you are viewing. - Confirm
API_SENSOR_AGENT_URLpoints athttps://collect.apiglimpse.com(or check/health). - Mount the middleware after
express.json()(or other body parsers) and where the routes you care about are covered.
API Glimpse unreachable
If API Glimpse is unreachable, the connector drops samples and your app continues to serve traffic normally. Sampling resumes when the service is available again.
Fastify
bash
npm install @apiglimpse/fastifyjs
import Fastify from 'fastify';
import { apiSensor } from '@apiglimpse/fastify';
const app = Fastify();
await app.register(
apiSensor({
agentUrl: process.env.API_SENSOR_AGENT_URL || 'https://collect.apiglimpse.com',
apiKey: process.env.API_SENSOR_KEY,
sampleRate: Number(process.env.API_SENSOR_SAMPLE_RATE || 1),
}),
);Same env vars as Express (API_SENSOR_AGENT_URL, API_SENSOR_KEY, API_SENSOR_SAMPLE_RATE).
FastAPI
bash
pip install apiglimpsepython
from fastapi import FastAPI
from apiglimpse import ApiGlimpseMiddleware
app = FastAPI()
app.add_middleware(
ApiGlimpseMiddleware,
agent_url="https://collect.apiglimpse.com",
api_key="ask_…",
)Go (chi)
bash
go get github.com/jantznick/api-security/connectors/go/apiglimpse@latestgo
r.Use(apiglimpse.Middleware(apiglimpse.Config{
AgentURL: os.Getenv("API_SENSOR_AGENT_URL"),
APIKey: os.Getenv("API_SENSOR_KEY"),
}))NestJS
bash
npm install @apiglimpse/nestjsts
@Module({
imports: [
ApiGlimpseModule.forRoot({
agentUrl: process.env.API_SENSOR_AGENT_URL,
apiKey: process.env.API_SENSOR_KEY,
}),
],
})
export class AppModule {}Next.js
bash
npm install @apiglimpse/nextjs
import { withApiSensor } from '@apiglimpse/next';
export const GET = withApiSensor(async () => Response.json({ ok: true }));Django
bash
pip install "apiglimpse[django]"Add "apiglimpse.django.ApiGlimpseDjangoMiddleware" to MIDDLEWARE.
Flask
bash
pip install "apiglimpse[flask]"python
from apiglimpse.flask import ApiGlimpse
ApiGlimpse(app)Spring Boot
Add Maven dependency com.apiglimpse:apiglimpse-spring-boot-starter and set apiglimpse.agent-url / apiglimpse.api-key (see repo connectors/java).
ASP.NET Core
csharp
builder.Services.AddApiGlimpse(builder.Configuration);
app.UseApiGlimpse();Node gateway sidecar
Discover traffic without installing app middleware. Run the @apiglimpse/gateway-proxy reverse-proxy sidecar in front of your service; it forwards HTTP and samples the same envelope v1 as Express/Fastify.
bash
cd packages/gateway-proxy && npm install
API_SENSOR_UPSTREAM=http://app:3000 \
API_SENSOR_AGENT_URL=https://collect.apiglimpse.com \
API_SENSOR_KEY=ask_YOUR_PROJECT_KEY \
npm startPoint clients at the proxy (default port 9080).
Native Nginx (OpenResty) and Kong Lua plugins are also available — see the GitHub docs GATEWAY_NGINX.md / GATEWAY_KONG.md.
Not supported yet
- Runtime request blocking
- Envoy / eBPF