Перейти до вмісту
AstroWay/api v2.19.0 · docs
усі системи в нормі
UA EN

Create Webhook Subscription

POST
/webhooks/subscribe

Subscribe to outbound webhook deliveries. Events: report-ready, transit-alert, eclipse-alert. Returns a signing_secret used to verify the X-AstroWay-Signature HMAC-SHA256 header on each delivery.

curl -X POST https://api.astroway.info/v1/webhooks/subscribe \
-H "X-Api-Key: aw_live_..." \
-H "Content-Type: application/json" \
-d '{ "event": "report-ready", "url": "https://example.com/webhooks/astroway" }'
object
event
required
string
Allowed values: report-ready transit-alert eclipse-alert transit-trigger retrograde-start retrograde-end return-due dasha-change mahadasha-end void-of-course-start planetary-hour-tick sign-ingress
url
required
string format: uri
<= 2048 characters
Example
{
"event": "report-ready",
"url": "https://example.com/webhooks/astroway"
}

Successful calculation

object
ok
boolean
Example
true
data
object
id
number
event
string
url
string
signing_secret
string
active
boolean
created_at
string
Example
{
"ok": true,
"data": {
"id": 42,
"event": "report-ready",
"url": "https://example.com/webhooks/astroway",
"signing_secret": "0a1b…",
"active": true,
"created_at": "2026-05-08T12:00:00Z"
}
}

Validation error

Example
{
"ok": false,
"error": {
"code": "INVALID_INPUT",
"message": "Validation failed: date: Date must be YYYY-MM-DD",
"details": [
{
"path": "date",
"message": "Date must be YYYY-MM-DD"
}
]
}
}

Missing or invalid API key

Example
{
"ok": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}
}
Корисно?