Choghadiya API with Express

Integrate Choghadiya API in Express. Complete code examples and SDK documentation.

Operation

POST /v2/astrology/choghadiya

Day and night choghadiya periods for the date and place, with sunrise, sunset and guidance.

Send datetime (or date with time) together with latitude and longitude, or send an empty object: with no birth fields the current moment in New Delhi is used. Sending some birth fields without the rest returns 400.

Parameters

NameInTypeDescription
datetimebodystringDate and time the calculation is for, in ISO 8601, for example 1990-05-15T10:30:00+05:30. Send this, or date with time.
datebodystringDate as YYYY-MM-DD. Used when datetime is not sent.
timebodystringTime as HH:MM, used with date. Defaults to 12:00 when omitted.
latitudebodynumberLatitude of the place in decimal degrees, -90 to 90. Alias lat. Send it together with longitude.
longitudebodynumberLongitude of the place in decimal degrees, -180 to 180. Aliases lon, lng, long. Send it together with latitude.
timezonebodystringIANA zone name or UTC offset such as +05:30. Inferred from the coordinates when omitted.

Request example for Express

Authenticate with Authorization: Bearer YOUR_API_KEY. Keep the key in the VEDIKA_API_KEY environment variable on your server and never in source control.

import express from 'express';

const app = express();

async function callVedika() {
  const upstream = await fetch('https://api.vedika.io/v2/astrology/choghadiya', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.VEDIKA_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "datetime": "1990-05-15T10:30:00+05:30",
      "latitude": 28.6139,
      "longitude": 77.209,
      "timezone": "Asia/Kolkata"
    }),
  });
  return { status: upstream.status, data: await upstream.json() };
}

app.get('/vedika/choghadiya', async (_req, res) => {
  const { status, data } = await callVedika();
  res.status(status).json(data);
});

app.listen(3000);

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/choghadiya \
  -H "Content-Type: application/json" \
  -d '{"datetime":"1990-05-15T10:30:00+05:30","latitude":28.6139,"longitude":77.209,"timezone":"Asia/Kolkata"}'

Sandbox response from POST /sandbox/astrology/choghadiya, 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": {
    "currentPeriod": null,
    "date": "1995-01-01",
    "day": [
      {
        "avoid": [
          "Auspicious ceremonies"
        ],
        "choghadiya": {
          "bestFor": "Government work, meeting officials, and administrative tasks",
          "element": "Fire",
          "id": 7,
          "lord": "Sun",
          "meaning": "Anxiety - Sun-ruled period",
          "name": "Udveg",
          "vpiType": "bad"
        },
        "duration": 77.73541666666667,
        "end": "1995-01-01T03:01:19.125Z",
        "id": 1,
        "isDay": true,
        "recommendations": [
          "Government related work"
        ],
        "start": "1995-01-01T01:43:35.000Z"
      }
    ],
    "guidance": {
      "nextGoodTime": "All auspicious periods for today have passed.",
      "summary": "Check the periods above to find the current Choghadiya.",
      "tip": "This is a neutral period. Proceed with regular activities but avoid major decisions."
    },
    "latitude": 28.6139,
    "longitude": 77.209,
    "nextAuspicious": null,
    "nextSunrise": "1995-01-02T01:43:51Z",
    "night": [
      {
        "avoid": [],
        "choghadiya": {
          "bestFor": "Religious ceremonies, education, financial planning, and meeting elders",
          "element": "Earth",
          "id": 2,
          "lord": "Jupiter",
          "meaning": "Auspicious - Blessed by Jupiter",
          "name": "Shubh",
          "vpiType": "good"
        },
        "duration": 102.29791666666667,
        "end": "1995-01-01T13:47:45.875Z",
        "id": 1,
        "isDay": false,
        "recommendations": [
          "Religious ceremonies"
        ],
        "start": "1995-01-01T12:05:28.000Z"
      }
    ],
    "vapiTimeDetails": {
      "sunrise": "1995-01-01T01:43:35.000Z",
      "sunset": "1995-01-01T12:05:28.000Z"
    }
  },
  "meta": {
    "contentMode": "fixture",
    "engine": "vedika-intelligence",
    "fixtureId": "demo-birth-1995-new-delhi",
    "inputUsage": "ignored",
    "mode": "sandbox",
    "sample": true,
    "version": "2.1.0"
  },
  "success": true
}

Related

The same endpoint in other stacks:

Last updated: 22 November 2026

Start 14-day trial