Horoscope API - Next.js Example
Daily horoscope request example, documented inputs, server-side authentication and integration checks.
Daily horoscope: request contract
This example requests a sign-based daily horoscope. Choose the documented sign value and date; this request does not produce a personalized birth-chart reading or a weekly forecast.
GET /v2/astrology/horoscope/daily · OpenAPI request and response schema
The values below are synthetic examples. They describe request wiring, rather than a measured result or an accuracy claim. Production requests use your account’s published billing terms; the sandbox provides fixed mock examples for development.
| Field | Location | Type | Schema requirement |
|---|---|---|---|
sign | query | string | Required by the request schema |
date | query | string | Optional in the request schema; provide it when your calculation needs it |
timezone | query | string | Optional in the request schema; provide it when your calculation needs it |
Make the request safely
Set VEDIKA_API_KEY in the trusted server or command-line environment. Keep that key out of browser bundles, mobile builds, URLs and shared logs. Your application exposes the sample backend route on its own origin. The browser and Flutter snippets use that route; the server supplies the production credential. For a deployed application, add your own user authentication, input validation and access limits around the feature.
Next.js server-only module: app/lib/vedika-example.js
import 'server-only';
// Import this function into your existing authenticated backend route.
export async function requestCalculation() {
const key = process.env.VEDIKA_API_KEY;
if (!key) throw new Error('Set VEDIKA_API_KEY on the server');
const response = await fetch("https://api.vedika.io/v2/astrology/horoscope/daily?sign=aries", {
method: 'GET',
headers: { 'Authorization': 'Bearer ' + key },
cache: 'no-store', redirect: 'error', signal: AbortSignal.timeout(20000)
});
if (!response.ok) throw new Error('Calculation failed: HTTP ' + response.status);
return response.json();
}Check the result before displaying it
- Validate the selected date, location and relevant calculation settings before making a production request.
- Check HTTP status and the operation-specific JSON schema. Keep errors and timeouts visible instead of displaying a previous or invented result.
- Retain only the inputs and result fields your feature needs. Use synthetic cases in public bug reports and avoid copying private birth details into logs.
- When caching, include every input that affects this operation and keep private results scoped to the appropriate user.
Continue with the quickstart, supported SDKs, current billing units and published technical evidence. Create production access through API-key signup.
Try the FREE Sandbox
978 mock operations for development. Production plans from $12/month.
Explore Sandbox →