POST

Yoga Durations information

Calculate the active Nitya Yoga for a specific date, time, and geographical location using the positions of the Sun and Moon. Retrieve Yoga details and duration information for Hindu Panchang, Vedic astrology, and religious calendar applications.

/yoga-durations
Method
POST
Format
JSON
Auth
API Key
Credits
1

Overview

The Yoga Durations API calculates the Nitya Yoga active at a given date, time, and geographical location. In Hindu astrology, Nitya Yoga is one of the five essential elements of the Panchang and is determined by the combined celestial longitudes of the Sun and Moon.

The API returns the Yoga number, name, completion time, and the percentage of the current Yoga remaining. It can also provide information about the subsequent Yoga, helping developers identify Yoga transitions and display accurate daily Panchang timings.

This endpoint is useful for developing Hindu Panchang applications, daily astrology dashboards, Muhurta calculators, religious calendars, and Vedic astrology software. To calculate Yoga durations, provide the date, time, latitude, longitude, and timezone. You can also configure the observation point as geocentric or topocentric and select a supported Ayanamsha setting, such as Lahiri. The API returns the results in JSON format for easy integration into web and mobile applications.

Request Parameters

Parameter Type Required Description Example
year
integer Yes Year number, eg: 2023 2023
month
integer Yes Month number,with no leading zero 7
date
integer Yes Day number,with no leading zero 5
hours
integer Yes Hours number,with no leading zero 1
minutes
integer Yes Minutes number,with no leading zero 1
seconds
integer Yes Seconds number, with no leading zero 0
latitude
float Yes Latitude number, in the range from -90 to 90 12.86
longitude
float Yes Longitude number, in the range from -180 to 180 123.5
timezone
float Yes Timezone of birth location, eg: 5.5 5.5
📦 config
object No Contains optional configuration values
ayanamsha
string No Either "tropical" or "sayana" or "lahiri" Either "tropical" or "sayana" or "lahiri"
observation_point
string No Geocentric positions are calculated with respect to the center of Earth. Topocentric positions are calculated with respect to the actual given place Either "topocentric" or "geocentric"

Request Example

{
    "year": 2022,
    "month": 8,
    "date": 11,
    "hours": 6,
    "minutes": 0,
    "seconds": 0,
    "latitude": 17.38333,
    "longitude": 78.4666,
    "timezone": 5.5,
    "config": {
        "observation_point": "topocentric",
        "ayanamsha": "lahiri"
    }
}

Response Examples

Example responses returned by this API.

Response
{
    "statusCode": 200,
    "output": "\"{\\\"1\\\": {\\\"number\\\": 6, \\\"name\\\": \\\"Atiganda\\\", \\\"completion\\\": \\\"2025-08-11 21:32:40\\\", \\\"yoga_left_percentage\\\": 51.774171246685086}, \\\"2\\\": {\\\"number\\\": 7, \\\"name\\\": \\\"Sukarman\\\", \\\"completion\\\": \\\"2025-08-12 18:52:32\\\"}}\""
}

Code Examples

Use the following examples to integrate this API into your application.

PHP Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://json.freeastrologyapi.com/yoga-durations',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "year": 2025,
    "month": 8,
    "date": 11,
    "hours": 10,
    "minutes": 25,
    "seconds": 43,
    "latitude": 17.68009,
    "longitude": 83.20161,
    "timezone": 5.5,
    "config": {
        "observation_point": "geocentric", 
        "ayanamsha": "lahiri" 
    }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'x-api-key: YOUR_API_KEY_HERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Python Code
import requests
import json

url = "https://json.freeastrologyapi.com/yoga-durations"

payload = json.dumps({
  "year": 2025,
  "month": 8,
  "date": 11,
  "hours": 10,
  "minutes": 25,
  "seconds": 43,
  "latitude": 17.68009,
  "longitude": 83.20161,
  "timezone": 5.5,
  "config": {
    "observation_point": "geocentric",
    "ayanamsha": "lahiri"
  }
})
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'YOUR_API_KEY_HERE'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Node JS Code
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://json.freeastrologyapi.com/yoga-durations',
  'headers': {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    "year": 2025,
    "month": 8,
    "date": 11,
    "hours": 10,
    "minutes": 25,
    "seconds": 43,
    "latitude": 17.68009,
    "longitude": 83.20161,
    "timezone": 5.5,
    "config": {
      "observation_point": "geocentric",
      "ayanamsha": "lahiri"
    }
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});