Authentication
AstroAPI supports multiple authentication methods depending on your use case.
API Key Authentication
API keys are the recommended method for server-to-server communication.
Obtaining an API Key
- Log in to the AstroAPI Dashboard
- Navigate to Settings > API Keys
- Click Create API Key
- Configure permissions and rate limits
- Copy the generated key (it won't be shown again)
Using API Keys
Include your API key in the X-Api-Key header:
bash
curl -X GET "https://api.astroapi.cloud/api/calc/natal" \
-H "X-Api-Key: ak_live_xxxxxxxxxxxx"API Key Permissions
API keys can be scoped to specific permissions:
| Permission | Description |
|---|---|
calc:read | Access calculation endpoints |
content:read | Access content/interpretation endpoints |
chart:read | Access chart rendering endpoints |
modules:read | Access purchased modules |
Organization Context
For multi-tenant applications, API keys are scoped to organizations. The organization context is automatically applied based on the API key used.
Security Best Practices
- Never expose API keys in client-side code
- Rotate API keys periodically
- Use the minimum required permissions
- Monitor API key usage in the dashboard