TypeScript SDK
Current version: 0.12.0
The official Asterwise TypeScript SDK provides typed access to all 131 public API endpoints. Works with Node.js and modern bundlers (Vite, webpack, esbuild).
Installation
npm install asterwise
Requirements: Node.js 18+
Quick start
import { createClient, createConfig, natalChart } from 'asterwise';
const client = createClient(createConfig({
baseUrl: 'https://api.asterwise.com',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
}));
const result = await natalChart({
client,
body: {
date: '1985-11-12',
time: '06:45',
location: 'Mumbai, India',
ayanamsa: 'lahiri',
},
});
console.log(result.data);
Get your API key from asterwise.com/dashboard.
Setup
Create the client once, in its own module, and pass it to every call.
Import from asterwise (functions, types and createClient) or
asterwise/client; the package exposes no other paths.
// asterwise.ts
import { createClient, createConfig } from 'asterwise';
export const client = createClient(createConfig({
baseUrl: 'https://api.asterwise.com',
headers: {
Authorization: `Bearer ${process.env.ASTERWISE_API_KEY}`,
},
}));
Errors
A call doesn't throw on an HTTP error; it returns error instead of data.
response is missing when no response arrived (a network failure), so read
it with ?.. Pass throwOnError: true to get a rejected promise instead.
import { natalChart } from 'asterwise';
import { client } from './asterwise.js';
const result = await natalChart({
client,
body: { date: '1985-11-12', time: '06:45', location: 'Mumbai, India' },
});
if (result.error) {
console.error(result.response?.status ?? 'no response', result.error);
} else {
console.log(result.data);
}
Examples
Vimshottari Dasha
import { dasha } from 'asterwise';
import { client } from './asterwise.js';
const result = await dasha({
client,
body: {
date: '1985-11-12',
time: '06:45',
location: 'Mumbai, India',
ayanamsa: 'lahiri',
levels: 2,
},
});
console.log(result.data);
Numerology profile
import { numerologyProfile } from 'asterwise';
import { client } from './asterwise.js';
const result = await numerologyProfile({
client,
body: {
name: 'Arjun Mehta',
date: '1985-11-12',
},
});
console.log(result.data);
Matchmaking
import { matchmaking } from 'asterwise';
import { client } from './asterwise.js';
const result = await matchmaking({
client,
body: {
person1: {
date: '1985-11-12',
time: '06:45',
location: 'Mumbai, India',
ayanamsa: 'lahiri',
},
person2: {
date: '1990-06-21',
time: '15:30',
location: 'Rome, Italy',
ayanamsa: 'lahiri',
},
},
});
console.log(result.data);
Horoscope
import { horoscopeDaily } from 'asterwise';
import { client } from './asterwise.js';
const result = await horoscopeDaily({
client,
path: { moon_sign: 'tula' },
});
console.log(result.data);
All available functions
Every endpoint has a function exported from asterwise. Key functions
include:
natalChart · dasha · yogas · doshas · matchmaking ·
matchmakingDashakoot · matchmakingPorutham · panchanga ·
panchangaCalendar · muhurta · varshaphal · prashna ·
remedies · gemstones · ashtakavarga · atmakaraka ·
ishtaDevata · kpChart · kpRulingPlanets · lalKitabChart ·
yoginiDasha · ashtottariDasha · charDasha · transits ·
gochar · sadeSati · dashaTransits · divisionalCharts ·
strength · nakshatra · chartSvg · numerologyProfile ·
numerologyCompatibility · lifePathPost · personalYearPost ·
luckyNumbersPost · numberMeaning · nameCorrection ·
businessName · chaldean · loShu · mobileNumberPost ·
vehicleNumberPost · horoscopeDaily · horoscopeWeekly ·
horoscopeMonthly · horoscopeYearly · geocode · timezone
lifePath, personalYear, luckyNumbers, mobileNumber and
vehicleNumber still exist for existing code but are deprecated: they
send personal data in the URL. Use the …Post versions, which return the
same result.