Skip to content

Client SDKs

AstroAPI provides client SDKs for popular programming languages. These SDKs are generated from our OpenAPI specification and provide type-safe access to all API endpoints.

Available SDKs

LanguageDownloadDescription
TypeScriptDownloadTypeScript client with full type definitions using Fetch API
JavaScriptDownloadJavaScript client with Promise-based API
PythonDownloadPython client using the requests library
PHPDownloadPHP client with PSR-7 HTTP support

Installation

TypeScript / JavaScript

Extract the SDK and add it to your project:

bash
unzip astroapi-sdk-typescript.zip -d ./astroapi-sdk

Import and use:

typescript
import { Configuration, CalculationsApi } from "./astroapi-sdk";

const config = new Configuration({
    basePath: "https://api.astroapi.cloud",
    headers: {
        "X-Api-Key": "your-api-key"
    }
});

const api = new CalculationsApi(config);

const chart = await api.postApiCalcNatal({
    datetime: "1990-06-15T14:30:00",
    latitude: 51.5074,
    longitude: -0.1278,
    timezone: "Europe/London"
});

Python

Extract and install dependencies:

bash
unzip astroapi-sdk-python.zip -d ./astroapi
cd astroapi
pip install -r requirements.txt

Usage:

python
from astroapi import Configuration, ApiClient, CalculationsApi

configuration = Configuration(
    host="https://api.astroapi.cloud"
)
configuration.api_key["X-Api-Key"] = "your-api-key"

with ApiClient(configuration) as api_client:
    api = CalculationsApi(api_client)
    chart = api.post_api_calc_natal(
        datetime="1990-06-15T14:30:00",
        latitude=51.5074,
        longitude=-0.1278,
        timezone="Europe/London"
    )

PHP

Extract and install via Composer:

bash
unzip astroapi-sdk-php.zip -d ./astroapi
cd astroapi
composer install

Usage:

php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = AstroAPI\Configuration::getDefaultConfiguration()
    ->setHost('https://api.astroapi.cloud')
    ->setApiKey('X-Api-Key', 'your-api-key');

$apiInstance = new AstroAPI\Api\CalculationsApi(
    new GuzzleHttp\Client(),
    $config
);

$chart = $apiInstance->postApiCalcNatal(
    '1990-06-15T14:30:00',
    51.5074,
    -0.1278,
    'Europe/London'
);

SDK Generation

If you need an SDK for a different language, you can generate one yourself:

bash
npx @openapitools/openapi-generator-cli generate \
  -i https://api.astroapi.cloud/openapi \
  -g <generator-name> \
  -o ./output

See the OpenAPI Generator documentation for a full list of available generators.

Next Steps

AstroAPI Documentation