Introduction
This reference is your key to a complete understanding of Astrology API.
If this is your first time at AstrologyAPI, we recommend beginning with Getting Started Guide.
Conventions
The base URL to send all API requests is https://json.astrologyapi.com/v1/. HTTPS is required for all API requests.
The Astrology API follows RESTful conventions when possible, with most operations performed via POST requests on resources. Request and response bodies are encoded as JSON.
Code samples & SDKs
Samples requests and responses are shown for each endpoint. Requests are shown using the AstrologyAPI JavaScript SDK, and cURL. These samples make it easy to copy, paste, and modify as you build your integration.
Astrology API SDKs are open-source projects that you can install to easily start building. You may also choose any other language or library that allows you to make HTTP requests.
Authentication
Requests use the HTTP headers to both authenticate and authorize operations. We support two primary methods of authentication depending on the API suite you are using.
1. Using Access Token
For modern API suites like Chat or specific wallet features, you can use an Access Token (Wallet Token). This is passed as a custom header.
In Postman, navigate to the Headers tab and add a new header key named: x-astrologyapi-key. In the value field, paste your Access Token.

2. Using User ID and API Key (Basic Auth)
The Astrology API accepts Basic Auth in the Authorization header. This is used for our core astrological endpoints.
Basic Auth uses username and password. This is provided to you when you sign up at AstrologyAPI. User Id is the username and API Key is the password.

Code Sample
<?php
// Set the URL to send the request to
$url = 'https://json.astrologyapi.com/v1/sun_sign_prediction/daily/aries';
// Set the credentials
$username = 'userid';
$password = 'api_key';
// Encode the credentials in base64
$auth = base64_encode($username . ':' . $password);
// Initialize a cURL session
$ch = curl_init();
// Set the URL and other options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the Authorization header
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Basic ' . $auth
]);
// Execute the request
$response = curl_exec($ch);
// Close the cURL session
curl_close($ch);
// Print the response
echo $response;Error Codes
Responses from the API use HTTP response codes are used to indicate general classes of success and error. Error responses contain more detail about the error in the response body, in the code and message properties.
Something is wrong with your request format or parameters.
Your API key is missing or invalid.
You don't have permission to access this specific resource.
The API endpoint you're trying to reach doesn't exist.
Our server is having a temporary glitch.