Astrology · 4 min read
How to use the Astrology API in Python & JavaScript
Horoscope content is daily-return traffic gold, but writing it never ends. The Astrology API returns stable, ready-to-display readings from one call.
By DataNest · Published May 2026
What the Astrology API does
Horoscopes for all 12 zodiac signs — daily, weekly and monthly readings with ratings, lucky number, colour, gem and time, full sign profiles, date-to-sign lookup, and compatibility scoring. Stable per day, clean JSON. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.
When to use it
The example request
GET https://astrology-api-by-datanest.p.rapidapi.com/horoscope/leo?sign=leo&day=todayExample JSON response
An illustrative response body — run the live demo for the real thing.
{
"sign": "Leo",
"symbol": "♌",
"date": "2026-05-18",
"day": "today",
"horoscope": "Today asks you to trust your instincts. Romance favours the bold — a small gesture goes a long way. A mentor's advice proves unexpectedly valuable.",
"ratings": {
"overall": 4,
"love": 5,
"career": 3,
"health": 4,
"money": 3
},
"mood": "Inspired",
"lucky_number": 27,
"lucky_color": "Gold",
"lucky_time": "11:30 AM",
"lucky_gem": "Ruby",
"compatible_sign": "Aquarius",
"element": "Fire",
"ruling_planet": "Sun"
}Common parameters
Every request also needs your RapidAPI auth headers.
| Parameter | In | Required | Example |
|---|---|---|---|
| sign | path | Yes | leo |
| day | query | Yes | today |
| x-rapidapi-key | header | Yes | YOUR_RAPIDAPI_KEY |
| x-rapidapi-host | header | Yes | astrology-api-by-datanest.p.rapidapi.com |
Step by step
1. Subscribe and get your key
Open the Astrology API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.
2. Call the endpoint
The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.
3. Try it without code first
The Astrology page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.
4. Integrate and cache
Call it from your backend and cache responses where it makes sense. Most responses change slowly, so even a daily cache keeps you well within the free tier.
Quick-start code
curl --request GET \
--url 'https://astrology-api-by-datanest.p.rapidapi.com/horoscope/leo?day=today' \
--header 'x-rapidapi-host: astrology-api-by-datanest.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'What you can build
Daily horoscope app
Show every sign's reading, ratings and lucky picks with one /daily-all call.
Compatibility tool
Score any two signs across love, friendship and communication for a match feature.
Horoscope widget
Embed a stable daily reading on a blog or homepage — same per day, cache-friendly.
Wrapping up
If your project needs horoscope apps, the Astrology API removes the part nobody enjoys building. It's one of 25 in the DataNest collection — grab a free key and make your first call.
Share this guide
Related guides
How to use the Crypto Intelligence API in Python & JavaScript
Real-time crypto trading signals — BUY/SELL/HOLD based on RSI, MACD & trend analysis.
How to use the Stock Market API in Python & JavaScript
Real-time quotes, analyst ratings, earnings & market movers for 50,000+ tickers.
How to use the Weather API in Python & JavaScript
Simple, lightweight weather — current conditions, 7-day forecasts & air quality.
Astrology updates
New Astrology guides and endpoint updates, occasionally.