POST / GET · WESTERN

Chart Image

Endpoint POST https://starsapi.com/api/v3/western/natal/chart-image
GET  https://starsapi.com/api/v3/western/natal/chart-image?key=...&expires=...&token=...

Overview

Returns a direct PNG image of the natal wheel chart (not JSON). Two access modes:

  • POST — send birth data + API key, receive PNG directly. Good for server-side generation.
  • GET — use a signed URL from natal/chart. No API key needed. Good for embedding in <img> tags and sharing.

Image specs: 1100×1100 pixels, PNG RGBA, typically 250–300 KB. Shows zodiac wheel with house cusps, planet glyphs, degree markers, and color-coded aspect lines.

Authentication

ModeAuthentication
POSTAPI key via X-Api-Key header or request body.
GETHMAC-signed URL parameters (key, expires, token). No API key needed.

POST mode (direct)

Send birth data as JSON, receive PNG:

FieldTypeRequiredDescription
yearintegerYesBirth year (1800–2400).
monthintegerYesBirth month (1–12).
dayintegerYesBirth day.
hourintegerYesBirth hour (0–23).
minuteintegerYesBirth minute (0–59).
secondintegerNoDefault 0.
latitudenumberYesDecimal degrees (−90 to 90).
longitudenumberYesDecimal degrees (−180 to 180).
timezonestringYesIANA timezone.
house_systemstringNoDefault placidus.
show_aspectsbooleanNoDraw aspect lines on chart. Default true.
major_aspects_onlybooleanNoOnly draw major aspect lines. Default true.
namestringNoNative’s name (top-left corner).
placestringNoBirth place (separate line below date/time).
brandingstringNoAttribution line below birth info.
center_textstringNoChart center text. Empty string = no center text.
birth_infostringNoCustom birth info line. If omitted, auto-generated as May 20, 1990, 14:30 IST.
birth_placestringNoExplicit place line. Falls back to place if not set.

GET mode (signed URL)

Use the chart_url returned by natal/chart:

<img src="https://starsapi.com/api/v3/western/natal/chart-image?key=abc123&expires=1781760879&token=def456" />
ParamDescription
keyCache key (MD5 hash of birth data + options).
expiresUnix timestamp when the URL expires (24 hours from generation).
tokenHMAC-SHA256 signature.

The GET mode uses cached chart data and branding from the original natal/chart call. The branding options you sent when generating the signed URL are baked into the cache.

Branding

See natal/chart branding options for the full layout. Same options apply in POST mode. In GET mode, branding is taken from the cached data.

Caching

Generated PNGs are cached on disk for 24 hours. The X-Cache response header indicates HIT (served from cache) or MISS (freshly rendered). Cache keys include birth data and branding options, so the same birth data with different branding produces separate cached images.

Errors

Errors are returned as JSON (not PNG) with appropriate HTTP status codes:

HTTPCodeCause
400MISSING_FIELDRequired field absent (POST mode).
400INVALID_JSONRequest body is not valid JSON.
400VALIDATION_ERRORMissing signed URL parameters (GET mode).
403TOKEN_EXPIREDSigned URL has expired (GET mode).
403INVALID_TOKENHMAC signature mismatch (GET mode).
404CACHE_MISSChart data not in cache — regenerate via natal/chart.
500EPHEMERIS_ERRORSwiss Ephemeris computation failed.
500CHART_ERRORImage generation failed.

See also