How SaaSify reports failures, the HTTP status codes it sets, and what the common ones mean.
How errors are returned
SaaSify reports failures two ways, and you must handle both:
- Inside the envelope, on HTTP 200. Many business errors come back with HTTP
200 OKandStatus: "ERROR"in the body, with a message inErrorMessage. If you branch only on the HTTP status, you'll miss these. - As an HTTP status code. Transport and framework errors (auth, not found, bad input, server errors) set the HTTP status.
So the rule is: check the HTTP status and the Status field.
{
"Status": "ERROR",
"ErrorMessage": "Subscription not found for the given identifier.",
"RequestCorrelationID": "f1e2d3c4-...",
"Data": null
}r = requests.post(url, json=body, headers=headers)
# 1. transport / framework errors
if r.status_code >= 400:
raise RuntimeError(f"HTTP {r.status_code}: {r.text}")
# 2. business errors returned on HTTP 200
payload = r.json()
if payload["Status"] != "SUCCESS":
raise RuntimeError(payload.get("ErrorMessage", "request failed"))See Conventions for the full envelope.
HTTP status codes
When SaaSify does set an HTTP status, it maps as follows:
| HTTP status | When you'll see it | What to do |
|---|---|---|
200 OK | Success — or a business error with Status: "ERROR" in the body. | Always check the Status field before trusting Data. |
400 Bad Request | Invalid input. Data carries the validation errors. | Fix the request body or parameters; read Data for which field failed. |
401 Unauthorized | Missing, invalid or expired token. | Get a fresh token; refresh before expiry. See Authentication. |
403 Forbidden | Your user's role lacks the permission for this operation ("Access denied"), or the user isn't a valid tenant user. | Grant the required role permission to your service user, or fix the tenant context. |
404 Not Found | A required argument was missing or invalid, or the route doesn't exist. | Check the identifier and the path. |
500 Internal Server Error | An unexpected server error. | Retry transient failures with backoff; if it persists, contact support with the RequestCorrelationID. |
403 is used both for a missing role permission and for a non-tenant user. If you get 403 on a call you expect to work, check the service user's role first.
Common error situations
| Situation | How it appears | What to do |
|---|---|---|
| Expired or missing bearer token | 401, or an auth error | Refresh the token or re-authenticate. See Authentication. |
| Service user lacks a permission | 403 "Access denied" | Add the operation's role permission to the user. |
| Wrong tenant for a multi-tenant user | 403, or empty/foreign results | Send the correct TenantCode at token time. |
| Unknown subscription / deal / resource ID | 200 with Status: "ERROR", or 404 | Verify the identifier type and value (see Identifiers). |
| Invalid request body | 400, validation errors in Data | Correct the fields named in Data. |
| Usage posted outside the allowed window, or rejected by the cloud | 200 with Status: "ERROR", or a later UsagePostingFailed event | Post within the cloud's reporting window; watch for the failure event. See Metering. |
| Pricing currency temporarily unavailable | Response header X-SaaSify-Warning: RATES_UNAVAILABLE | Treat the pricing as provisional and retry later. (Deal pricing only.) |
Provider-specific errors
Each cloud returns its own error strings for marketplace operations (activation, metering, private offers). These surface in ErrorMessage and in the subscription activity log.