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 

POST https://ask.divineapi.com/balance

Guide: Wallet balance and lifetime usage. No question is asked and nothing is charged. Returns your account name, remaining balance in rupees, total requests, total charged, and how many were blocked by a guardrail and therefore free.


Authentication

Every request requires two headers:

HeaderDescription
AuthorizationBearer {api_acc_token} - identifies the user
x-api-keyUse api_key

Headers

NameTypeDescription

Content-Type*

String

application/json.  Example: Content-Type: application/json

Fields marked with * are mandatory.


200: OK Answered Successfully

{
    "state": "active",
    "credits_remaining": 91900,
    "expires": "2033-08-09"
}

Example Code Implementations

Below are example implementations in various programming environments.


cURL

curl --location --request POST 'https://ask.divineapi.com/balance' \
--header 'Authorization: Bearer {api_acc_token}' \
--header 'x-api-key: {api-key}'

 

curl -X POST "https://ask.divineapi.com/balance" \
  -H "Authorization: Bearer {api_acc_token}" \
  -H "x-api-key: {api-key}"
const axios = require('axios');

const response = await axios.post(
  'https://ask.divineapi.com/balance',
  {},
  {
  headers: {
      'Authorization': "Bearer {api_acc_token}",
      'x-api-key': "{api-key}",
    },
}
);

console.log(response.data);
import requests

url = "https://ask.divineapi.com/balance"
headers = {
    "Authorization": "Bearer {api_acc_token}",
    "x-api-key": "{api-key}",
}

response = requests.post(url, headers=headers)

print(response.json())
const response = await fetch(
  'https://ask.divineapi.com/balance',
  {
    method: 'POST',
    headers: {
        'Authorization': "Bearer {api_acc_token}",
        'x-api-key': "{api-key}",
      },
  }
);

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

use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('POST', 'https://ask.divineapi.com/balance', [
    'headers' => [
        'Authorization' => 'Bearer {api_acc_token}',
        'x-api-key' => '{api-key}',
    ],
]);

echo $response->getBody();
package main

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

func main() {
    req, _ := http.NewRequest("POST", "https://ask.divineapi.com/balance", nil)
    req.Header.Set("Authorization", "Bearer {api_acc_token}")
    req.Header.Set("x-api-key", "{api-key}")

    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/balance")
            .post(body)
            .addHeader("Authorization", "Bearer {api_acc_token}")
            .addHeader("x-api-key", "{api-key}")
            .build();

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

let url = URL(string: "https://ask.divineapi.com/balance")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer {api_acc_token}", forHTTPHeaderField: "Authorization")
request.setValue("{api-key}", forHTTPHeaderField: "x-api-key")

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/balance")
        .post(body!!)
        .addHeader("Authorization", "Bearer {api_acc_token}")
        .addHeader("x-api-key", "{api-key}")
        .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();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_acc_token}");
        client.DefaultRequestHeaders.Add("x-api-key", "{api-key}");

        var response = await client.PostAsync("https://ask.divineapi.com/balance");
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}
Response 200
{
    "state": "active",
    "credits_remaining": 91900,
    "expires": "2033-08-09"
}