import Link from "next/link"; import { Waypoints } from "lucide-react"; import { getWorkspace } from "@/lib/session"; import { API_PUBLIC_URL } from "@/lib/utils"; import { listProjectSessions, type Scope } from "@/lib/queries/dashboard"; import { PageHeader } from "@/components/ui/page-header"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { EmptyState } from "@/components/ui/empty-state"; import { Stat, StatGrid } from "@/components/ui/stat"; import { CodeBlock } from "@/components/ui/code-block"; import { formatNumber } from "@/lib/format"; import { SessionsTable } from "@/components/dashboard/sessions/sessions-table"; import { CreateSessionDialog } from "@/components/dashboard/sessions/create-session-dialog"; export const dynamic = "force-dynamic"; const API_SNIPPET = `# 1. Create a session (60–1800 s) curl -X POST ${API_PUBLIC_URL}/v1/sessions \\ -H "Authorization: Bearer fch_live_YOUR_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "country": "CA", "ttl": 600, "label": "checkout" }' # → { "id": "sess_…", "status": "active", … } # 2. Reuse it on every request that must share the same IP and cookies curl -X POST ${API_PUBLIC_URL}/v1/fetch \\ -H "Authorization: Bearer fch_live_YOUR_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "url": "https://example.com/cart", "session": "sess_…" }'`; export default async function SessionsPage() { const ws = await getWorkspace(); const scope: Scope = { organizationId: ws.organization.id, projectId: ws.project.id }; const rows = await listProjectSessions(scope); const active = rows.filter((r) => r.status === "active"); const totalRequests = rows.reduce((a, r) => a + r.requestCount, 0); return (
} /> {rows.length ? ( ) : ( } /> )}
How sessions work When to pin an IP, and when not to.

Same IP, same cookies. Every request that passes session: "sess_…" is routed through the same exit IP in the requested country, and cookies set by the target are replayed automatically. Use it for logins, carts, multi-step forms and paginated listings that break when the visitor changes.

Short-lived by design. TTL is 60 to 1800 seconds and does not extend on use. When a session expires or the IP is rotated away by the network, requests fail with SESSION_EXPIRED; create a new one and retry.

Network class. Only auto and residential are available for sessions today. Datacenter, ISP and mobile are coming soon.

Billing. Sessions are free; you pay for the requests and bandwidth that go through them. Closing a session early frees the sticky slot immediately.

Requests made through a session are listed in Requests with the session id on the detail page.

); }