Skip to content
96Astro API

By topic / React and Next.js

Integrations

Astrology API for React and Next.js

In Next.js, call the API from a route handler or a server component, where the key stays on the server, and render the JSON in your components. For a ready-made panel in any React app, add a widget: one script tag and a div.

Ideas

What people build with it

  • A kundli page in a Next.js site

  • A panchang widget on a React landing page

  • A matching form with server-side scoring

Reference

The endpoints

Try them in API testing

Code

Your first call

app/api/chart/route.ts
export async function POST(request: Request) {
  const birth = await request.json(); // { datetime, timezone, latitude, longitude }
  const res = await fetch("https://api.96astroapi.com/v1/vedic-charts/planet-positions", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.ASTRO_API_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify(birth),
  });
  return Response.json(await res.json(), { status: res.status });
}

FAQ

Common questions

Is there a React component library?

The widgets work in React, Vue, Angular and Svelte: add the script once and a div where the panel goes.

Guides

Read next

Start building with React and Next.js

5,000 free trial credits. No card required.

Send us feedback

What is it about?