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/session/delete

Guide: Erase one conversation: its messages and its stored birth details. Takes api_key as a query parameter. Permanent, and intended as the path you call when a user asks you to delete their data.


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.


Request Body

NameTypeDescription

user_id*

String

Your ID for the end user. Recorded on every request and used for usage reporting.

session_id*StringYour ID for this conversation. A new ID starts a fresh thread.

200: OK Answered Successfully

{
    "deleted": true,
    "session_id": "session090091",
    "messages_removed": 2
}

Example Code Implementations

Below are example implementations in various programming environments.


cURL

curl --location 'https://ask.divineapi.com/session/delete' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_acc_token}' \
--header 'x-api-key: {api-key}' \
--data '{
    "session_id": "session090091",
    "user_id": "u_8812dwqdq"
}'

 

curl -X POST "https://ask.divineapi.com/session/delete" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {api_acc_token}" \
  -H "x-api-key: {api-key}" \
  -d '{
    "session_id": "session090091",
    "user_id": "u_8812dwqdq"
}'
const axios = require('axios');

const response = await axios.post(
  'https://ask.divineapi.com/session/delete',
  {
    'session_id': "session090091",
    'user_id': "u_8812dwqdq",
  },
  {
  headers: {
      'Content-Type': "application/json",
      'Authorization': "Bearer {api_acc_token}",
      'x-api-key': "{api-key}",
    },
}
);

console.log(response.data);
import requests

url = "https://ask.divineapi.com/session/delete"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_acc_token}",
    "x-api-key": "{api-key}",
}
payload = {
    "session_id": "session090091",
    "user_id": "u_8812dwqdq",
}

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

print(response.json())
const response = await fetch(
  'https://ask.divineapi.com/session/delete',
  {
    method: 'POST',
    headers: {
        'Content-Type': "application/json",
        'Authorization': "Bearer {api_acc_token}",
        'x-api-key': "{api-key}",
      },
    body: JSON.stringify({"session_id":"session090091","user_id":"u_8812dwqdq"}),
  }
);

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

use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('POST', 'https://ask.divineapi.com/session/delete', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer {api_acc_token}',
        'x-api-key' => '{api-key}',
    ],
    'json' => [
        'session_id' => 'session090091',
        'user_id' => 'u_8812dwqdq',
    ],
]);

echo $response->getBody();
package main

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

func main() {
    jsonBody := []byte(`{"session_id":"session090091","user_id":"u_8812dwqdq"}`)
    req, _ := http.NewRequest("POST", "https://ask.divineapi.com/session/delete", bytes.NewBuffer(jsonBody))
    req.Header.Set("Content-Type", "application/json")
    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();

        MediaType JSON = MediaType.get("application/json; charset=utf-8");
        String json = "{\"session_id\":\"session090091\",\"user_id\":\"u_8812dwqdq\"}";
        RequestBody body = RequestBody.create(json, JSON);

        Request request = new Request.Builder()
            .url("https://ask.divineapi.com/session/delete")
            .post(body)
            .addHeader("Content-Type", "application/json")
            .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/session/delete")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer {api_acc_token}", forHTTPHeaderField: "Authorization")
request.setValue("{api-key}", forHTTPHeaderField: "x-api-key")

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let jsonBody = """{"session_id":"session090091","user_id":"u_8812dwqdq"}"""
request.httpBody = jsonBody.data(using: .utf8)

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 mediaType = "application/json".toMediaType()
    val body = "{\"session_id\":\"session090091\",\"user_id\":\"u_8812dwqdq\"}".toRequestBody(mediaType)

    val request = Request.Builder()
        .url("https://ask.divineapi.com/session/delete")
        .post(body!!)
        .addHeader("Content-Type", "application/json")
        .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}");

using System.Text;
        var json = "{\"session_id\":\"session090091\",\"user_id\":\"u_8812dwqdq\"}";
        var content = new StringContent(json, Encoding.UTF8, "application/json");

        var response = await client.PostAsync("https://ask.divineapi.com/session/delete", content);
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}
Response 200
{
    "deleted": true,
    "session_id": "session090091",
    "messages_removed": 2
}