Skip to content

Quickstart

Send a real request, read a real response, then wire it into your code. The first step needs no account.

1. Try it without signing up

Open the playground, pick an endpoint and press send. It calls the running API with live data — no account, no card, no key. Do this first: it takes a few seconds and tells you whether the response has what your product needs, before you write anything.

2. Get a key

Create an account and generate a key from the keys page. New accounts start with 150 free credits, spendable on the real API with a live key — not a sandbox with its own data.

The key is shown once and stored only as a hash, so we cannot recover it for you — put it straight into your secret manager. If you lose it, rotate rather than asking support.

3. Make the call

Everything is a POST with a JSON body, authenticated with an X-API-Key header. This asks for today's panchang in Jaipur:

curl
curl -X POST https://api.occultapi.com/api/astro/panchanga/ \
  -H "X-API-Key: $OCCULT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date_time": "2026-09-16T06:00:00+05:30",
    "latitude": 26.9124,
    "longitude": 75.7873,
    "timezone_as_float": 5.5,
    "keys": ["tithi", "nakshatra", "yogam", "karana", "sunrise"]
  }'
TypeScript
const response = await fetch(
  "https://api.occultapi.com/api/astro/panchanga/",
  {
    method: "POST",
    headers: {
      "X-API-Key": process.env.OCCULT_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      date_time: "2026-09-16T06:00:00+05:30",
      latitude: 26.9124,
      longitude: 75.7873,
      timezone_as_float: 5.5,
      keys: ["tithi", "nakshatra", "yogam", "karana", "sunrise"],
    }),
  },
);

const body = await response.json();
if (body.is_error) throw new Error(body.message);
console.log(body.data);
Python
import os, requests

response = requests.post(
    "https://api.occultapi.com/api/astro/panchanga/",
    headers={"X-API-Key": os.environ["OCCULT_API_KEY"]},
    json={
        "date_time": "2026-09-16T06:00:00+05:30",
        "latitude": 26.9124,
        "longitude": 75.7873,
        "timezone_as_float": 5.5,
        "keys": ["tithi", "nakshatra", "yogam", "karana", "sunrise"],
    },
)

body = response.json()
if body["is_error"]:
    raise RuntimeError(body["message"])
print(body["data"])

4. Read the response

Every response uses the same envelope. Branch on is_error; the result is under data, keyed by what you asked for.

Response
{
  "data": {
    "tithi":     { "name": "Chaturthi", "ends_at": "2026-09-16T21:14:22+05:30" },
    "nakshatra": { "name": "Chitra",    "pada": 2 },
    "yogam":     { "name": "Shukla" },
    "karana":    { "name": "Vanija" },
    "sunrise":   "2026-09-16T06:14:03+05:30"
  },
  "status": 200,
  "is_error": false,
  "message": "successful"
}

Field shapes vary by endpoint, and every endpoint page in the reference shows a real captured response rather than an invented one.

5. Check what it cost

The response headers tell you, so you do not need a second call:

X-Credits-Cost:      1
X-Credits-Charged:   1     # 0 on any error — you are billed for answers
X-Credits-Remaining: 149

Ask for several keys in one request rather than making several requests. The price is the same either way, so one call for five calculations costs a fifth of five calls.

Would rather not write the plumbing?

Point an AI assistant at our MCP server and it can search the endpoints, read a request schema and make the call itself — searching and reading the docs cost no credits. If you are working with a coding agent, hand it /agents first. To generate a typed client in any language, use the OpenAPI spec.

Next