Myastro API Quick Start

MyAstro API starting point to learn how developers can quickly and easily integrate the Vedic Astrology API. Start using our REST Astrology API in a few simple steps. Learn the basics, authentication process, and essential details to begin integration.

Introduction

MyAstro API is production-ready Vedic astrology API designed for developers, We provide highly available and accurate astrology data for websites, mobile applications and services.

This official documentation helps developers integrate the Myastro API easily into their projects. The documentation is organized into multiple levels to help both beginners and advanced developers use our Vedic astrology API efficiently.

New developers can start with quick start guide to understand how API works. You can find practical examples and real-world implementation references throughout the documentation.

API Base URL

Myastro API Base URL accepts only POST method requests. Requests with different HTTP methods may return an error response.

Base_url="https://json.api.myastro.online/v1/{topic}"

Every base url API request return a response in JSON format.


//API Response Format
{
	"status":200,    //Number: Status Code
	"data":{},       //Object with API data
	"version":"v1",  //String: API version
 	"c-id":"id"        //String: Cache ID
}

  

Authentication

Authentication with Myastro API is super easy and requires adding your API key in Authorization header. We recommend using Authorization: Bearer YOUR_API_KEY header with API requests to follow industry standards. However Authorization: YOUR_API_KEY should also work as expected.

You can read Authentication Guide to learn more about API authentication and security practices. Developer need a valid API key to receive API response. API key will be available after signing up on Myastro API dashboard.

First API Call

First API call You can get started instantly with our trusted Vedic Astrology API after signup. Here we are fetching Today's Abhijit Muhurat for Delhi. You may use this example as your API request.


<?php

// API URL
$apiUrl = "https://json.api.myastro.online/v1/abhijitmuhurat";

// Input Data
$data = [
    "date" => "01/01/2026",
    "lat"  => 28.6139,   // Delhi Latitude
    "long" => 77.2090,   // Delhi Longitude
    "tz"   => 5.5
];

// Convert array to JSON
$jsonData = json_encode($data);

// Initialize cURL
$ch = curl_init($apiUrl);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Authorization: Bearer YOUR_API_KEY"
]);

curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);

// Execute API Request
$response = curl_exec($ch);

// Check Errors
if (curl_errno($ch)) {

    echo "cURL Error: " . curl_error($ch);

} else {

    // Decode Response
    $result = json_decode($response, true);

    /*
    Expected Response Format

    {
      "status": 200,
      "data": {"start":"11:30","end":"13:02"},
      "version": "v1",
      "c_id": "023484dckndc293JSBXUEHUkwws"
    }
    */

    print_r($result);
}

// Close cURL
curl_close($ch);

?>

  

# API URL
api_url = "https://json.api.myastro.online/v1/abhijitmuhurat"

# Input Data
data = {
    "date": "01/01/2026",
    "lat": 28.6139,   # Delhi Latitude
    "long": 77.2090,  # Delhi Longitude
    "tz": 5.5
}

# Headers
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

# Import requests library
import requests

# Send POST Request
response = requests.post(
    api_url,
    json=data,
    headers=headers
)

# Check Response
if response.status_code == 200:

    # Decode JSON Response
    result = response.json()

    """
    Expected Response Format

    {
      "status": 200,
      "data": {"start":"11:30","end":"13:02"},
      "version": "v1",
      "c_id": "023484dckndc293JSBXUEHUkwws"
    }
    """

    print(result)

else:
    print("API Error:", response.status_code)