# Find AI-cited sources with Next.js

Send a query to the Getspotted API from Next.js and get back the sources AI engines (ChatGPT, Claude, Perplexity, Gemini) and Google cite for it, per country. Authenticate with Authorization: Bearer gsp_live…

## Call the API

```typescript
// app/api/sources/route.ts (server-side — keep your key secret)
export async function GET() {
  const res = await fetch("https://getspotted.ai/api/v1/search", {
    method: "POST",
    headers: {
      authorization: `Bearer ${process.env.GETSPOTTED_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({ query: "best CRM for B2B SaaS", country: "US" }),
  });
  return Response.json(await res.json());
}
```

Each search costs 10 credits. The response shape is`{ success, data: { sources, hotspots, enginesQueried } }` — every source lists the engines that cited it and its per-engine position.

## Next steps

[API referenceEvery endpoint and field.](/content/docs/api-reference/index.html) [MCP serverCall it from an AI agent instead.](/content/mcp/index.html)

## Other languages

[cURLQuickstart](/content/docs/quickstart/curl/index.html) [JavaScriptQuickstart](/content/docs/quickstart/javascript/index.html) [PythonQuickstart](/content/docs/quickstart/python/index.html) [GoQuickstart](/content/docs/quickstart/go/index.html)
