AstroAsk Docs

Batch & field filtering

Up to 50 calculations in one request, and dot-path filtering to receive only the fields you need.

Batch requests

POST /v1/batch executes up to 50 calculations in a single HTTP request — the way to assemble a complete birth chart (/ascendant + /planets + /houses/vedic + /navamsa + …) in one round trip, and the tool for bulk historical processing and backfills.

Direct API only. /batch is available with ak_ keys against api.astroask.app. It is not offered through marketplace resellers (there it returns 404 NOT_AVAILABLE), because marketplaces meter by HTTP request.

curl -X POST https://api.astroask.app/v1/batch \
  -H "X-API-Key: ak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      { "path": "/planets",   "body": { "date": "1990-01-15T10:30:00", "lat": 28.6139, "lng": 77.2090 } },
      { "path": "/moon-sign", "body": { "date": "1992-06-20T14:00:00", "lat": 19.076,  "lng": 72.8777 } }
    ]
  }'

The response preserves order, with one envelope per item:

{
  "success": true,
  "data": {
    "results": [
      { "status": 200, "body": { "success": true, "data": { "planets": [ ] } } },
      { "status": 200, "body": { "success": true, "data": { "planet": "Moon" } } }
    ]
  }
}

Semantics worth knowing:

  • Quota: a batch of N costs exactly N units, reserved up front. If your remaining monthly quota cannot cover the whole batch, the entire batch is rejected (429 QUOTA_EXCEEDED) and nothing is charged.
  • Partial failure is fine: one invalid item gets its own error envelope (400, 404, …) while the rest succeed. The outer request stays 200.
  • Item bodies are byte-identical to what the same call would return directly — same envelope, same precision.
  • Nested batches are rejected (NESTED_BATCH), and unknown paths fail per-item with 404.

Field filtering

The larger composite endpoints — /western, /compatibility, /muhurat — accept an optional fields array of dot-paths. Only the requested branches are returned:

curl -X POST https://api.astroask.app/v1/western \
  -H "X-API-Key: ak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "1990-01-15T10:30:00", "lat": 28.6139, "lng": 77.2090,
    "fields": ["planets", "aspects"]
  }'

Rules:

  • Omitting fields returns the complete response, byte-identical to before the feature existed — it is strictly opt-in.
  • Unknown paths are skipped silently; the structure of what you did request is preserved.
  • Filtering is a payload optimization, not a price change: the full calculation still runs and the request still costs one unit.