Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Birth Chart API (Natal Chart API) by DivineAPI

Birth Chart API (Natal Chart API) by DivineAPI

The Birth Chart API (natal chart API) turns a birth date, time and place into a Western tropical natal chart as JSON. You get planetary positions, house cusps in 25 house systems (Placidus by default), an aspect table and a natal wheel chart as SVG and base64 image, ready for astrology apps, sites and reports.

Docs Trial Postman Status MCP

Verified live against the DivineAPI API on 2 October 2026.

Part of DivineAPI: 300+ endpoints across 8 domains, Western 60+. Calculations use Swiss Ephemeris under a commercial licence.


Quickstart (60 seconds)

1. Get your keys. Start the 14-day free trial (credit card required to activate the trial) at divineapi.com/start-trial, then copy your API key and auth token from the dashboard.

Every request is a POST with multipart/form-data, the auth token in the Authorization: Bearer header and the API key in the api_key form field.

Runnable files: examples/ (curl, Python, Node.js, PHP).

2. curl

curl -s -X POST "https://astroapi-4.divineapi.com/western-api/v1/planetary-positions" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -F "api_key=YOUR_API_KEY" \
  -F "full_name=Rahul Kumar" -F "day=24" -F "month=05" -F "year=2023" \
  -F "hour=14" -F "min=40" -F "sec=43" -F "gender=male" \
  -F "place=new delhi" -F "lat=28.7041" -F "lon=77.1025" -F "tzone=5.5" \
  -F "house_system=P"

3. Python (requests)

import requests

URL = "https://astroapi-4.divineapi.com/western-api/v1/planetary-positions"
birth = {
    "api_key": "YOUR_API_KEY",
    "full_name": "Rahul Kumar", "day": "24", "month": "05", "year": "2023",
    "hour": "14", "min": "40", "sec": "43", "gender": "male",
    "place": "new delhi", "lat": "28.7041", "lon": "77.1025", "tzone": "5.5",
    "house_system": "P",
}

resp = requests.post(
    URL,
    headers={"Authorization": "Bearer YOUR_AUTH_TOKEN"},
    files={k: (None, v) for k, v in birth.items()},  # multipart/form-data
    timeout=30,
)
body = resp.json()
if body.get("success") != 1:
    raise SystemExit(body)

for p in body["data"]:
    print(f'{p["name"]:<16} {p["sign"]:<12} {p["longitude"]:>9}  house {p["house"]}')

Node.js (18+, built-in fetch)

const URL = "https://astroapi-4.divineapi.com/western-api/v1/planetary-positions";

const birth = {
  api_key: "YOUR_API_KEY",
  full_name: "Rahul Kumar", day: "24", month: "05", year: "2023",
  hour: "14", min: "40", sec: "43", gender: "male",
  place: "new delhi", lat: "28.7041", lon: "77.1025", tzone: "5.5",
  house_system: "P",
};

async function main() {
  const form = new FormData();
  for (const [k, v] of Object.entries(birth)) form.append(k, v);

  const res = await fetch(URL, {
    method: "POST",
    headers: { Authorization: "Bearer YOUR_AUTH_TOKEN" },
    body: form,
  });
  const body = await res.json();
  if (body.success !== 1) throw new Error(JSON.stringify(body));

  for (const p of body.data) console.log(p.name, p.sign, p.longitude, "house", p.house);
}

main();

4. PHP (cURL)

<?php
$ch = curl_init("https://astroapi-4.divineapi.com/western-api/v1/planetary-positions");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer YOUR_AUTH_TOKEN"],
    CURLOPT_POSTFIELDS => [            // an array is sent as multipart/form-data
        "api_key" => "YOUR_API_KEY",
        "full_name" => "Rahul Kumar", "day" => "24", "month" => "05", "year" => "2023",
        "hour" => "14", "min" => "40", "sec" => "43", "gender" => "male",
        "place" => "new delhi", "lat" => "28.7041", "lon" => "77.1025", "tzone" => "5.5",
        "house_system" => "P",
    ],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);

if (($body["success"] ?? 0) !== 1) {
    exit("API error: " . json_encode($body["msg"] ?? $body));
}
foreach ($body["data"] as $p) {
    echo "{$p['name']} {$p['sign']} {$p['longitude']} house {$p['house']}\n";
}

