search

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

Find Samvat API

The Find Samvat API provides details about the Vikram Samvat and Shaka Samvat years based on a given date, time, and location. These traditional Indian calendar systems are central to astrological and historical timekeeping in Indian culture.


Step-by-Step Postman Testing Integration

For a complete walkthrough on how to test this API using Postman, refer to the official documentation:
Step by Step Find Samvat API Postman Testing Integration
https://support.divineapi.com/indian-astrology-apis/testing-panchang-api-find-samvat-api-using-postman


Supported Language Codes

This API supports multiple Indian languages for localized responses. You can specify the language by passing the lan parameter in the request body.

Reference Article:
https://support.divineapi.com/general-api-support/translating-an-indian-vedic-apis-into-a-different-language

CodeLanguage
enEnglish
hiHindi
bnBengali
maMarathi
tmTamil
tlTelugu
mlMalayalam
knKannada

Guide:
Include the lan field in the request body to get responses in a specific language. Default language is 'en'.


Endpoint

POST https://astroapi-2.divineapi.com/indian-api/v1/find-samvat

This endpoint returns Samvat (era) details based on the date, latitude, longitude, and timezone.


Headers

NameTypeDescription
AuthorizationStringYour API Access Token. Example: Bearer {token}

Request Body

NameTypeRequiredDescription
api_keyStringYesYour Divine API key.
dayIntegerYesDate of Panchang, e.g., 24.
monthIntegerYesMonth of Panchang, e.g., 05.
yearIntegerYesYear of Panchang, e.g., 2023.
placeStringNoPlace name, e.g., New Delhi.
latFloatYesLatitude of the location, e.g., 28.6139.
lonFloatYesLongitude of the location, e.g., 77.2090.
tzoneFloatYesTimezone offset, e.g., 5.5. See: https://developers.divineapi.com/divine-api/understanding-time-zones-a-comprehensive-guide
lanStringNoLanguage code from the table above (default: 'en').

200: OK Samvatsar Details Fetched Successfully

{
    "success": 1,
    "data": {
        "vikram_name": "pingala",
        "shaka_name": "sobhakrta",
        "shaka_year": 1945,
        "vikram_year": 2080
    }
}

Example Code Implementations

Below are example implementations in various programming environments.


cURL

curl --location 'https://astroapi-2.divineapi.com/indian-api/v1/find-samvat' \
--header 'Authorization: Bearer {Your Auth Token}' \
--form 'api_key="{Your API Key}"' \
--form 'day="24"' \
--form 'month="05"' \
--form 'year="2023"' \
--form 'Place="New Delhi"' \
--form 'lat="28.6139"' \
--form 'lon="77.2090"' \
--form 'tzone="5.5"' \
--form 'lan="en"'

Node.js

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://astroapi-2.divineapi.com/indian-api/v1/find-samvat',
  'headers': {
    'Authorization': 'Bearer {Your Auth Token}'
  },
  formData: {
    'api_key': '{Your API Key}',
    'day': '24',
    'month': '05',
    'year': '2023',
    'Place': 'New Delhi',
    'lat': '28.6139',
    'lon': '77.2090',
    'tzone': '5.5',
    'lan': 'en'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

JavaScript (jQuery AJAX)

var form = new FormData();
form.append("api_key", "{Your API Key}");
form.append("day", "24");
form.append("month", "05");
form.append("year", "2023");
form.append("Place", "New Delhi");
form.append("lat", "28.6139");
form.append("lon", "77.2090");
form.append("tzone", "5.5");
form.append("lan", "en");

var settings = {
  "url": "https://astroapi-2.divineapi.com/indian-api/v1/find-samvat",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {Your Auth Token}"
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Python

import requests

url = "https://astroapi-2.divineapi.com/indian-api/v1/find-samvat"

payload = {'api_key': '{Your API Key}',
'day': '24',
'month': '05',
'year': '2023',
'Place': 'New Delhi',
'lat': '28.6139',
'lon': '77.2090',
'tzone': '5.5',
'lan': 'en'}

headers = {
  'Authorization': 'Bearer {Your Auth Token}'
}

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

print(response.text)


Notes and Best Practices

Always include both Authorization (Bearer token) and api_key in your request.

Ensure that latitude, longitude, and timezone are accurate to get the correct Samvat values.

The response returns both Vikram Samvat and Shaka Samvat, along with their respective names.

Use the lan parameter to get localized results when available.

API requests must be made over HTTPS only for security reasons.