AstrologyAPI

Western Horoscope

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

The western_horoscope API returns the positions and properties of celestial bodies in the sky, including the Sun, Moon, planets, and asteroids, as well as the positions of the 12 astrological houses. The response includes information such as the name of each celestial body, its position in degrees, its speed, whether it is retrograde, its astrological sign, and the house it is in.

POST/western_horoscope
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/western_horoscope"
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        "house_type": "placidus",
21        "is_asteroids": "false"
22    }
23
24headers = {
25    'x-astrologyapi-key': api_key,
26    'Content-Type': 'application/json'
27    # Add 'Accept-Language': '<language_code>' if needed
28}
29
30try:
31    response = requests.post(api_url, headers=headers, json=data)
32    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)
33
34    # Process the response
35    response_data = response.json()
36    print(json.dumps(response_data, indent=4))
37
38except requests.exceptions.RequestException as e:
39    print(f"Error making API request: {e}")
40    if hasattr(e, 'response') and e.response is not None:
41        try:
42            print(f"Error response: {e.response.json()}")
43        except json.JSONDecodeError:
44             print(f"Error response (non-JSON): {e.response.text}")
45
46
200Response
Copy
1{
2  "planets": [
3    {
4      "name": "Sun",
5      "full_degree": 275.6427,
6      "norm_degree": 5.6427,
7      "speed": 1.019,
8      "is_retro": "false",
9      "sign_id": 10,
10      "sign": "Capricorn",
11      "house": 2
12    },
13    {
14      "name": "Moon",
15      "full_degree": 12.271,
16      "norm_degree": 12.271,
17      "speed": 13.5085,
18      "is_retro": "false",
19      "sign_id": 1,
20      "sign": "Aries",
21      "house": 5
22    },
23    {
24      "name": "Mars",
25      "full_degree": 232.2381,
26      "norm_degree": 22.2381,
27      "speed": 0.6621,
28      "is_retro": "false",
29      "sign_id": 8,
30      "sign": "Scorpio",
31      "house": 12
32    },
33    {
34      "name": "Mercury",
35      "full_degree": 278.3033,
36      "norm_degree": 8.3033,
37      "speed": 1.6049,
38      "is_retro": "false",
39      "sign_id": 10,
40      "sign": "Capricorn",
41      "house": 2
42    },
43    {
44      "name": "Jupiter",
45      "full_degree": 20.033,
46      "norm_degree": 20.033,
47      "speed": 0.043,
48      "is_retro": "false",
49      "sign_id": 1,
50      "sign": "Aries",
51      "house": 5
52    },
53    {
54      "name": "Venus",
55      "full_degree": 307.0102,
56      "norm_degree": 7.0102,
57      "speed": 1.2339,
58      "is_retro": "false",
59      "sign_id": 11,
60      "sign": "Aquarius",
61      "house": 3
62    },
63    {
64      "name": "Saturn",
65      "full_degree": 264.9924,
66      "norm_degree": 24.9924,
67      "speed": 0.117,
68      "is_retro": "false",
69      "sign_id": 9,
70      "sign": "Sagittarius",
71      "house": 1
72    },
73    {
74      "name": "Uranus",
75      "full_degree": 267.4199,
76      "norm_degree": 27.4199,
77      "speed": 0.0601,
78      "is_retro": "false",
79      "sign_id": 9,
80      "sign": "Sagittarius",
81      "house": 1
82    },
83    {
84      "name": "Neptune",
85      "full_degree": 277.6325,
86      "norm_degree": 7.6325,
87      "speed": 0.0379,
88      "is_retro": "false",
89      "sign_id": 10,
90      "sign": "Capricorn",
91      "house": 2
92    },
93    {
94      "name": "Pluto",
95      "full_degree": 221.8913,
96      "norm_degree": 11.8913,
97      "speed": 0.0273,
98      "is_retro": "false",
99      "sign_id": 8,
100      "sign": "Scorpio",
101      "house": 12
102    },
103    {
104      "name": "Node",
105      "full_degree": 357.3824,
106      "norm_degree": 27.3824,
107      "speed": -0.053,
108      "is_retro": "true",
109      "sign_id": 12,
110      "sign": "Pisces",
111      "house": 4
112    },
113    {
114      "name": "Chiron",
115      "full_degree": 85.3981,
116      "norm_degree": 25.3981,
117      "speed": -0.0619,
118      "is_retro": "true",
119      "sign_id": 3,
120      "sign": "Gemini",
121      "house": 7
122    },
123    {
124      "name": "Part of Fortune",
125      "full_degree": 144.086,
126      "norm_degree": 24.086,
127      "speed": 0,
128      "is_retro": "false",
129      "sign_id": 5,
130      "sign": "Leo",
131      "house": 9
132    }
133  ],
134  "houses": [
135    {
136      "house": 1,
137      "sign": "Sagittarius",
138      "degree": 240.71431
139    },
140    {
141      "house": 2,
142      "sign": "Capricorn",
143      "degree": 270.69055
144    },
145    {
146      "house": 3,
147      "sign": "Aquarius",
148      "degree": 303.14258
149    },
150    {
151      "house": 4,
152      "sign": "Pisces",
153      "degree": 336.92136
154    },
155    {
156      "house": 5,
157      "sign": "Aries",
158      "degree": 8.8136
159    },
160    {
161      "house": 6,
162      "sign": "Taurus",
163      "degree": 36.5582
164    },
165    {
166      "house": 7,
167      "sign": "Gemini",
168      "degree": 60.71431
169    },
170    {
171      "house": 8,
172      "sign": "Cancer",
173      "degree": 90.69055
174    },
175    {
176      "house": 9,
177      "sign": "Leo",
178      "degree": 123.14258
179    },
180    {
181      "house": 10,
182      "sign": "Virgo",
183      "degree": 156.92136
184    },
185    {
186      "house": 11,
187      "sign": "Libra",
188      "degree": 188.8136
189    },
190    {
191      "house": 12,
192      "sign": "Scorpio",
193      "degree": 216.5582
194    }
195  ],
196  "ascendant": 240.71431015862024,
197  "midheaven": 156.92135925483103,
198  "vertex": 118.53668227404134,
199  "lilith": {
200    "name": "Lilith",
201    "full_degree": 134.6796,
202    "norm_degree": 14.6796,
203    "speed": 0.1113,
204    "is_retro": "false",
205    "sign_id": 5,
206    "sign": "Leo",
207    "house": 9
208  },
209  "aspects": [
210    {
211      "aspecting_planet": "Sun",
212      "aspected_planet": "Mercury",
213      "aspecting_planet_id": 0,
214      "aspected_planet_id": 3,
215      "type": "Conjunction",
216      "orb": 2.66,
217      "diff": 2.66
218    },
219    {
220      "aspecting_planet": "Sun",
221      "aspected_planet": "Neptune",
222      "aspecting_planet_id": 0,
223      "aspected_planet_id": 8,
224      "type": "Conjunction",
225      "orb": 1.99,
226      "diff": 1.99
227    },
228    {
229      "aspecting_planet": "Sun",
230      "aspected_planet": "Midheaven",
231      "aspecting_planet_id": 0,
232      "aspected_planet_id": 11,
233      "type": "Trine",
234      "orb": 1.28,
235      "diff": 118.72
236    },
237    {
238      "aspecting_planet": "Moon",
239      "aspected_planet": "Mercury",
240      "aspecting_planet_id": 1,
241      "aspected_planet_id": 3,
242      "type": "Square",
243      "orb": 3.97,
244      "diff": 93.97
245    },
246    {
247      "aspecting_planet": "Moon",
248      "aspected_planet": "Venus",
249      "aspecting_planet_id": 1,
250      "aspected_planet_id": 5,
251      "type": "Sextile",
252      "orb": 5.26,
253      "diff": 65.26
254    },
255    {
256      "aspecting_planet": "Moon",
257      "aspected_planet": "Neptune",
258      "aspecting_planet_id": 1,
259      "aspected_planet_id": 8,
260      "type": "Square",
261      "orb": 4.64,
262      "diff": 94.64
263    },
264    {
265      "aspecting_planet": "Mercury",
266      "aspected_planet": "Neptune",
267      "aspecting_planet_id": 3,
268      "aspected_planet_id": 8,
269      "type": "Conjunction",
270      "orb": 0.67,
271      "diff": 0.67
272    },
273    {
274      "aspecting_planet": "Mercury",
275      "aspected_planet": "Pluto",
276      "aspecting_planet_id": 3,
277      "aspected_planet_id": 9,
278      "type": "Sextile",
279      "orb": 3.59,
280      "diff": 56.41
281    },
282    {
283      "aspecting_planet": "Mercury",
284      "aspected_planet": "Midheaven",
285      "aspecting_planet_id": 3,
286      "aspected_planet_id": 11,
287      "type": "Trine",
288      "orb": 1.38,
289      "diff": 121.38
290    },
291    {
292      "aspecting_planet": "Jupiter",
293      "aspected_planet": "Saturn",
294      "aspecting_planet_id": 4,
295      "aspected_planet_id": 6,
296      "type": "Trine",
297      "orb": 4.96,
298      "diff": 115.04
299    },
300    {
301      "aspecting_planet": "Venus",
302      "aspected_planet": "Pluto",
303      "aspecting_planet_id": 5,
304      "aspected_planet_id": 9,
305      "type": "Square",
306      "orb": 4.88,
307      "diff": 85.12
308    },
309    {
310      "aspecting_planet": "Saturn",
311      "aspected_planet": "Uranus",
312      "aspecting_planet_id": 6,
313      "aspected_planet_id": 7,
314      "type": "Conjunction",
315      "orb": 2.43,
316      "diff": 2.43
317    },
318    {
319      "aspecting_planet": "Neptune",
320      "aspected_planet": "Pluto",
321      "aspecting_planet_id": 8,
322      "aspected_planet_id": 9,
323      "type": "Sextile",
324      "orb": 4.26,
325      "diff": 55.74
326    },
327    {
328      "aspecting_planet": "Neptune",
329      "aspected_planet": "Midheaven",
330      "aspecting_planet_id": 8,
331      "aspected_planet_id": 11,
332      "type": "Trine",
333      "orb": 0.71,
334      "diff": 120.71
335    },
336    {
337      "aspecting_planet": "Pluto",
338      "aspected_planet": "Midheaven",
339      "aspecting_planet_id": 9,
340      "aspected_planet_id": 11,
341      "type": "Sextile",
342      "orb": 4.97,
343      "diff": 64.97
344    }
345  ]
346}

Request Headers

Authorization

string

required

Basic Authorization via header

Accept-Language

string

Preferred language for the response content

Properties

English - enSpanish - esPortuguese - ptFrench - frItalian - itGerman - deRussian - ru

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

house_type

string

required

Default : placidus // koch/topocentric/poryphry/equal_house/whole_sign

is_asteroids

boolean

required

Default : false //to display the asteroids degree and positions

Request Description

'placidus', 'koch', 'porphyry', 'equal', 'whole_sign', 'topocentric', 'sripati', 'horizontal', 'campanus'

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.