Example response

Planetary positions (/western-api/v1/planetary-positions, live response, trimmed). The list also holds Mars to Pluto, the nodes, MC, Chiron, Part of fortune and Lilith.

{
  "success": 1,
  "data": [
    {
      "name": "Ascendant",
      "full_degree": "185.7194554",
      "sign": "Libra",
      "sign_no": 7,
      "longitude": "5:43:10",
      "speed": "317.7084874",
      "is_retro": "false",
      "is_rising": "false",
      "is_setting": "false",
      "in_midheaven": "false",
      "house": 1,
      "element": "Air",
      "modality": "Cardinal"
    },
    {
      "name": "Sun",
      "full_degree": "62.9674391",
      "sign": "Gemini",
      "sign_no": 3,
      "longitude": "2:58:3",
      "speed": "0.9614368",
      "is_retro": "false",
      "house": 8,
      "element": "Air",
      "modality": "Mutable",
      "...": "..."
    },
    {
      "name": "Moon",
      "full_degree": "117.3008709",
      "sign": "Cancer",
      "sign_no": 4,
      "longitude": "27:18:3",
      "house": 10,
      "element": "Water",
      "modality": "Cardinal",
      "...": "..."
    }
  ]
}

House cusps (/western-api/v1/house-cusps, same birth data, house_system=P, trimmed):

{
  "success": 1,
  "data": {
    "houses": [
      { "house": 1, "full_degree": "185.7194554", "sign": "Libra", "sign_no": 7, "longitude": "5:43:10" },
      { "house": 2, "full_degree": "213.9628728", "sign": "Scorpio", "sign_no": 8, "longitude": "3:57:46" },
      "... houses 3 to 12 ..."
    ],
    "ascendant": "185.7194554",
    "midheaven": "95.9631486",
    "vertex": "31.4160117"
  }
}

Aspect table (/western-api/v2/aspect-table, trimmed):

{
  "success": 1,
  "data": [
    { "planetOne": "Sun", "planetTwo": "Moon", "aspect": "Sextile", "orb": 5.67 },
    { "planetOne": "Sun", "planetTwo": "Venus", "aspect": "Semisquare", "orb": 0.07 },
    { "planetOne": "Sun", "planetTwo": "Mars", "aspect": "Sextile", "orb": 0.83 },
    "..."
  ]
}

Natal wheel chart (SVG and image)

/western-api/v2/natal-wheel-chart lives on astroapi-8 and returns the full chart wheel as an SVG string plus a data:image/svg+xml;base64 image you can drop into an <img> tag.

import requests

URL = "https://astroapi-8.divineapi.com/western-api/v2/natal-wheel-chart"
birth = {
    "api_key": "YOUR_API_KEY",
    "full_name": "Rahul Kumar", "day": "24", "month": "05", "year": "2023",
    "hour": "14", "min": "40", "sec": "43", "gender": "male",
    "place": "new delhi", "lat": "28.7041", "lon": "77.1025", "tzone": "5.5",
    "house_system": "P",
    # styling fields (listed as required in the API spec)
    "show_symbol": "0", "wheel_lines": "#7c7c7c", "wheel_color": "#000",
    "text_color": "#000", "outter_background": "#fff", "wheel_background": "#fff",
}

resp = requests.post(
    URL,
    headers={"Authorization": "Bearer YOUR_AUTH_TOKEN"},
    files={k: (None, v) for k, v in birth.items()},
    timeout=60,
)
resp.raise_for_status()           # astroapi-8 returns real HTTP 4xx on errors
data = resp.json()["data"]

with open("natal-chart.svg", "w", encoding="utf-8") as f:
    f.write(data["svg"])
print("Saved natal-chart.svg,", len(data["svg"]), "characters")

Live response (trimmed; the real SVG is several hundred KB):

{
  "status": "success",
  "code": 200,
  "message": "Request successful",
  "data": {
    "svg": "<svg ... version=\"1.1\" width=\"705\" height=\"705\"> ... </svg>",
    "base64_image": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmci..."
  }
}

