Reading the response
A Free key calling POST /v1/dosha/kaal-sarp:
{
"request_id": "req_01M8RK47ECFSZYBZ224WPHGBH4",
"error": {
"code": "PLAN_REQUIRED",
"message": "/v1/dosha/kaal-sarp requires the hobby+ plan; current plan is free.",
"details": {
"required_tier": "hobby",
"current_plan": "free",
"endpoint": "/v1/dosha/kaal-sarp",
"upgrade_url": "/dashboard/billing/plans"
}
}
}required_tieris the lowest plan that unlocks the endpoint -hobby+means Hobby, Starter or Pro all work. Tiers only go up: a Hobby key callingPOST /v1/compatibility/batchgets"required_tier": "starter","current_plan": "hobby".endpointis the route pattern (/v1/reports/:id, not the id you sent), so it is safe to log and to group by.upgrade_urlis a path in the AstroNode dashboard, not on your site. Prefix it with the dashboard origin if you surface it to a developer; do not show it to your own end users.
Which plan the API thinks you are on
current_plan is your account's effective plan, worked out on every request, not just the plan stamped on the key:
- An
activeorpast_duesubscription gives you its plan. - A checkout you opened but never completed (
incomplete) is ignored - you stay on the key's plan. - An expired or cancelled subscription drops you to
free, even for keys created while you were paying. - Per-account quota or rate overrides granted by support never unlock a tier: they relieve limits, they are not an entitlement.
So if you upgraded and still see "current_plan": "free", check the subscription status in the dashboard before suspecting the key.
Handle it in your app
Switch on error.code === "PLAN_REQUIRED", not on the 403 status alone. Treat it as a product state rather than a failure: hide or badge the feature for your plan, or route the request to an endpoint your plan includes. The response's required_tier is the authoritative answer for an endpoint; pricing compares the plans.
FORBIDDEN is defined in the API's error list but no API-key request returns it today. A 403 from AstroNode is PLAN_REQUIRED.
Questions
- Does a PLAN_REQUIRED response use up my quota?
- No. The 403 appears in your usage history, but only answered calls (status below 400) consume quota, and the plan check runs before the per-minute limiter, so it takes no window slot either. It will fail identically every time, though - stop on the first PLAN_REQUIRED instead of retrying.
- Why do I get VALIDATION_ERROR instead of PLAN_REQUIRED?
- The request body is validated before the plan is checked. Send a valid body and the 403 will appear.