How this page was checked: FlutterFlow was not run and no Dart was executed (there is no Dart runtime on the build machine). The backend endpoint was executed on Node 24 as a web-standard handler against the in-memory API, called with the JSON body the FlutterFlow call sends; the three time-zone results, the 400 and the 401 below are from those runs.
A key in a FlutterFlow API call ships in the app
An API call defined in FlutterFlow (URL, headers, body) becomes Dart code in your project, and that code is compiled into the Android and iOS builds and the web bundle. A header value is a string constant in the binary: anyone can pull it out of an APK, and in a web build it is visible in the browser's network panel. Putting the key in an app constant, app state or a hidden field changes nothing - it is still in the build.
So the AstroNode key must sit on a server you control. Two ways to get there:
- Your own endpoint (below): a small function on any host. The FlutterFlow call points at it and carries only the user's sign-in token.
- FlutterFlow's private API call option, in the call's advanced settings, which routes the call through a Firebase Cloud Function so the header never reaches the device. It needs Firebase connected to the project; it is the shorter route if you already use Firebase.
The endpoint
chart.mjs - a web-standard handler (Request → Response), deployable to most serverless hosts:
// POST /chart on your backend - the only URL the FlutterFlow app knows.
const ASTRONODE = process.env.ASTRONODE_BASE_URL ?? "https://api.astronode.dev";
export async function chart(request) {
const user = await verifyAppUser(request.headers.get("authorization")); // your auth: Firebase, Supabase...
if (!user) return Response.json({ error: "sign in" }, { status: 401 });
const { date, time, tz_offset_minutes, lat, lng } = await request.json();
const res = await fetch(`${ASTRONODE}/v1/charts/birth`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRONODE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ date, time, tz_offset_minutes, lat, lng }),
});
const json = await res.json();
if (!res.ok) return Response.json({ error: json.error.code, details: json.error.details ?? [] }, { status: res.status });
// Flat, display-ready fields: simple JSON paths in FlutterFlow.
const moon = json.data.planets.find((p) => p.name === "Moon");
return Response.json({
lagna: json.data.ascendant.sign,
moon_sign: moon.sign,
nakshatra: `${moon.nakshatra} (pada ${moon.nakshatra_pada})`,
planets: json.data.planets.map((p) => ({
name: p.name,
sign: p.sign,
house: p.house,
degree: Math.round(p.degree_in_sign * 100) / 100,
retro: p.retrograde,
})),
});
}verifyAppUser is your sign-in check - verify the Firebase ID token or Supabase JWT the app sends. Skip it and the endpoint is an open proxy to your AstroNode quota; in the run, a wrong token got 401 before any AstroNode call. Flattening the response on the server keeps the FlutterFlow side to one-level JSON paths.
The FlutterFlow API call
- Add an API call named
birthChart: methodPOST, URLhttps://your-backend.example.com/chart, and a header carrying the signed-in user's token (not the AstroNode key). - Declare variables
dateandtime(String),tz(Integer),latandlng(Double), and use them in the JSON body as shown. - Test the call with sample values, then add JSON paths for
$.lagna,$.moon_sign,$.nakshatraand$.planetsso widgets can bind to them; a ListView generates its children from$.planets.
Body - FlutterFlow fills each <variable>:
{
"date": "<date>",
"time": "<time>",
"tz_offset_minutes": <tz>,
"lat": <lat>,
"lng": <lng>
}Returned for 9 Oct 1992, 07:45, Pune (+330), planets trimmed to four:
{
"lagna": "Libra",
"moon_sign": "Aquarius",
"nakshatra": "Purva Bhadrapada (pada 1)",
"planets": [
{ "name": "Sun", "sign": "Virgo", "house": 12, "degree": 22.28, "retro": false },
{ "name": "Moon", "sign": "Aquarius", "house": 5, "degree": 22.46, "retro": false },
{ "name": "Mars", "sign": "Gemini", "house": 9, "degree": 20.21, "retro": false },
{ "name": "Mercury", "sign": "Libra", "house": 1, "degree": 8.76, "retro": false }
]
}The birthplace's offset, not the phone's
The quickest value to reach for in a FlutterFlow action is the device's current time zone. It is the wrong one: the chart needs the offset in force where and when the person was born. The same birth, sent with three offsets:
tz_offset_minutes | Lagna | Moon nakshatra |
|---|---|---|
330 (India - correct) | Libra | Purva Bhadrapada, pada 1 |
-300 (a phone in New York) | Pisces | Purva Bhadrapada, pada 3 |
0 (a phone or emulator on UTC) | Sagittarius | Purva Bhadrapada, pada 2 |
The Moon sign survives; the ascendant and every house do not. Store the birthplace's offset with the birth details - resolve it from the place and date on the backend if your users are not all in one country. Birth time and time zones covers historical offsets.
The mistakes that bite first
- A 12-hour time string. Formatting a time picker's value for display gives
07:45 AM; sent astimeit returned400withtime must be HH:mm or HH:mm:ss (24h), which the endpoint passes back indetails. Format with a 24-hour pattern (HH:mm) for the API and a separate one for the screen. - Extra fields. The endpoint destructures five fields before calling AstroNode, because the birth input rejects unknown keys - a FlutterFlow variable such as
timezoneadded to the body would otherwise be a400. - Testing with the real key in the call "just for now". Test builds get shared; rotate any key that has ever been in a FlutterFlow call.
/v1/charts/birthis on the Free plan, so a separate test key costs nothing.
Questions
- Which AstroNode endpoints does the FlutterFlow example call?
- 1 endpoint: Birth Chart (Kundli) (
POST /v1/charts/birth). - Was the FlutterFlow code on this page actually run?
- FlutterFlow was not run and no Dart was executed (there is no Dart runtime on the build machine). The backend endpoint was executed on Node 24 as a web-standard handler against the in-memory API, called with the JSON body the FlutterFlow call sends; the three time-zone results, the 400 and the 401 below are from those runs.