Authentication
Every call to /v1, /compat and /mcp needs an API key.
- Create keys in the dashboard.
- The secret is shown once. Store it in your secrets manager.
- Keep keys on your server, never in a mobile app or web page.
- Send the same key in any style below, so code for other vendors keeps working.
1. x-api-key header (recommended)
curl -X POST https://api.bestastroapi.in/v1/chart/planets \
-H "x-api-key: $BESTASTRO_KEY" \
-d '{"datetime":"2004-05-18T10:30","lat":28.6139,"lon":77.209,"tz":"Asia/Kolkata"}'2. Bearer token
curl -X POST https://api.bestastroapi.in/v1/chart/planets \
-H "Authorization: Bearer $BESTASTRO_KEY" \
-d '{"datetime":"2004-05-18T10:30","lat":28.6139,"lon":77.209,"tz":"Asia/Kolkata"}'3. HTTP Basic (AstrologyAPI.com style)
- The username is ignored. The password is your key.
- Clients that send
userId:apiKeywork after you replace the key. - Clients that send an access token in the
x-astrologyapi-keyheader work too: put your key there.
curl -X POST https://api.bestastroapi.in/compat/astrologyapi/v1/planets \
-u "any-user:$BESTASTRO_KEY" \
-d '{"day":18,"month":5,"year":2004,"hour":10,"min":30,"lat":28.6139,"lon":77.209,"tzone":5.5}'4. api_key query parameter (VedicAstroAPI style)
curl "https://api.bestastroapi.in/compat/vedicastroapi/v3-json/horoscope/planet-details?api_key=$BESTASTRO_KEY&dob=18/05/2004&tob=10:30&lat=28.6139&lon=77.209&tz=5.5&lang=en"Query strings end up in logs. Prefer a header for new code.
Website keys
- A web page must not contain a secret key.
- For a birth place field, use a website key (
site_live_) with the place box. - A website key cannot call anything else.
Prokerala-style OAuth tokens
Prokerala clients exchange a client id and secret for a one-hour bearer token.
client_id: your key's idclient_secret: your key's secret
curl -X POST https://api.bestastroapi.in/compat/prokerala/token \
-d grant_type=client_credentials \
-d client_id=$KEY_ID \
-d client_secret=$BESTASTRO_KEY
# {"access_token":"pk....","token_type":"Bearer","expires_in":3600}Dashboard sessions
- The website signs you in with a phone OTP.
- It uses a session token (
Authorization: Bearer) for/dash/*and/billing/*. - Calls from the dashboard playground and astrologer desk count like any other call.
Errors
A missing or unknown key returns 401 with code invalid_key. See Errors.