Create API Key
curl -X POST https://api.astroway.info/v1/keys \ -H "X-Api-Key: aw_live_..." \ -H "Content-Type: application/json" \ -d '{ "name": "My App", "mode": "live", "allowed_endpoints": [ "chart", "embed/*" ], "credits_cap_cycle": 20000 }'const res = await fetch('https://api.astroway.info/v1/keys', { method: 'POST', headers: { 'X-Api-Key': process.env.ASTROWAY_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "My App", "mode": "live", "allowed_endpoints": [ "chart", "embed/*" ], "credits_cap_cycle": 20000 }),});const { ok, data, error } = await res.json();if (!ok) throw new Error(error.message);console.log(data);import os, requests
r = requests.post( 'https://api.astroway.info/v1/keys', headers={'X-Api-Key': os.environ['ASTROWAY_API_KEY'], 'Content-Type': 'application/json'}, json={ 'name': "My App", 'mode': "live", 'allowed_endpoints': [ "chart", "embed/*" ], 'credits_cap_cycle': 20000 },)result = r.json()if not result['ok']: raise RuntimeError(result['error']['message'])print(result['data'])<?phpuse GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.astroway.info/v1/']);$r = $client->post('keys', [ 'headers' => ['X-Api-Key' => getenv('ASTROWAY_API_KEY')], 'json' => [ 'name' => 'My App', 'mode' => 'live', 'allowed_endpoints' => ['chart', 'embed/*'], 'credits_cap_cycle' => 20000, ],]);$result = json_decode($r->getBody(), true);if (!$result['ok']) throw new \RuntimeException($result['error']['message']);print_r($result['data']);Create a new API key. Requires an internal or enterprise API key. Returns the generated key string: save it, it cannot be retrieved later. The plan comes from the account and is not accepted in the body. allowed_endpoints limits the key to a subset of the API: paths under /v1, exact (“chart”) or a namespace (“embed/*”); omit it and the key may call everything the plan includes. credits_cap_cycle caps what this key may spend per billing cycle (0 parks it). A publishable key (origin_restriction.type “public”, prefix pk_) is for page source, so it needs allowed_origins, credits_cap_cycle and allowed_endpoints: without any of them the request is refused with 400, and a pk_ key missing a bound is refused with 403 PUBLISHABLE_KEY_UNBOUNDED wherever it is used.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Comma-separated dotted paths, relative to data, to keep in the response. A path is applied to every element of an array, so planets.name means the name of each planet. Paths that match nothing come back in _fields_unmatched; a list where nothing matches at all is a 400, because an empty object would be a confident wrong answer.
Example
planets.name,planets.longitudeRound every non-integer number in the response to this many decimal places. Integers are left alone, because an id is not a measurement. Ecliptic longitudes ship with fourteen decimals by default; 2 is about a tenth of an arcminute.
Example
4Request Body required
Section titled “Request Body required ”object
Server-only (default): a backend key that refuses any request carrying Origin or Referer. public: a publishable pk_ key for page source; needs allowed_origins, credits_cap_cycle and allowed_endpoints, and refuses a request with no verifiable origin.
object
Paths under /v1 this key may call, exact (chart) or a namespace (embed/*). Omitted means no limit; required for a publishable key.
Credits this key may spend per billing cycle; 0 parks it. Omitted means no per-key cap; required for a publishable key.
Example
{ "name": "My App", "mode": "live", "allowed_endpoints": [ "chart", "embed/*" ], "credits_cap_cycle": 20000}Responses
Section titled “ Responses ”Successful calculation
object
object
object
Example
{ "ok": true, "data": { "id": 42, "api_key": "aw_free_a1b2c3d4e5f6a1b2c3d4e5f6", "api_key_masked": "aw_free…e5f6", "name": "My App", "plan": "free", "rate_limit": 10, "credits_limit": 10000, "credits_used": 0, "created_at": "2026-08-22T21:05:14.335Z", "last_used_at": null, "is_active": true, "origin_restriction": { "type": "server-only" }, "credits_cap_cycle": 20000, "allowed_endpoints": [ "chart", "embed/*" ] }}Validation error
Example
{ "ok": false, "error": { "code": "INVALID_INPUT", "message": "Validation failed: date: Date must be YYYY-MM-DD", "details": [ { "path": "date", "message": "Date must be YYYY-MM-DD" } ] }}Missing or invalid API key
Example
{ "ok": false, "error": { "code": "INVALID_API_KEY", "message": "Invalid API key" }}