What gets translated
| curl | Becomes |
|---|---|
-X / --request | the HTTP method (GET or POST) |
-H 'Authorization: Bearer …' | a header read from ASTRONODE_API_KEY |
-d, --data, --data-raw, --json | the JSON body (json= in Python, JSON.stringify in Node) |
-s, -N, --compressed, -L | ignored - they do not change the request |
-u, -F, -T, -b | reported as not translated |
Quoting follows POSIX shells: single quotes, double quotes, '\'' escapes and backslash line continuations - the forms AstroNode's own snippets use. Windows cmd.exe ^ continuations are not supported; paste the command as one line or use the PowerShell form.
The generated code
Node.js (18+, built-in fetch) - the same generator the endpoint pages use:
const res = await fetch("https://api.astronode.dev/v1/charts/birth", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRONODE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ /* your body */ }),
});
if (!res.ok) throw new Error(`AstroNode ${res.status}: ${await res.text()}`);
const { data } = await res.json();Python uses requests with timeout=30 and raise_for_status(). Neither version needs an SDK. Chat endpoints return their fields at the top level, so for those the code prints the whole JSON instead of data.
Checks before you run it
- Host - is it the AstroNode API or chat origin?
- Endpoint - does the path exist, and with this method?
GET /v1/charts/birthis caught before it becomes a 404. - Body - every top-level field is compared with the endpoint's schema; unknown fields (a
400 VALIDATION_ERRORwaiting to happen) and missing required ones are listed. - Key - a pasted
aie_live_…oraie_test_…key is never copied into the code, and you are told to rotate it if it has been shared.
Common mistakes
- Hard-coding the key while translating by hand. Read it from the environment, and keep the call on your server.
- Sending the body as form data.
requests.post(url, data=...)form-encodes a dict; the API needsjson=. - Dropping `Content-Type` in Node. Without
application/jsonthe body is not parsed as JSON. - No timeout in Python.
requestswaits forever by default; the generated code sets 30 seconds.
FAQ
- Is my curl command or key sent anywhere?
- No. Parsing and code generation happen in your browser.
- Which languages are supported?
- Node.js (built-in
fetch) and Python (requests), matching the tabs on every endpoint page. For other languages, the request builder gives you the JSON body to send. - Does it work for GET endpoints with path parameters?
- Yes - a path such as
/v1/horoscope/daily/ariesis matched to its endpoint and kept as written.