swepayError Catalog

Native Guard

Invalid Role 400

A role referenced by the request does not exist in the realm.

type https://errors.swepay.com.br/native-guard/invalid-role

What this means

Returned by the Admin API when a request references a role that does not exist in the target realm. It applies to creating or updating a client (roles), and to creating a membership or replacing its roles (roleIds). Nothing is persisted.

Roles are scoped to a realm: a role that exists in another realm does not satisfy the reference.

Common causes

  • The role name or id has a typo, or uses the wrong letter case.
  • The role was deleted, or was never created in this realm.
  • The role exists in a different realm or environment than the one in the request path.

How to resolve

List the realm's roles (GET /admin/v1/realms/{realmId}/roles), then either create the missing role or correct the reference, and send the request again. Retrying the same body will keep returning 400.

error and errorDescription are deprecated compatibility members of the Admin API; key your handling off type.

Example response

HTTP 400 · application/problem+json
{
  "type": "https://errors.swepay.com.br/native-guard/invalid-role",
  "title": "Invalid Role",
  "status": 400,
  "detail": "Role 'billing-admin' not found in this realm",
  "traceId": "Root=1-00000000-000000000000000000000000;Parent=0000000000000000;Sampled=0",
  "error": "invalid_role",
  "errorDescription": "Role 'billing-admin' not found in this realm"
}

References

Machine-readable: /native-guard/invalid-role.json