AstroNirnayDeveloper API

Developer kit

Start in minutes. Import the Postman collection to try every endpoint, or drop a single dependency-free file into your project. All of it is generated from the live API, so it always matches what is deployed (31 endpoints today).

Read the API docs Get a free key

Postman collection

Every endpoint with a ready example body, plus a test that checks for HTTP 200 and success: true.

Download collection

  1. In Postman choose Import and pick the downloaded file.
  2. Open the collection, then its Variables tab.
  3. Paste your key into apiKey and save.
  4. Open any request and press Send.

Python

One file, Python 3.7+, no packages to install. Retries rate limits for you.

Download astronirnay.py

from astronirnay import AstroNirnay

client = AstroNirnay("YOUR_API_KEY")
chart = client.chart({"birth": {
    "date": "1990-05-15", "time": "10:30",
    "latitude": 19.076, "longitude": 72.8777,
    "timezone": "Asia/Kolkata"}})
print(chart["ascendant"]["sign"])
print(client.credits_remaining)

JavaScript / Node

One file, Node 18+ (also Deno and Bun). Uses the built-in fetch.

Download astronirnay.js

const { AstroNirnay } = require("./astronirnay");

const client = new AstroNirnay("YOUR_API_KEY");
const chart = await client.chart({ birth: {
  date: "1990-05-15", time: "10:30",
  latitude: 19.076, longitude: 72.8777,
  timezone: "Asia/Kolkata" } });
console.log(chart.ascendant.sign);
console.log(client.creditsRemaining);

PHP

One file, PHP 7.4+ with the curl extension. No Composer needed.

Download astronirnay.php

<?php
require "astronirnay.php";

$client = new AstroNirnay\Client("YOUR_API_KEY");
$chart = $client->chart(["birth" => [
    "date" => "1990-05-15", "time" => "10:30",
    "latitude" => 19.076, "longitude" => 72.8777,
    "timezone" => "Asia/Kolkata"]]);
echo $chart["ascendant"]["sign"];
echo $client->creditsRemaining;

Plain cURL

curl -X POST https://api.astronirnay.com/v1/chart \
  -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{"birth":{"date":"1990-05-15","time":"10:30","latitude":19.076,"longitude":72.8777,"timezone":"Asia/Kolkata"}}'

Use it from AI assistants (MCP)

Let Claude, Cursor or any MCP-compatible assistant calculate charts, dashas, panchang and matching for you. Every API endpoint is a tool (30 tools), and calls use your own key, credits and rate limit, exactly like normal API calls. The calculations stay deterministic, with no AI inside.

Server address: https://api.astronirnay.com/mcp  ·  Header: x-api-key: YOUR_API_KEY

Claude Code (one command)

claude mcp add --transport http astronirnay https://api.astronirnay.com/mcp   --header "x-api-key: YOUR_API_KEY"

Cursor (~/.cursor/mcp.json) and other clients that accept a URL and headers

{
  "mcpServers": {
    "astronirnay": {
      "url": "https://api.astronirnay.com/mcp",
      "headers": { "x-api-key": "YOUR_API_KEY" }
    }
  }
}

Then ask in plain words: "Make a birth chart for 15 May 1990, 10:30 am in Mumbai and tell me the current Vimshottari dasha." The assistant looks up the place, calls the tools and explains the result. It works with any MCP client that supports remote servers with custom headers.

Good to know. Time is 24-hour (22:30 for 10:30 pm). Keep your key on your server, never inside a website or mobile app. Each successful call spends a few credits and failed calls cost nothing. Add lang: "hi" to a request to get Hindi names next to the English ones (fields ending in _local, such as sign_local). Errors raise AstroNirnayError (Python and JavaScript) or AstroNirnay\ApiException (PHP) with the status, code, message and request id.