Hora API with React

Integrate Hora API in React. Complete code examples and SDK documentation.

Operation

POST /v2/astrology/hora

Planetary hours for the day and place: 12 day and 12 night periods, each with its ruling planet and times.

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 React

Authenticate with Authorization: Bearer YOUR_API_KEY. This code runs on your users’ devices, so it must not hold your API key. Call a route on your own backend that adds the Authorization: Bearer YOUR_API_KEY header and forwards the request. The server-side pages linked below show such a route.

import { useEffect, useState } from 'react';

export function Hora() {
  const [data, setData] = useState(null);

  useEffect(() => {
    fetch('/api/vedika/hora')
      .then((res) => res.json())
      .then(setData);
  }, []);

  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}

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/hora \
  -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/hora, 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": {
    "currentHora": null,
    "date": "1995-01-01",
    "dayLord": "Sun",
    "guidance": {
      "currentEnergy": "Unknown",
      "nextGoodTime": "All benefic horas for today have passed.",
      "recommendation": "This is a neutral hora. Proceed with regular activities while being mindful of the planetary influence.",
      "summary": "Check the periods above to find the current Hora.",
      "tip": "Select a hora to see guidance."
    },
    "hora": [
      {
        "associations": {
          "color": "Golden/Orange",
          "direction": "East",
          "element": "Fire",
          "gemstone": "Ruby",
          "metal": "Gold"
        },
        "avoid": [
          "Secret activities"
        ],
        "duration": 51.8236,
        "end": "1995-01-01T02:35:24.416Z",
        "id": 1,
        "isDay": true,
        "lord": {
          "bestFor": "Government work, meeting officials, leadership activities, medical treatments",
          "energy": "Authoritative, confident, radiant",
          "id": 4,
          "name": "Sun",
          "tip": "This is an excellent time to present yourself in an official capacity or seek recognition for your efforts.",
          "vedic_name": "Surya"
        },
        "nature": "neutral",
        "qualityScore": 6,
        "start": "1995-01-01T01:43:35.000Z"
      }
    ],
    "latitude": 28.6139,
    "longitude": 77.209,
    "nextBeneficHora": null,
    "nextSunrise": "1995-01-02T01:43:51Z",
    "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