API


Introduction

The AstroAPI provides a REST-ful API which can easily be integrated in online applications, websites, mobile applications, ...

Basic Flow

To generate an astrological report from the AstroAPI, the system (your implementation) makes a request to the /api/auth endpoint with username and password. On correct authentication you'll receive an accessToken.

With a valid accessToken, you (the system) can make a request to the AstroAPI. To use the accessToken, send it in Header in the request as Authorization: Bearer [Your token]

With authentication fulfilled, you can now make requests to the AstroAPI. The system expects requests in json-format as body. Your system should set a header to Accept-Encoding: application/json then you're sure all responses will be in this format.

Example: Flow for generating a natal astrological report for a person

1. Retrieving the place_id

POST /api/places

Astrology makes use of latitude and longitude to do astronomical calculations to the solar bodies. The system can find the location for a given place name. This place_id is needed to perform the actual calculation in the next step.

Header Value
Accept-Encoding application/json
Authorization Bearer [accessToken]


body

{
    "name": "Paris"
}


Response (shortened)

(Places are ordered by population DESC)

{
    "data": [
        {
            "id": 1250015082,
            "name": "Paris",
            "longitude": 2.3522,
            "latitude": 48.8566,
            "country_code": "FR",
            "admin1_code": "FR-J",
            "population": 11020000,
            "timezone": "Europe/Paris"
        },
        {
            "id": 1840020594,
            "name": "Paris",
            "longitude": -95.546,
            "latitude": 33.6688,
            "country_code": "US",
            "admin1_code": "US-TX",
            "population": 26010,
            "timezone": "America/Chicago"
        },
            ...

2. Natal Horoscope Request

POST /api/natal

Header Value
Accept-Encoding application/json
Authorization Bearer [accessToken]


body

{
    "name": "Matthias",
    "date": "1987-03-27",
    "time": "13:13",
    "place_id": 1250015082,
    "lang": "en"
}


Response (shortened)

{
    "profile": {
        "name": "Matthias",
        "birthdate": {
            "date": "1987-03-27 13:13:00.000000",
            "timezone_type": 3,
            "timezone": "Europe/Paris"
        },
        "utBirthdate": {
            "date": "1987-03-27 12:13:00.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "cityName": "Paris",
        "lat": 48.8566,
        "long": 2.3522,
        "realLat": 49.42766666666667,
        "realLong": 2.5869999999999997,
        "east": true,
        "south": false,
        "dst": 1,
        "timezoneName": "Europe/Paris"
    },
    "intro": null,
    "planets": [
        {
            "speeds": "0.9901618",
            "housePosition": 9,
            "planetId": 0,
            "planetName": "Sun",
            "retrograde": false,
            "housetext": null,
            "longitude": "6.2958146",
            "signId": 0,
            "signName": "Aries",
            "degrees": 6,
            "minutes": 17,
            "seconds": 45,
            "collectText": true,
            "text": null
        },
        {
            "speeds": "14.0728099",
            "housePosition": 8,
            ...