swepayError Catalog

Native Accounting Ops

Tenant Mismatch 403

The X-Tenant-Id header does not match the tenant already selected on the access token.

type https://errors.swepay.com.br/accounting-ops/tenant-mismatch

What this means

Returned when the X-Tenant-Id header sent with the request does not agree with the tenant carried by the access token. The token's own tenant is always the source of truth; the header is only cross-checked against it, as a second declaration of intent from the caller — it is never used on its own to pick the tenant.

Unlike Tenant Context Required, the token here does have a tenant — it just disagrees with the header.

Common causes

  • The client cached an `X-Tenant-Id` value from a previous tenant session and did not update it after switching tenants.
  • Two browser tabs or request contexts mixed a token from one tenant with a header from another.
  • A multi-tenant integration is configured to send the wrong tenant for this call.

How to resolve

Set X-Tenant-Id to the same tenant carried by the current access token (the one returned by tenant selection). If the caller actually intends to operate on the tenant named in the header, select that tenant first with POST /me/tenants/{id}/select and use the resulting token. Retrying with the same mismatched header will keep returning 403.

Example response

HTTP 403 · application/problem+json
{
  "type": "https://errors.swepay.com.br/accounting-ops/tenant-mismatch",
  "title": "Tenant Mismatch",
  "status": 403,
  "detail": "The 'X-Tenant-Id' header does not match the token's tenant.",
  "instance": "/v1/tenant"
}

References

Machine-readable: /accounting-ops/tenant-mismatch.json