AstrologyAPI

Planet Panchang

POSThttps://json.astrologyapi.com/v1/planet_panchang
Copy

The planet_panchang API returns the position and information about the celestial bodies in the solar system, including their degrees, signs, and nakshatras. The response includes details of the Sun, Moon, Mars, Mercury, Jupiter, Venus, Saturn, Rahu, Ketu, and the Ascendant.

POST/planet_panchang
Copy
1import requests
2import json
3
4# Your API key
5api_key = "<YOUR_API_KEY>"
6
7# API endpoint URL
8api_url = "https://json.astrologyapi.com/v1/planet_panchang"
9
10# Request data
11data = {
12        "day": 10,
13        "month": 5,
14        "year": 1990,
15        "hour": 19,
16        "min": 55,
17        "lat": 19.2056,
18        "lon": 25.2056,
19        "tzone": 5.5
20    }
21
22headers = {
23    'x-astrologyapi-key': api_key,
24    'Content-Type': 'application/json'
25    # Add 'Accept-Language': '<language_code>' if needed
26}
27
28try:
29    response = requests.post(api_url, headers=headers, json=data)
30    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)
31
32    # Process the response
33    response_data = response.json()
34    print(json.dumps(response_data, indent=4))
35
36except requests.exceptions.RequestException as e:
37    print(f"Error making API request: {e}")
38    if hasattr(e, 'response') and e.response is not None:
39        try:
40            print(f"Error response: {e.response.json()}")
41        except json.JSONDecodeError:
42             print(f"Error response (non-JSON): {e.response.text}")
43
44
200Response
Copy
1[
2  {
3    "id": 0,
4    "name": "Sun",
5    "fullDegree": 252.09460460591438,
6    "normDegree": 12.094604605914384,
7    "speed": 1.0193591661518109,
8    "isRetro": "false",
9    "sign": "Sagittarius",
10    "signLord": "Jupiter",
11    "nakshatra": "Mool",
12    "nakshatra_lord": "Ketu",
13    "nakshatra_pad": 4,
14    "house": 8
15  },
16  {
17    "id": 1,
18    "name": "Moon",
19    "fullDegree": 270.5122653639715,
20    "normDegree": 0.512265363971494,
21    "speed": 11.825128877575814,
22    "isRetro": "false",
23    "sign": "Capricorn",
24    "signLord": "Saturn",
25    "nakshatra": "Uttra Shadha",
26    "nakshatra_lord": "Sun",
27    "nakshatra_pad": 2,
28    "house": 9
29  },
30  {
31    "id": 2,
32    "name": "Mars",
33    "fullDegree": 188.3815319262027,
34    "normDegree": 8.381531926202712,
35    "speed": 0.5887946253305186,
36    "isRetro": "false",
37    "sign": "Libra",
38    "signLord": "Venus",
39    "nakshatra": "Swati",
40    "nakshatra_lord": "Rahu",
41    "nakshatra_pad": 1,
42    "house": 6
43  },
44  {
45    "id": 3,
46    "name": "Mercury",
47    "fullDegree": 253.0225800960178,
48    "normDegree": 13.022580096017805,
49    "speed": 1.5996369506881676,
50    "isRetro": "false",
51    "sign": "Sagittarius",
52    "signLord": "Jupiter",
53    "nakshatra": "Mool",
54    "nakshatra_lord": "Ketu",
55    "nakshatra_pad": 4,
56    "house": 8
57  },
58  {
59    "id": 4,
60    "name": "Jupiter",
61    "fullDegree": 38.72221374275588,
62    "normDegree": 8.722213742755883,
63    "speed": -0.09338056617041195,
64    "isRetro": "true",
65    "sign": "Taurus",
66    "signLord": "Venus",
67    "nakshatra": "Krittika",
68    "nakshatra_lord": "Sun",
69    "nakshatra_pad": 4,
70    "house": 1
71  },
72  {
73    "id": 5,
74    "name": "Venus",
75    "fullDegree": 297.99666783266633,
76    "normDegree": 27.996667832666333,
77    "speed": 1.1216268488510852,
78    "isRetro": "false",
79    "sign": "Capricorn",
80    "signLord": "Saturn",
81    "nakshatra": "Dhanishtha",
82    "nakshatra_lord": "Mars",
83    "nakshatra_pad": 2,
84    "house": 9
85  },
86  {
87    "id": 6,
88    "name": "Saturn",
89    "fullDegree": 30.93943500416237,
90    "normDegree": 0.9394350041623696,
91    "speed": -0.05047862107117041,
92    "isRetro": "true",
93    "sign": "Taurus",
94    "signLord": "Venus",
95    "nakshatra": "Krittika",
96    "nakshatra_lord": "Sun",
97    "nakshatra_pad": 2,
98    "house": 1
99  },
100  {
101    "id": 7,
102    "name": "Rahu",
103    "fullDegree": 82.06172359607255,
104    "normDegree": 22.061723596072554,
105    "speed": -0.052992016996976136,
106    "isRetro": "true",
107    "sign": "Gemini",
108    "signLord": "Mercury",
109    "nakshatra": "Punarvasu",
110    "nakshatra_lord": "Jupiter",
111    "nakshatra_pad": 1,
112    "house": 2
113  },
114  {
115    "id": 8,
116    "name": "Ketu",
117    "fullDegree": 262.06172359607257,
118    "normDegree": 22.061723596072568,
119    "speed": -0.052992016996976136,
120    "isRetro": "true",
121    "sign": "Sagittarius",
122    "signLord": "Jupiter",
123    "nakshatra": "Purva Shadha",
124    "nakshatra_lord": "Venus",
125    "nakshatra_pad": 3,
126    "house": 8
127  },
128  {
129    "id": 9,
130    "name": "Ascendant",
131    "fullDegree": 47.8718183438523,
132    "normDegree": 17.871818343852297,
133    "speed": 0,
134    "isRetro": false,
135    "sign": "Taurus",
136    "signLord": "Venus",
137    "nakshatra": "Rohini",
138    "nakshatra_lord": "Moon",
139    "nakshatra_pad": 3,
140    "house": 1
141  }
142]

Request Headers

Authorization

string

required

Basic Authorization via header

Accept-Language

string

Preferred language for the response content

Properties

English - enHindi - hiMarathi - maBengali - bnTamil - taTelugu - teMalayalam - mlKannada - kn

Request Parameters

day

int

required

Date of birth, eg: 10

month

int

required

Month of birth, eg: 5

year

int

required

Year of birth, eg: 1990

hour

int

required

Hour of birth, eg: 19

min

int

required

Minute of birth, eg: 55

lat

float

required

Latitude, eg: 19.2056

lon

float

required

Longitude, eg: 25.2056

tzone

float

required

Timezone, eg: 5.5

Request Description

1. Panchang at specified date and time
Here, following APIs are used and date and time along with latitude, longitude and timezone are expected -

Errors

400
Bad Request

Something is wrong with your request format or parameters.

401
Unauthorized

Your API key is missing or invalid.

403
Forbidden

You don't have permission to access this specific resource.

404
Not Found

The API endpoint you're trying to reach doesn't exist.

500
Internal Server Error

Our server is having a temporary glitch.