Copy page

Copy page as Markdown for LLMs

View as Markdown

View this page as plain text


Open in ChatGPT

Ask ChatGPT about this page

Open in Claude

Ask Claude about this page

Astro ChatBot API

Introducing the Astro ChatBot API, a simple and reliable way to let users ask any astrology question in plain language and get one grounded, chart-based answer back. You send a question and the person's birth details; DivineAPI fetches and compresses their chart, and streams back an answer written for a reader, not a developer. This API is designed for websites, mobile apps, chatbots, CRM dashboards, or astrology portals that want a conversational astrology experience instead of static reports.

It supports seven endpoints: one to ask a question inside a stored conversation, four to manage and inspect those conversations and your account, and one liveness check.


API Endpoint 

GET https://ask.divineapi.com/session/{session_id}

Guide: The full history of one conversation, for restoring a chat screen. Returns every message in order with its role and timestamp, plus the birth details stored against the session. Returns 404 if the session does not exist.


200: OK Answered Successfully

{
  "session_id": "s_5f21",
  "messages": [
    { "role": "user", "text": "When will I marry?", "ts": 1788249956.9 },
    { "role": "assistant", "text": "Your chart...", "ts": 1788249957.2 }
  ],
  "birth_details": {
    "full_name": "Priya Sharma", "day": "24", "month": "05", "year": "1996",
    "hour": "14", "min": "40", "gender": "female", "place": "New Delhi",
    "lat": "28.7041", "lon": "77.1025", "tzone": "5.5"
  }
}

Example Code Implementations

Below are example implementations in various programming environments.


cURL

curl "https://ask.divineapi.com/session/s_5f21?api_key=dk_live_..."

 

curl -X GET "https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}"
const axios = require('axios');

const response = await axios.get('https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}');

console.log(response.data);
import requests

url = "https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}"

response = requests.get(url)

print(response.json())
const response = await fetch(
  'https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}',
  {
    method: 'GET',
  }
);

const data = await response.json();
console.log(data);
<?php

use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('GET', 'https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}', [
]);

echo $response->getBody();
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("GET", "https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}", nil)

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body2, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body2))
}
import okhttp3.*;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        RequestBody body = null;

        Request request = new Request.Builder()
            .url("https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}")
            .get()
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
import Foundation

let url = URL(string: "https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}")!
var request = URLRequest(url: url)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        print(String(data: data, encoding: .utf8) ?? "")
    }
}
task.resume()
import okhttp3.*

fun main() {
    val client = OkHttpClient()

    val body: RequestBody? = null

    val request = Request.Builder()
        .url("https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}")
        .get()
        .build()

    client.newCall(request).execute().use { response ->
        println(response.body?.string())
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program {
    static async Task Main() {
        using var client = new HttpClient();

        var response = await client.GetAsync("https://ask.divineapi.com/session/{Your Session ID}?api_key={Your API Key}");
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}