AI Chat (Text)
POST https://starsapi.com/api/v2/partner/ai/chat/
Text-based AI astrologer sessions. Open a session with birth details, get a
greeting, then keep sending messages. Three endpoints:
/start (single chart),
/match-start (two charts), and
/message (follow-up turns). All return the same response envelope.
Start session
POST /api/v2/partner/ai/chat/start
Opens a new single-chart session. Computes the user’s Vedic chart, selects
the astrologer, and returns the AI’s opening greeting in
new_messages.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
astrologer | string | Yes | Astrologer key: guruji, love_guru, career_expert, health_expert, transit_expert. |
year | integer | Yes | Birth year, 4-digit. |
month | integer | Yes | Birth month, 1–12. |
day | integer | Yes | Day of month, 1–31. |
hour | integer | Yes | Hour in 24-hour local clock time, 0–23. |
minute | integer | Yes | Minute, 0–59. |
latitude | number | Yes | Signed decimal degrees, −90…90. Positive = North. |
longitude | number | Yes | Signed decimal degrees, −180…180. Positive = East. |
timezone | string | Yes | IANA timezone identifier (e.g. Asia/Kolkata). |
name | string | No | User’s name. Used to personalize the astrologer’s responses. |
gender | string | No | male or female. |
age | integer | No | User’s age. |
preferred_language | string | No | Response language code: en, hi, etc. Default: en. |
timezone of the birth place. Do not pre-convert to UTC.
Send message
POST /api/v2/partner/ai/chat/message
Send a follow-up message in an active session. The server loads the chart
context and conversation history automatically from the session_id.
Returns the astrologer’s reply in the same envelope as /start.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | The 32-character session ID from the /start response. |
message | string | Yes | The user’s message text. |
Start match session (two charts)
POST /api/v2/partner/ai/chat/match-start
Opens a matchmaking session with two birth charts loaded simultaneously.
Used for compatibility analysis — Ashtakoot, Mangal Dosha, synastry,
relationship counsel. Both charts remain in scope for the entire conversation.
Subsequent turns use the same /message endpoint.
Request body
Send two person objects. The preferred field names are person1 and
person2. Legacy names boy / girl are
also accepted.
| Field | Type | Required | Description |
|---|---|---|---|
astrologer | string | Yes | Use a matching-capable astrologer, e.g. guruji or love_guru. |
preferred_language | string | No | Response language. Default: en. |
| person1 (object) | |||
person1.name | string | No | Name of person 1. |
person1.year | integer | Yes | Birth year. |
person1.month | integer | Yes | Birth month. |
person1.day | integer | Yes | Birth day. |
person1.hour | integer | Yes | Birth hour (24h). |
person1.minute | integer | Yes | Birth minute. |
person1.latitude | number | Yes | Signed decimal latitude. |
person1.longitude | number | Yes | Signed decimal longitude. |
person1.timezone | string | Yes | IANA timezone. |
person1.gender | string | No | male or female. |
| person2 (same fields as person1) | |||
Match-start example body
{
"astrologer": "love_guru",
"preferred_language": "en",
"person1": {
"name": "Ravi",
"year": 1990, "month": 6, "day": 15,
"hour": 14, "minute": 30,
"timezone": "Asia/Kolkata",
"latitude": 28.6139, "longitude": 77.2090,
"gender": "male"
},
"person2": {
"name": "Priya",
"year": 1992, "month": 3, "day": 22,
"hour": 9, "minute": 15,
"timezone": "Asia/Kolkata",
"latitude": 19.0760, "longitude": 72.8777,
"gender": "female"
}
}
Response shape
All three endpoints return the same envelope. The data object
contains the session state, the astrologer’s reply, and billing.
| Field | Type | Description |
|---|---|---|
success | boolean | true on success. |
| data | ||
session_id | string | 32-character session identifier. Pass to /message for subsequent turns. |
turn | integer | Turn count. 1 = greeting, 2+ = conversation turns. |
| data.astrologer | ||
key | string | Astrologer identifier (e.g. guruji). |
name | string | Display name. |
tagline | string | Short description. |
avatar | string | Emoji or avatar identifier for UI rendering. |
astrology_system | string | Primary system used (e.g. vedic). |
| data.new_messages | ||
role | string | astrologer. |
message | array of strings | Reply text split into reading-sized chunks. Render each as a separate chat bubble. |
| data.suggested_followups | ||
| array of strings | AI-generated quick-reply prompts. Surface as tappable chips in your UI. | |
| data.billing | ||
cost_minor | integer | Turn cost in minor units. |
currency | string | INR or USD. |
wallet_balance_minor | integer | Remaining balance after debit. |
wallet_balance_human | string | Formatted balance string. |
message field is an array of strings, not a single string.
Each element is one “bubble” — render them separately in your chat
UI for a natural conversational feel. Optionally add a short delay between bubbles.
Integration checklist
- Call
/startwith birth details + astrologer key → savesession_id. - Render
new_messages[0].messageas separate chat bubbles. - Show
suggested_followupsas tappable chips below the last bubble. - On user input → call
/messagewithsession_id+message. - Check
billing.wallet_balance_minorand warn the user when balance is low. - Handle errors: show
error.messageto the user for validation failures.
Errors
| HTTP | Code | Cause |
|---|---|---|
| 400 | VALIDATION_ERROR | Missing/invalid fields or unknown astrologer key. |
| 400 | MISSING_FIELD | A required field is absent. |
| 400 | INVALID_DATE | Date values out of range. |
| 400 | INVALID_TIME | Hour/minute out of range. |
| 400 | INVALID_TIMEZONE | Non-IANA timezone value. |
| 400 | INVALID_COORDINATE | Latitude/longitude out of range. |
| 400 | INVALID_SESSION | Session ID not found or expired. |
| 401 | AUTH_MISSING_KEY | No API key in request. |
| 402 | INSUFFICIENT_BALANCE | Wallet balance too low. |
| 405 | METHOD_NOT_ALLOWED | Non-POST request. |
See also
- AI Astrologers overview — available personas, billing, language support
- AI Voice (Call) — turn-based and realtime voice endpoints
- Authentication — keys, headers, origin whitelisting