Checking access…

Skip to main content
Version: v2
Audience: Consumers, CCG Platform Engineers

X-Upstream-Env β€” Values & Error Reference

When to use this page

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 environment
  • stage – Staging / Integration environment
  • perf – Performance testing environment
  • test – General testing environment
  • reg – 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​

SituationExpected BehaviorExample Evidence
Missing header (non-prod)404 NOT_FOUNDSession API discussions/updates reference NOT_FOUND when preconditions fail; treat missing/invalid env similarly per API policy.
Invalid value404 NOT_FOUNDTeams align on strict validation to avoid wrong-env effects.
Auth OK, env wrong403 FORBIDDENMultiple 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"
    }
    note

    Typical HCP Gateway error response for missing or invalid X-Upstream-Env values. The message and request_id fields 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.