API Documentation

'Online Solar Tools' offers a free API for many of its tools as documented below.
Please familarise yourself with the Terms & Conditions and use this service respectfully.

1. POST /sun_visible

Returns a boolean if the sun is visible at a particular location coordinate. Optionally you can specify a time to check if their will be sunlight

Request

Endpoint: POST https://api.onlinesolartools.com/sun_visible

x-www-form-urlencoded:

  • latitude (required) - Degree Decimal Latitude
  • longitude (required) - Degree Decimal Longitude.
  • datetime (optional) - Override the time to check (UTC Timestamp)

Response

Success (200): Returned JSON

{
    "visible": 0
}

Error (400): Bad Request.

{
    "error": "Invalid latitude or longitude"
}

2. POST /sunrise-sunset

Displays the Sunrise and Sunset for a particular coordinate

Request

Endpoint: POST https://api.onlinesolartools.com/sunrise-sunset

x-www-form-urlencoded:

  • latitude (required) - Degree Decimal Latitude
  • longitude (required) - Degree Decimal Longitude.
  • datetime (optional) - Override the time to check a certain day (UTC Timestamp)

Response

Success (200):Returned JSON

{
    "sunrise_utc": "2024-11-10T23:28:08Z",
    "sunset_utc": "2024-11-11T10:47:56Z",
    "sunrise_local": "2024-11-11T06:28:08",
    "sunset_local": "2024-11-11T17:47:56"
}

Error (400): Bad Request

{
    "error": "Invalid latitude or longitude. Ensure both are provided and within valid ranges."
}

3. POST /sun_position

Displays the altitude and azimuth of the sun for a particular coordinate

Request

Endpoint: POST https://api.onlinesolartools.com/sun_position

x-www-form-urlencoded:

  • latitude (required) - Degree Decimal Latitude
  • longitude (required) - Degree Decimal Longitude.
  • datetime (optional) - Override the time to check a certain date time either in the past or future (UTC Timestamp)

Response

Success (200): Returned JSON

{
    "altitude": 13.88,
    "azimuth": 110.68
}

Error (400): Bad Request

{
    "error": "Invalid latitude or longitude. Ensure both are provided and within valid ranges."
}

Rate Limiting

The OnlineSolarTools API is rate limited to 10 Requests per every 5 minute interval.
Requests beyond this will be rate limited and throttled with a 429 status code.

Too Many Requests (429):

{"error":"Rate limit exceeded. Try again later."}

HTTP & HTTPS Support

The OnlineSolarTools API is available using both a plaintext 'http', or an encrypted 'https' connection.
In most cases 'https' is recommended for security, however 'http' is still supported for devices with limited resources where it may be more suitable

Open source

Source code for our 'OnlineSolarTools' API tools is available for free under the MIT licence within our GitHub repository should you wish to review or make changes to the code or self host it on your own server.
This is recommended for commerical use or should you require far higher limits.