Skip to content
BestAstroAPI

Build with AI

Pick your AI and copy one prompt.

1. What do you need?
2. Which AI do you use?
4. Copy the prompt
Build this with BestAstroAPI (an astrology API: Vedic, Western, horoscopes, tarot): [write what you want, for example a kundli website]

1. Read https://bestastroapi.in/llms.txt first. Use only the endpoints and fields written there.
2. Base URL: https://api.bestastroapi.in. Send my key in the x-api-key header.
3. Keep the key on the server as BESTASTRO_KEY. Never put it in browser code, a mobile app or Git.
4. Birth place: let the user search and pick a place (GET /v1/places/search), then send its id as place_id.
5. Show only what the API returns. Do not calculate or invent astrology.
6. On an error, show error.message next to the field. On 429, wait for Retry-After.
7. Make it work well on a phone and with a keyboard.
8. Test with 18 May 2004, 10:30, New Delhi: lagna Cancer, Moon in Aries, Bharani nakshatra.
9. Work in this project. Run it and test it before you say it is done.
Optional: let Claude Code call the API itself.
claude mcp add --transport http bestastroapi https://api.bestastroapi.in/mcp \
  --header "x-api-key: YOUR_API_KEY"

What the API covers

Moving from another API? The migration guide keeps your code as it is.

Quickstart without AI

1. Get a key

  • Sign in with your phone number.
  • Open API keys and create one. It is shown once.
  • Save it as an environment variable:
export BESTASTRO_KEY="paste-your-key"

2. Make the first call

A full kundli for 18 May 2004, 10:30, New Delhi:

curl -X POST "https://api.bestastroapi.in/v1/kundli" \
  -H "x-api-key: $BESTASTRO_KEY" \
  -H "content-type: application/json" \
  -d '{"datetime":"2004-05-18T10:30","lat":28.6139,"lon":77.209,"tz":"Asia/Kolkata"}'
  • curl: macOS, Linux or Git Bash.
  • JavaScript: save as first.mjs, run node first.mjs (Node 18 or newer).
  • Python: pip install requests first.

3. Read the result

summary
{
  "gana": "Manushya",
  "lagna": "Cancer",
  "nadi": "Madhya",
  "nakshatra": "Bharani",
  "pada": 3,
  "rashi": "Aries",
  "sun_sign": "Taurus",
  "varna": "Kshatriya",
  "yoni": "Elephant"
}
  • summary: lagna, rashi and nakshatra in short.
  • planets: every planet with sign, house and nakshatra.
  • dasha.current: mahadasha, antardasha, pratyantardasha.
  • All fields: Kundli bundle. Error codes: Errors.

Base URL

https://api.bestastroapi.in

Birth input

Most endpoints take the same fields:

FieldWhat to send
datetimeLocal birth time, like 2004-05-18T10:30. Do not convert to UTC.
placeA name, like Gorakhpur, Uttar Pradesh. We add coordinates and time zone.
or place_idThe id the user picked in place search.
or lat, lon, tzDegrees (north and east positive) and a zone like Asia/Kolkata.
optionalayanamsa, node, house_system, outer_planets

If several places share a name, you get ambiguous_place with the choices.

Conventions

  • Dates: 1850 to 2149.
  • Ayanamsa: Lahiri (true) by default. Nodes: mean by default. Houses: whole sign.
  • Sunrise: upper limb of the Sun, with refraction.
  • Vara: from sunrise to sunrise.
  • Vimshottari year: 365.2425 days.
  • Times: local with offset, like 2026-11-22T06:48:52+05:30.
  • Signs: 1 = Aries to 12 = Pisces.
  • A missing or null field means it does not apply.

Accuracy

Largest difference in our own tests. Not audited by a third party.

  • Planets 0.7″, Moon 1.5″, ascendant 0.2″.
  • Sunrise 0.03 seconds up to 60° latitude, 2.5 seconds nearer the poles.

Files

Welcome! How will you use it?

We'll show you what matters to you. You can switch any time at the top.