Skip to content

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 ​

ConnectorStatusInstall
ExpressAvailablenpm install @apiglimpse/middleware
FastifyAvailablenpm install @apiglimpse/fastify
NestJSAvailablenpm install @apiglimpse/nestjs
Next.jsAvailablenpm install @apiglimpse/next
FastAPIAvailablepip install apiglimpse
DjangoAvailablepip install "apiglimpse[django]"
FlaskAvailablepip install "apiglimpse[flask]"
Go (chi)Availablego get …/connectors/go/apiglimpse
Spring BootAvailableMaven starter
ASP.NET CoreAvailableApiGlimpse.AspNetCore
Node gateway sidecarAvailable@apiglimpse/gateway-proxy
Nginx (OpenResty)AvailableSee repo docs/GATEWAY_NGINX.md
KongAvailableSee repo docs/GATEWAY_KONG.md
HonoComing 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 ​

  1. An API Glimpse account and a project in the dashboard.
  2. A project API key (ask_…) — shown once when you create it.
  3. The API Glimpse URL: https://collect.apiglimpse.com.
  4. API_SENSOR_KEY and API_SENSOR_AGENT_URL set in your app environment.

Install ​

bash
npm install @apiglimpse/middleware

Environment 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-service

Wire 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 routes

CommonJS ​

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 ​

  1. Hit a few of your routes
  2. Dashboard → project → endpoints should show method + path within a few seconds
  3. Optional: curl -s $API_SENSOR_AGENT_URL/health to confirm API Glimpse is reachable

Options reference ​

OptionDefaultMeaning
agentUrlhttps://collect.apiglimpse.comAPI Glimpse base URL
apiKey''Project API key (ask_…)
sampleRate1Fraction of requests to capture (0–1)
flushIntervalMs1000How often the buffer flushes
maxBatchSize50Samples per flush
maxBufferSize500Cap; excess samples dropped
requestTimeoutMs2000HTTP timeout when sending samples
circuitFailureThreshold3Failures before pausing sends
circuitOpenMs15000How 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 Router instead of app.
  • 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_URL at https://collect.apiglimpse.com.
  • Set API_SENSOR_KEY before you ship. Every batch needs a valid project API key.

Troubleshooting ​

No endpoints after traffic

  • Confirm API_SENSOR_KEY matches a key for the project you are viewing.
  • Confirm API_SENSOR_AGENT_URL points at https://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/fastify
js
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 apiglimpse
python
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@latest
go
r.Use(apiglimpse.Middleware(apiglimpse.Config{
  AgentURL: os.Getenv("API_SENSOR_AGENT_URL"),
  APIKey:   os.Getenv("API_SENSOR_KEY"),
}))

NestJS ​

bash
npm install @apiglimpse/nestjs
ts
@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/next
js
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 start

Point 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

Signup open on the dashboard · app.apiglimpse.com