The API spec lists six styling fields as required on this endpoint, and the sample above passes them: show_symbol, wheel_lines, wheel_color, text_color, outter_background (the API's own spelling) and wheel_background. See the natal wheel chart docs.


What you can build

  • A "your birth chart" page that renders the natal wheel SVG next to a table of planets, signs and houses.
  • An onboarding step that stores the Sun, Moon and Ascendant signs from one planetary-positions call.
  • A chart explorer that lets users switch house systems (Placidus, Koch, Whole Sign...) by changing house_system.
  • An aspect grid or aspect list from the aspect table, with orbs.
  • Compatibility and forecast features that reuse the same birth data on the synastry, transit and composite endpoints below.

Endpoints

Host matters: some Western endpoints are served from astroapi-4, others from astroapi-8. Use the host shown in each row. Paths are from the OpenAPI spec. Every row takes the 13 birth fields plus house_system.

Core natal chart

Endpoint Path Host Docs
Planetary positions /western-api/v1/planetary-positions astroapi-4 docs
House cusps /western-api/v1/house-cusps astroapi-4 docs
Aspect table /western-api/v2/aspect-table astroapi-4 docs
Natal wheel chart (SVG + base64) /western-api/v2/natal-wheel-chart astroapi-8 docs

Chart patterns and points

Endpoint Path Host Docs
Aspect patterns /western-api/v1/aspect-patterns astroapi-8 docs
Chart shape /western-api/v1/chart-shape astroapi-8 docs
Dominants /western-api/v1/dominants astroapi-8 docs
Declinations and parallels /western-api/v1/declinations-parallels astroapi-8 docs
Planetary midpoints /western-api/v1/planetary-midpoints astroapi-8 docs
Arabic lots /western-api/v1/arabic-lots astroapi-8 docs
Asteroid positions /western-api/v1/asteroid-positions astroapi-8 docs
Other minor bodies /western-api/v1/other-minor-bodies astroapi-8 docs
Fixed stars list /western-api/v1/fixed-stars-list astroapi-8 docs
Fixed stars details /western-api/v1/fixed-stars-details astroapi-8 docs
Eclipse /western-api/v1/eclipse astroapi-8 docs

Text reports and moon

Endpoint Path Host Docs
Ascendant report /western-api/v2/ascendant-report astroapi-4 docs
Natal insights /western-api/v1/natal-insights astroapi-4 docs
General sign report (per planet, e.g. sun) /western-api/v2/general-sign-report/sun astroapi-4 docs
General house report (per planet, e.g. sun) /western-api/v2/general-house-report/sun astroapi-4 docs
Moon phases /western-api/v2/moon-phases astroapi-4 docs
Moon phase calendar /western-api/v1/moon-phase-calendar astroapi-4 docs

Related: synastry, transit, composite

Same birth fields; two-person endpoints use p1_ / p2_ prefixed fields (api_key once).

Endpoint Path Host Docs
Synastry planetary positions /western-api/v1/synastry/planetary-positions astroapi-4 docs
Synastry house cusps /western-api/v1/synastry/house-cusps astroapi-4 docs
Synastry aspect table /western-api/v2/synastry/aspect-table astroapi-8 docs
Synastry natal wheel chart /western-api/v2/synastry/natal-wheel-chart astroapi-8 docs
Synastry emotional compatibility /western-api/v2/synastry/emotional-compatibility astroapi-4 docs
Transit, basic /western-api/v1/transit/basic astroapi-4 docs
Transit, custom moment /western-api/v1/transit/custom astroapi-4 docs
Transit wheel chart /western-api/v1/transit/wheel-chart astroapi-8 docs
Composite planetary positions /western-api/v1/composite/planetary-positions astroapi-8 docs
Composite natal wheel chart /western-api/v1/composite/natal-wheel-chart astroapi-8 docs

More groups (progressions, planet returns, prenatal) are listed on the Western API docs. Need a branded PDF instead of JSON? See the natal report and the 125+ white-label PDF report types at reports.divineapi.com/reports.


Parameters and gotchas

Field Format Note
day, month, year separate fields (24, 05, 2023) Not one date string.
hour, min, sec 24-hour clock sec is required: send 0 if unknown, or the call is rejected.
tzone decimal hours, e.g. 5.5, -4 Never +5:30 or a zone name. Not DST-adjusted: send the real offset at the birth moment.
place lowercase city, e.g. new delhi Uppercase can be rejected on some hosts. lat / lon drive the calculation.
house_system one letter, default P See the table below.
lan language code, default en Western text reports answer in 12 languages (table below).

Zodiac: Western endpoints are tropical. (The Vedic endpoints in kundli-api are sidereal; do not send house_system to them.)

Errors depend on the host. astroapi-4 always answers HTTP 200: check success in the body (1 ok, 2 validation error, 3 auth error, read msg). astroapi-8 returns real HTTP 4xx with {status, error_code, code, error, message} (for example 401 AUTHORIZATION_INVALID). Do not retry an auth error; fix the key or token.

House systems (house_system)

The Western chart endpoints accept 25 house systems. Placidus (P) is the default.

Code System Code System Code System
P Placidus M Morinus I Sunshine
K Koch O Porphyry i Sunshine (alternative)
R Regiomontanus B Alcabitius L Pullen S-Delta
C Campanus D Equal / MC Q Pullen S-Ratio
A Equal E Equal (= A) S Sripati
W Equal, whole sign F Carter poli-equatorial U Krusinski-Pisa-Goelzer
N Whole sign, Aries = 1st house G 36 Gauquelin sectors V Equal Vehlow
X Axial rotation / meridian H Horizon / azimuth Y APC houses
T Polich/Page (topocentric)

Languages (lan)

Western text reports (for example the general sign report) answer in 12 languages. On planetary positions only a few labels are translated.

Code Language Code Language Code Language
en English ja Japanese it Italian
hi Hindi tr Turkish es Spanish
pt Portuguese ru Russian nl Dutch
fr French de German pl Polish

SDKs and MCP

pip install divineapi
npm install divineapi
composer require divineapi/divineapi

The examples above use plain HTTP so they work in any language. SDK repos: divineapi-python, divineapi-node, divineapi-php.

MCP server (Western astrology) for Claude, Cursor, VS Code and other MCP clients:

https://mcp.divineapi.com/western/mcp

Setup steps: mcp-western-astrology.


Which plan includes this

Natal chart endpoints are in the Western plans (Western Nova, Western Atlas, Western Lumen); the larger plans add more Western endpoints. See the per-plan list at divineapi.com/pricing.

FAQ

Is this a birth chart API or a natal chart API? Both names mean the same thing: the positions of the planets and houses at the moment of birth. This repo covers the Western (tropical) natal chart. For a Vedic birth chart (kundli), see kundli-api.

Which house system is used by default? Placidus (P). Pass any of the 25 codes above in house_system, for example K for Koch or N for whole sign.

Can I get the chart as an image? Yes. /western-api/v2/natal-wheel-chart returns svg (a full SVG document) and base64_image (a data:image/svg+xml;base64 URI). Both render in a browser without extra libraries.

Why does my request fail when I leave out sec? sec is required on birth endpoints. Send 0 if the birth second is unknown.

What ephemeris do you use? Swiss Ephemeris, under DivineAPI's commercial licence.

How do I try the natal chart endpoints? Start the 14-day free trial (credit card required to activate the trial), then run the planetary-positions call above with your own birth data and house_system. Western plan prices are on divineapi.com/pricing.


Related repos

Repo What it covers
astrology-api Overview of all DivineAPI products
kundli-api Vedic birth chart (kundli), dashas, doshas
panchang-api Panchang, muhurat, choghadiya
horoscope-api Daily, weekly, monthly, yearly horoscopes
tarot-api Tarot readings with card images
numerology-api Numerology numbers and reports
hindu-festival-api Hindu festival dates
mcp-western-astrology MCP server for Western astrology

Support

DivineAPI was founded in 2021 in New Delhi, India, and serves 600+ businesses.

License

Code samples in this repository are released under the MIT License (see LICENSE). The DivineAPI name and logo are trademarks of DivineAPI.

About

Birth Chart / Natal Chart API: planets, houses, aspects and wheel chart for Western astrology, as JSON. By DivineAPI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors