AstrologyAPI

Personalized Astro Chat

POSThttps://json-chat.astrologyapi.com/api/chat
Copy

Start a personalized conversation with an astrological assistant based on a single birth chart. This endpoint supports both Vedic and Western traditions with various expertise levels.

POST/api/chat
Copy
1import requests
2import json
3
4# Your API key
5api_key = "<YOUR_API_KEY>"
6
7# API endpoint URL
8api_url = "https://json-chat.astrologyapi.com/api/chat"
9
10# Request data
11data = {
12        "language": "en",
13        "name": "David",
14        "day": 1,
15        "month": 11,
16        "year": 2005,
17        "hour": 19,
18        "min": 45,
19        "place": "Mumbai",
20        "lat": "19.17",
21        "lon": "73.7",
22        "tzone": "5.5",
23        "gender": "male",
24        "country": "INDIA",
25        "ap": "KUNDLI",
26        "sid": "astro-6",
27        "ep": "STANDARD",
28        "ac": "VEDIC",
29        "q": "hi"
30    }
31
32headers = {
33    'x-astrologyapi-key': api_key,
34    'Content-Type': 'application/json'
35    # Add 'Accept-Language': '<language_code>' if needed
36}
37
38try:
39    response = requests.post(api_url, headers=headers, json=data)
40    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)
41
42    # Process the response
43    response_data = response.json()
44    print(json.dumps(response_data, indent=4))
45
46except requests.exceptions.RequestException as e:
47    print(f"Error making API request: {e}")
48    if hasattr(e, 'response') and e.response is not None:
49        try:
50            print(f"Error response: {e.response.json()}")
51        except json.JSONDecodeError:
52             print(f"Error response (non-JSON): {e.response.text}")
53
54
200Response
Copy
1{
2  "status": true,
3  "message": "Based on your birth details, your Sun is in Scorpio and Moon is in Libra. This indicates a deep, intuitive nature with a strong focus on balance and harmony...",
4  "response": {
5    "sid": "astro-6",
6    "timestamp": "2026-01-28T12:00:00Z"
7  }
8}

Request Headers

Authorization

string

required

Basic Authorization via header

Accept-Language

string

Preferred language for the response content

Request Parameters

language

string

required

Language code (e.g., "en")

name

string

required

Name of the person

day

number

required

Birth day

month

number

required

Birth month

year

number

required

Birth year

hour

number

required

Birth hour (24-hour format)

min

number

required

Birth minute

place

string

required

Birth city

lat

string

required

Latitude of birth place

lon

string

required

Longitude of birth place

tzone

string

required

Timezone offset (e.g., "5.5")

gender

string

required

Gender ("male" or "female")

Properties

malefemale
country

string

required

Country of birth

ap

string

required

Astro Profile. Options: "KUNDLI". For personalized chat, use "KUNDLI".

Properties

KUNDLI
sid

string

required

Assistant/Session ID. Use "astro-6" for standard personalized assistant.

ep

string

required

Expertise level. Options: "STANDARD", "ADVANCED", "EXPERT".

Properties

STANDARDADVANCEDEXPERT
ac

string

required

Astrological category. Options: "VEDIC", "WESTERN".

Properties

VEDICWESTERN
q

string

required

The astrological question or query.

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.