X-Upstream-Env β Values & Error Reference
Looking up the allowed X-Upstream-Env values or what a specific error response means. For why/how to use the header, see Using X-Upstream-Env.
Expected Values (Allow-list)β
devβ Development environmentstageβ Staging / Integration environmentperfβ Performance testing environmenttestβ General testing environmentregβ Regression testing environment
Requirement Levelβ
- Required for most non-prod calls (HCP interprets it to select the upstream partition).
- In prod, the header is omitted (defaults apply).
Validation, Defaults & Error Handlingβ
| Situation | Expected Behavior | Example Evidence |
|---|---|---|
| Missing header (non-prod) | 404 NOT_FOUND | Session API discussions/updates reference NOT_FOUND when preconditions fail; treat missing/invalid env similarly per API policy. |
| Invalid value | 404 NOT_FOUND | Teams align on strict validation to avoid wrong-env effects. |
| Auth OK, env wrong | 403 FORBIDDEN | Multiple cURLs show correct tokens still failing for logical reasons (env/merchant/config mismatch). |
Error Response Examples
-
403 FORBIDDEN
{"title": "FORBIDDEN","status": 403,"detail": "403 FORBIDDEN","errorDetails": null} -
404 NOT_FOUND
{"message": "no Route matched with those values","request_id": "3552964e1362fb657362ba50b3a9af27"}noteTypical HCP Gateway error response for missing or invalid X-Upstream-Env values. The
messageandrequest_idfields may vary by request.
- The header is required for most non-prod calls. If omitted or invalid, the API may default or return a 404 NOT_FOUND error.
- If the header value is valid but does not match the authenticated user's environment or merchant configuration, a 403 FORBIDDEN is returned.
- Authentication and environment validation are independent: a valid token with an invalid or mismatched environment will still result in an error.
FAQβ
Q: Can I omit XβUpstreamβEnv in nonβprod?
A: Not recommended. Many flows expect it; omission can misroute or fail with 400.
Q: Why do I see 403 from Azure Application Gateway when my header is present?
A: That's a network/perimeter block, not the HCP gateway decision. Validate AGW rules, IP allowlists, and path configs first; then re-test with the same header.
Q: Should I hardcode dev or stage at ingress?
A: No. Preserve the client's explicit intent. Hardcoding undermines cross-env testing patterns observed in your teams.