swepayError Catalog

Native Accounting Ops

Tenant Context Required 403

The access token carries no tenant; a tenant must be selected before calling tenant-scoped endpoints.

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

What this means

Returned when a tenant-scoped endpoint is called with an access token that has no tenant context attached. Almost every endpoint of this API operates on data scoped to one tenant, so it requires a token that already carries which tenant the caller is acting on — not merely proof of who the caller is.

This is different from Tenant Mismatch: here there is no tenant on the token at all, so there is nothing to compare the request against.

Common causes

  • The access token came straight from sign-in, before a tenant was selected.
  • The caller reused a token issued for a different product or audience.
  • A raw identity token was sent instead of the tenant-scoped token returned by tenant selection.

How to resolve

List the tenants the caller belongs to with GET /me/tenants, then exchange the identity token for a tenant-scoped one with POST /me/tenants/{id}/select. Use the token returned by that call — not the original one — as the Authorization header on every tenant-scoped request. Retrying with the same tenant-less token will keep returning 403.

Example response

HTTP 403 · application/problem+json
{
  "type": "https://errors.swepay.com.br/accounting-ops/tenant-context-required",
  "title": "Tenant Context Required",
  "status": 403,
  "detail": "The access token carries no tenant; select a tenant first.",
  "instance": "/v1/tenant"
}

References

Machine-readable: /accounting-ops/tenant-context-required.json