Guide

Add a birth-place search

From a search box on your birth-details form to coordinates and the right UTC offset for the chart, in three steps.

Step 1 · Add your websites

  1. 1. In API keys, click Edit on your key and list your websites, e.g. https://example.com and http://localhost:3000 for testing.
  2. 2. Copy the website key shown there. It works only for the Geo Location API and only from those websites, so it can go in your page. Your main key stays on your server.

Step 2 · Drop in the widget

Paste the script under your birth-place input. It shows suggestions as the user types, fills the hidden latitude, longitude and timezone fields, and fires geo:select with the chosen place. It uses one session per search, so the keystrokes of one search are charged once. Prefer your own UI? Call /v1/geo/search with a session token instead.

<!-- Your website key: works only for the Geo API, only from the websites you listed. -->
<input id="birth-place" placeholder="Birth place">
<input type="hidden" id="lat" name="latitude">
<input type="hidden" id="lon" name="longitude">
<input type="hidden" id="tz" name="timezone">

<script src="https://astrologyapis.ratnoveda.com/geo-widget.js"
        data-key="YOUR_WEBSITE_KEY"
        data-input="#birth-place"
        data-lang="hi"
        data-country="IN"
        data-lat="#lat" data-lon="#lon" data-tz="#tz"></script>
<script>
  document.querySelector("#birth-place").addEventListener("geo:select", (e) => {
    console.log(e.detail); // the chosen Place
  });
</script>

Step 3 · Send the place to the chart APIs

Send the place's latitude, longitude and its timezone name (e.g. "timezone": "Asia/Kolkata") with the birth date and time. The chart APIs apply the UTC offset that was in force on that date and time, so a Delhi birth in 1943 gets +06:30 by itself.

Need the offset as a number, for example to show it? A place's utc_offset is today's; ask /v1/geo/timezone with the coordinates and the local birth time for the birth date's offset.

curl 'https://astrologyapis.ratnoveda.com/v1/geo/timezone?lat=28.6139&lon=77.209&datetime=1943-05-10T10:30' \
  -H 'X-API-Key: YOUR_API_KEY'
  • • Store the place's label, coordinates and timezone with the birth details, so the chart can be made again later without another search.
  • • Read why the date matters in Birth data & timezones.