You need to ship a JavaScript integration that returns daily, weekly, or dated horoscopes without wrestling with scattered sources or custom scrapers. By the end of this guide, you’ll query the Horoscope API on Zyla API Hub from JavaScript, parse its JSON, and plug it into your UI or workflow with confidence.
What you can build with the Horoscope API
The Horoscope API serves text horoscopes for supported sun signs across multiple timeframes. You can:
- Fetch today’s horoscope for a specific sun sign.
- Retrieve weekly or monthly horoscopes, or day-of-week variants.
- Get historical or specific-date content for a sun sign.
- Check which sun signs and timeframes are available.
Common use cases include onboarding flows in lifestyle apps, widgets on content sites, CRM nudges based on users’ sun signs, and chat assistant prompts that enrich user sessions with fresh horoscope text.
Getting started on Zyla API Hub
Zyla API Hub centralizes more than 10,000 public APIs under one account, one API key, and a single subscription model. To start:
- Open the Horoscope API page on Zyla.
- Click Subscribe (or Start Free Trial when available). On Zyla, the first API typically offers a 7-day trial or 50 requests. Check the API page for current access options and pricing. There is no Free Plan for production use.
- Copy your API key and use it with the Authorization header shown below.
Auth format for every call: Authorization: Bearer YOUR_API_KEY
Endpoints you’ll use
The Horoscope API exposes three HTTP GET endpoints on Zyla Hub. All requests require the Authorization header. If a parameter is not listed below, do not include it.
1) Get Horoscope
Retrieve today’s, weekly, monthly, or day-of-week horoscope for a given sun sign and timeframe.
- Method: GET
- URL: https://zylalabs.com/api/891/horoscope-api/694/get-horoscope
- Required query parameters:
- sunsign (string): gemini
- timeframe (string): daily
- Description: Get today's, weekly, monthly, and any day of the week. Declare the sign and the horoscope that you want to retrieve. Use the Symbols endpoint to check the supported timeframes and the sun signs.
Official cURL example:
curl -s -X GET "https://zylalabs.com/api/891/horoscope-api/694/get-horoscope?sunsign=gemini&timeframe=daily" \
-H "Authorization: Bearer YOUR_API_KEY"
Official JSON response:
{
"status": 200,
"success": true,
"sunSigns": "gemini",
"timeFrames": "daily",
"Horoscope": "September 2, 2026 - Is it time to serve up those walking papers? With the moon in your twelfth house of healing and closure, the moment has come to cut ties with a toxic situation. That's never as easy as it sounds, so lean on the people who have your back, whether that’s a relative or a member of your chosen family. The moon is forming a supportive trine to Mercury in your homey fourth house, which puts self-care near the top of your priorities today. Considering a move? Scroll the listings on your lunch break, but sleep on anything that requires a signature."
}
What to read from this payload:
- status and success: quick sanity checks for your integration.
- sunSigns and timeFrames: echo of your request context.
- Horoscope: the text content to render in your UI.
2) Get Symbols
Check supported sun signs and available timeframes.
- Method: GET
- URL: https://zylalabs.com/api/891/horoscope-api/2450/get-symbols
- Request params: none documented.
- Description: Returns arrays of sun signs and timeframes that you can pass to Get Horoscope or By Date.
Official cURL example:
Official JSON response:
3) By Date
Retrieve today’s and past horoscopes by specific date.
- Method: GET
- URL: https://zylalabs.com/api/891/horoscope-api/3527/by-date
- Required query parameters:
- sunsign (string): gemini
- date (string): 2024-01-02
- Description: Use when you need deterministic content for a given sun sign and date.
Official cURL example:
Official JSON response:
JavaScript integration: fetch in under 10 lines
The following example calls Get Horoscope for Gemini, daily timeframe. It includes minimal error handling and extracts the fields you’ll render. Replace YOUR_API_KEY before running.
// JavaScript (Node.js or modern browsers)
// Endpoint: Get Horoscope (daily Gemini)
const url = "https://zylalabs.com/api/891/horoscope-api/694/get-horoscope?sunsign=gemini&timeframe=daily";
async function getDailyGemini() {
const res = await fetch(url, {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
if (!res.ok) {
// Non-2xx HTTP status: log or throw
const text = await res.text();
throw new Error(`HTTP ${res.status}: ${text}`);
}
const data = await res.json();
if (!data.success) {
throw new Error("API returned success=false");
}
// Fields available per sample:
const sign = data.sunSigns; // "gemini"
const frame = data.timeFrames; // "daily"
const text = data.Horoscope; // Horoscope text content
return { sign, frame, text };
}
// Example usage:
getDailyGemini()
.then(({ sign, frame, text }) => {
console.log(`[${sign} | ${frame}]`);
console.log(text);
})
.catch(err => {
console.error("Horoscope fetch failed:", err.message);
});
Notes for production use
- Authentication: Always pass Authorization: Bearer YOUR_API_KEY. Do not embed your key in client-side code without considering exposure; proxy calls via your backend if needed.
- Caching: Daily, weekly, and monthly content does not change intraday in most implementations; cache responses per sunsign/timeframe to reduce calls and latency. Expire caches based on timeframe granularity (e.g., daily cache resets at your chosen rollover time). For By Date, cache indefinitely for immutable dates.
- Parameters: Only send the documented parameters:
- Get Horoscope: sunsign, timeframe.
- Get Symbols: none.
- By Date: sunsign, date.
- Text handling: The Horoscope field is plain text. Render as-is or sanitize/format in your UI. Treat single quotes and punctuation as normal text; avoid double-encoding HTML entities.
- Internationalization: The response language is English per the samples. If you localize, translate on your side.
End-to-end workflow: verifying inputs, then fetching content
Before requesting a horoscope, validate the input against Get Symbols to prevent invalid sun signs or unsupported timeframes. A simple flow:
- Call Get Symbols once at startup and store sunSigns/timeFrames in memory.
- Validate user selections against those arrays.
- Call Get Horoscope or By Date with the validated inputs.
Example validation logic (pseudo-steps):
- symbols.sunSigns.includes(userSign.toLowerCase())
- symbols.timeFrames.includes(userFrame.toLowerCase())
If you support historical reads, store valid dates as ISO strings (YYYY-MM-DD) and pass them to By Date exactly as shown in the sample request.
Practical use cases you can ship this week
- Onboarding personalization: Ask for a user’s sun sign on account creation. Store their preference and show daily or weekly content in the dashboard via Get Horoscope.
- Email or push digests: Generate a once-a-day digest for all users grouped by sun sign. Cache responses per sunsign/timeframe to keep calls low, then fan out notifications.
- Chat widgets and assistants: When a user asks for “Gemini for today,” call Get Horoscope with timeframe=daily and stream the Horoscope field into the chat.
- Historical comparisons: Let users pick a past date and compare it to today using By Date for the old entry and Get Horoscope for the current one.
- Editorial modules: Build a CMS block that selects timeframe=weekend on Fridays to display relevant content without manual updates.
cURL quick starts you can copy
Get Symbols (recommended first call)
Get Horoscope (daily Gemini)
By Date (Gemini on 2024-01-02)
Call the Horoscope API from an AI agent via MCP
If you’re orchestrating prompts or tools in an MCP-compatible client (Claude Code, Cursor, Windsurf, etc.), you can call Zyla APIs as tools through the MCP endpoint. Point your agent to:
Endpoint: https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
From there, your agent can invoke the Horoscope API using the same Hub paths and Authorization semantics behind the scenes. For setup details, see the MCP documentation. This approach keeps your API key centralized and lets your agent integrate across multiple Zyla APIs without custom HTTP glue.
Operational guidance and gotchas
- Subscription model: Zyla uses subscription + quota, not pay-per-call. The first API typically offers a 7-day trial or 50 requests. Always check the API page for current access options and pricing.
- No Free Plan: For production, you’ll need an active subscription. Handle quota exhaustion in your code and degrade gracefully (e.g., cached content or a neutral message).
- Idempotence: GET calls are safe to retry on transient network failures. Consider exponential backoff and a small jitter if you implement retries.
- Timeframes: The Symbols endpoint lists valid values like daily, weekly, monthly, and weekdays. Don’t assume alternates (e.g., “today” or “tomorrow”) unless listed by Get Symbols.
- Date format: For By Date, pass an ISO date string (YYYY-MM-DD) as shown. Avoid locale-specific formats.
- Content moderation: The Horoscope field is plain text. If your app has content policies, moderate or filter on your side.
Where to find this API and thousands more
The Horoscope API lives on Zyla alongside thousands of other ready-to-use APIs for finance, data enrichment, AI, geolocation, e-commerce, and utilities. One account, one key, one subscription model simplifies integration and billing across your stack. Explore the Horoscope API page, then head over to Zyla API Hub to find additional services to compose into your app.
FAQ
How do I authenticate?
Send the header Authorization: Bearer YOUR_API_KEY with every request to the Hub URLs shown above.
Which sun signs and timeframes are supported?
Call Get Symbols. It returns arrays for sunSigns and timeFrames you can use to validate inputs before calling Get Horoscope or By Date.
Can I retrieve a specific date’s horoscope?
Yes. Use the By Date endpoint with sunsign and date (YYYY-MM-DD) exactly as documented.
How should I cache responses?
Cache per sunsign and timeframe. Daily content can be cached for a day, weekly for a week, monthly for a month. For By Date, cache indefinitely for immutable past dates.
Is there a free plan?
There is no Free Plan. Your first API typically offers a 7-day trial or 50 requests. Check the API page for current access options and pricing.
Ready to implement this in your app? Create your Zyla account, get an API key, and hit the endpoints above in minutes. Register now and start building.