Quickstart

1. Get a test key

Create a free account, open API keys and create a test key. It starts with al_test_. Copy it when it is shown: we keep only a hash, so it is shown once.

Test keys run the real engine and are never charged. Each project has a daily allowance of test calls (rate limits).

2. Make your first call

This asks for the kundli of someone born in New Delhi on 13 August 1990 at 06:30. Replace al_test_YOUR_KEY with your key.

curl

curl -X POST 'https://api.astrologics.in/v1/kundli' \
  -H 'Authorization: Bearer al_test_YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"birth":{"date":"1990-08-13","time":"06:30","place":{"latitude":28.6139,"longitude":77.209}}}'

Node.js 18 or later

Save as first-call.mjs and run node first-call.mjs.

const res = await fetch("https://api.astrologics.in/v1/kundli", {
  method: "POST",
  headers: { Authorization: "Bearer al_test_YOUR_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({
    "birth": {
      "date": "1990-08-13",
      "time": "06:30",
      "place": {
        "latitude": 28.6139,
        "longitude": 77.209
      }
    }
  }),
});
console.log(JSON.stringify(await res.json(), null, 2));

Python 3

Save as first-call.py and run python3 first-call.py.

import json
import urllib.error
import urllib.request

body = {
    "birth": {
        "date": "1990-08-13",
        "time": "06:30",
        "place": {
            "latitude": 28.6139,
            "longitude": 77.209,
        },
    },
}

req = urllib.request.Request(
    "https://api.astrologics.in/v1/kundli",
    method="POST",
    headers={"Authorization": "Bearer al_test_YOUR_KEY", "Content-Type": "application/json"},
    data=json.dumps(body).encode(),
)
try:
    with urllib.request.urlopen(req) as res:
        print(json.dumps(json.load(res), indent=2, ensure_ascii=False))
except urllib.error.HTTPError as err:
    print(err.code, err.read().decode())

PHP with the curl extension

Save as first-call.php and run php first-call.php.

<?php
$ch = curl_init('https://api.astrologics.in/v1/kundli');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer al_test_YOUR_KEY', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"birth":{"date":"1990-08-13","time":"06:30","place":{"latitude":28.6139,"longitude":77.209}}}',
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch), PHP_EOL;

3. Read the response

Every JSON response has the same envelope:

  • data: the result.
  • meta: request_id (quote it when you write to us), engine_version (it changes whenever a calculation changes), mode (test or live) and credits_charged.
  • warnings: anything you should know, such as fields left out because the birth time is unknown.

Errors have one shape too: see errors.

4. Go live

Create a live key when you are ready. Live keys spend your plan's credits, and only successful (2xx) calls are charged. Keep test and live keys on your server: never put them in a web page or a mobile app. For widgets, use a publishable key.

Next: the birth object · API reference