Birth Chart API with Nextjs

Integrate Birth Chart API in Nextjs. Complete code examples and SDK documentation.

Operation

POST /v2/astrology/birth-chart

Generate a Vedic birth chart (planets, signs, houses) from birth details

Parameters

NameInTypeDescription
datetimebodystring—
latitudebodynumber—
longitudebodynumber—
timezonebodystring—
ayanamsabodystring—

Request example for Next.js

Authenticate with Authorization: Bearer YOUR_API_KEY. The route file runs on the server and reads the key from the VEDIKA_API_KEY environment variable. Client code calls only your own route; never import the key into a client bundle.

// app/api/vedika/birth-chart/route.ts (server only)
export async function GET() {
  const upstream = await fetch('https://api.vedika.io/v2/astrology/birth-chart', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.VEDIKA_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "datetime": "1990-05-15T10:30:00",
      "latitude": 19.07,
      "longitude": 72.87,
      "timezone": "+05:30",
      "ayanamsa": "lahiri"
    }),
  });
  return new Response(await upstream.text(), {
    status: upstream.status,
    headers: { 'Content-Type': 'application/json' },
  });
}

// In a client component, call your own route. The key never reaches the browser:
const data = await (await fetch('/api/vedika/birth-chart')).json();

Try it in the keyless sandbox

The sandbox mirrors the production route and needs no API key:

curl -X POST https://api.vedika.io/sandbox/astrology/birth-chart \
  -H "Content-Type: application/json" \
  -d '{"datetime":"1990-05-15T10:30:00","latitude":19.07,"longitude":72.87,"timezone":"+05:30","ayanamsa":"lahiri"}'

Sandbox response from POST /sandbox/astrology/birth-chart, abridged (billing block, long text fields and long lists trimmed). The sandbox answers with a fixed demo result and ignores your inputs; a production call computes the result for the details you send.

{
  "data": {
    "ascendant": {
      "degree": 13.55,
      "fullDegree": 343.55,
      "interpretation": {
        "career": [
          "Arts"
        ],
        "challenges": [
          "Escapism"
        ],
        "compatibility": [
          "Cancer"
        ],
        "element": "Water",
        "quality": "Dual (Mutable)",
        "strengths": [
          "Intuition"
        ]
      },
      "nakshatra": {
        "deity": "Ahirbudhnya",
        "id": 26,
        "lord": "Saturn",
        "name": "Uttara Bhadrapada",
        "pada": 4
      },
      "sign": "Pisces",
      "signLord": "Jupiter"
    },
    "ayanamsa": {
      "id": 1,
      "name": "Lahiri",
      "value": 23.79065
    },
    "birth_details": {
      "coordinates": {
        "latitude": 28.6139,
        "longitude": 77.209
      },
      "datetime": "1995-01-01T12:00:00+05:30",
      "timezone": "Asia/Kolkata"
    },
    "chart": {
      "format": "svg",
      "size": {
        "height": 400,
        "width": 400
      }
    },
    "houses": [
      {
        "cusp": 330,
        "degree": 0,
        "id": 1,
        "interpretation": {
          "governs": [
            "Self"
          ],
          "karaka": "Sun",
          "name": "Lagna (Ascendant)",
          "significance": "Self, personality, physical body, and overall life direction. The most important house."
        },
        "lord": "Jupiter",
        "number": 1
      }
    ],
    "moonSign": "Sagittarius"
  },
  "meta": {
    "contentMode": "fixture",
    "engine": "vedika-intelligence",
    "fixtureId": "demo-birth-1995-new-delhi",
    "inputUsage": "ignored",
    "mode": "sandbox",
    "sample": true
  },
  "success": true
}

Related

The same endpoint in other stacks:

Last updated: 22 November 2026

Start 14-day trial