Error codes

environment_mismatch

Wrong environment

HTTP 401

At launchOnly a v2 key or a signed credential is answered this way: the portal issues v2 keys, and signed credentials can be registered, from launch.

X-SA-Environment isn't the key's: TEST for a test key or credential, PRODUCTION for a live one. A signed request always sends it, and is checked once its signature verifies; a request with an API key may leave it out, and is checked when it sends it.

The problem body

Sent as application/problem+json, with the request id in request_id and the X-Request-Id header. Branch on code: the error and detail sentences can change, and some operations add members of their own.

Example problem
{
  "error": "This credential is a test one: send X-SA-Environment: TEST.",
  "code": "environment_mismatch",
  "type": "https://secondappraisal.com/developers/errors/environment_mismatch",
  "title": "Wrong environment",
  "status": 401,
  "detail": "This credential is a test one: send X-SA-Environment: TEST.",
  "instance": "/api/gap/v1/referrals",
  "request_id": "req_4f9a2c7e1b8d4a6f9c3e2b1a7d5f8e0c"
}

Operations that can send it