How this page was checked: Retool was not run. The request the query sends was executed with Node fetch against the in-memory API, and the transformer was executed on Node 24 with data bound to that real response, the way Retool binds it. The rows below are its output.
The resource holds the key
Create a REST API resource named AstroNode with base URL https://api.astronode.dev and one header, Authorization: Bearer aie_live_.... Queries that use a resource are sent from Retool's backend with the resource's configuration, so app users - who can open the browser's developer tools - never see the header. Only people allowed to edit resources can read it.
The way to undo that is a JavaScript query that calls fetch with the key in it: JavaScript queries run in each user's browser, so the key travels to every session. Keep AstroNode calls in resource queries.
The query
- Components: a date input
dateInputand a selectcitywhose options carrylat,lngandtz(offset in minutes). - A query
choghadiyaon theAstroNoderesource: methodPOST, path/v1/muhurta/choghadiya, JSON body as below. Let it run automatically when its inputs change, so the table follows the pickers. - A table whose data is
{{ choghadiya.data }}- with a transformer enabled, that is the transformer's output, not the raw response.
Body - the {{ }} parts are evaluated by Retool; numbers stay unquoted:
{
"date": "{{ dateInput.value }}",
"tz_offset_minutes": {{ city.selectedItem.tz }},
"lat": {{ city.selectedItem.lat }},
"lng": {{ city.selectedItem.lng }}
}The transformer
The response has two arrays, day and night, of eight windows each, with start and end as UTC instants. The transformer merges them and converts the times to the chosen place's clock - not the browser's, since an operator in Dubai may be planning a ceremony in Bengaluru:
Transformer on the choghadiya query:
// Query transformer: `data` is the parsed response body.
const offset = {{ city.selectedItem.tz }}; // the place's offset, the same number sent in the body
const hhmm = (iso) => new Date(Date.parse(iso) + offset * 60000).toISOString().slice(11, 16);
return [...data.data.day.map((w) => ({ ...w, half: "Day" })), ...data.data.night.map((w) => ({ ...w, half: "Night" }))].map((w) => ({
half: w.half,
name: w.name,
from: hhmm(w.start),
to: hhmm(w.end),
quality: w.quality,
lord: w.lord,
}));| half | name | from | to | quality | lord |
|---|---|---|---|---|---|
| Day | Amrit | 06:29 | 07:54 | auspicious | Moon |
| Day | Kaal | 07:54 | 09:20 | inauspicious | Saturn |
| Day | Shubh | 09:20 | 10:45 | auspicious | Jupiter |
| Day | Rog | 10:45 | 12:10 | inauspicious | Mars |
| Day | Udveg | 12:10 | 13:36 | inauspicious | Sun |
| Day | Char | 13:36 | 15:01 | neutral | Venus |
| Day | Labh | 15:01 | 16:27 | auspicious | Mercury |
| Day | Amrit | 16:27 | 17:52 | auspicious | Moon |
| Night | Char | 17:52 | 19:27 | neutral | Venus |
| Night | Rog | 19:27 | 21:01 | inauspicious | Mars |
Day windows are an eighth of sunrise-to-sunset (about 85 minutes here, in December), night windows an eighth of sunset to the next sunrise (about 95), so the last night window ends at the next morning's sunrise, 06:29. Colour rows by quality in the table's row colour setting. Window rules: muhurta time windows.
The mistakes that bite first
- A date with a time. If the date component's value includes a time or offset (
2026-12-07T00:00:00.000+05:30), the API returns400withdate must be ISO YYYY-MM-DD. Set the component's value format to a plain date, or send only the first ten characters. - Hard-coding the offset in the transformer. The run above used
330for Bengaluru; a city list with a London entry needs0. Read it from the same selected item the body uses, as shown. - The plan.
/v1/muhurta/choghadiyais a Hobby endpoint; a Free key's query fails with403 PLAN_REQUIRED. Retool shows that as a query error, so put the API'serror.messagein the failure notification rather than a generic "query failed".
Questions
- Which AstroNode endpoints does the Retool example call?
- 1 endpoint: Choghadiya (
POST /v1/muhurta/choghadiya). - Was the Retool code on this page actually run?
- Retool was not run. The request the query sends was executed with Node fetch against the in-memory API, and the transformer was executed on Node 24 with
databound to that real response, the way Retool binds it. The rows below are its output.