Karana API with Gin
Integrate Karana API in Gin. Complete code examples and SDK documentation.
Operation
POST /v2/astrology/karana
Karana (half-tithi) for a given datetime and location, with its nature and recommended/avoided activities.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
datetime | body | string | — |
latitude | body | number | — |
longitude | body | number | — |
timezone | body | string | — |
Request example for Gin
Authenticate with Authorization: Bearer YOUR_API_KEY. Keep the key in the VEDIKA_API_KEY environment variable on your server and never in source control.
package main
import (
"io"
"net/http"
"os"
"strings"
)
const payload = `{
"datetime": "2026-03-23T12:00:00",
"latitude": 28.6139,
"longitude": 77.209,
"timezone": "+05:30"
}`
func callVedika() ([]byte, int, error) {
req, err := http.NewRequest("POST", "https://api.vedika.io/v2/astrology/karana", strings.NewReader(payload))
if err != nil {
return nil, 0, err
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VEDIKA_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
return nil, 0, err
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
return data, res.StatusCode, err
}
// r := gin.Default()
func vedika(c *gin.Context) {
data, status, err := callVedika()
if err != nil {
c.Status(http.StatusBadGateway)
return
}
c.Data(status, "application/json", data)
}
// r.GET("/vedika/karana", vedika)
Try it in the keyless sandbox
The sandbox mirrors the production route and needs no API key:
curl -X POST https://api.vedika.io/sandbox/astrology/karana \
-H "Content-Type: application/json" \
-d '{"datetime":"2026-03-23T12:00:00","latitude":28.6139,"longitude":77.209,"timezone":"+05:30"}'
Sandbox response from POST /sandbox/astrology/karana, abridged (billing block, long text fields and long lists trimmed). The sandbox answers with a fixed demo result and ignores your inputs; a production call computes the result for the details you send.
{
"data": {
"ayanamsa": {
"id": 1,
"name": "Lahiri",
"value": 23.79065
},
"coordinates": {
"latitude": 28.6139,
"longitude": 77.209
},
"datetime": "1995-01-01T12:00:00+05:30",
"disha_shool": {
"description": "West direction is inauspicious on Sunday.",
"direction": "West",
"directionHindi": "पश्चिम",
"remedies": [
"Eat jaggery before traveling west"
],
"safeDirections": [
"East"
]
},
"guidance": {
"activitiesToAvoid": [
"Starting new ventures"
],
"bestActivities": [
"Pitru worship"
],
"overallAuspiciousness": "Excellent",
"tips": [
"Amavasya is sacred for honoring ancestors - offer prayers and reflect on family lineage."
]
},
"hinduYear": {
"masa": {
"amanta": {
"adhika": false,
"label": "Margashirsha",
"name": "Margashirsha"
},
"purnimanta": {
"adhika": false,
"label": "Pausha",
"name": "Pausha"
}
},
"reckoning": "chaitradi",
"samvatsara": {
"label": "Bhava",
"name": "Bhava",
"number": 8,
"shaka": {
"label": "Bhava",
"name": "Bhava",
"number": 8,
"year": 1916
},
"vikram": {
"label": "Sarvajit",
"name": "Sarvajit",
"number": 21,
"year": 2051
}
},
"shakaSamvat": 1916,
"vikramSamvat": 2051,
"yearStartedAt": "1994-04-11T05:47:06+05:30"
}
},
"meta": {
"contentMode": "fixture",
"engine": "vedika-intelligence",
"fixtureId": "demo-birth-1995-new-delhi",
"inputUsage": "ignored",
"mode": "sandbox",
"sample": true
},
"success": true
}
Related
The same endpoint in other stacks:
Last updated: 22 November 2026