Preview the role a sign-in would get
POST /v1/role_rules/preview: Preview the role a sign-in would get.
POST /v1/role_rules/preview
Evaluates the environment’s saved role rules, plus an optional unsaved draft rule, against a sample identity exactly as a sign-in does (same compiler, precedence and condition evaluator). The exact verified domain comes from the organization’s verified domains, as at sign-in; scim_groups stand in for the directory groups the SCIM index would bind. denied means a deny rule matched and the sign-in would be refused. Nothing is stored or audited, and the plan limits of saving rules do not apply to a draft.
- Scope
policies:read- Auth
- Secret key (
sk_…) - Since
- 1.0
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Request body
Section titled “Request body”organizationstring Requiredconnectionstring Requiredemailstringmax length 320
email_verifiedbooleanidp_groupsarray of stringmax items 100
idp_groups_verifiedbooleanscim_groupsarray of stringmax items 100
draftRoleRuleCreate
Responses
Section titled “Responses”- 200 OK RoleRulePreview
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X POST \ "https://api.ohauthcat.com/v1/role_rules/preview" \ -H "Authorization: Bearer $OHAUTHCAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5"}'const response = await fetch("https://api.ohauthcat.com/v1/role_rules/preview", { method: "POST", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5" }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/v1/role_rules/preview", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", },)data = response.json(){ "object": "role_rule_preview", "role": "admin", "denied": true}