RBAC vs ABAC: How to Choose the Right Access Control Model
Roles are easy to start with and hard to scale. Attributes scale but are harder to run. This guide compares RBAC and ABAC side by side, tests both on the same API requests, and shows how to combine them so every consumer reaches only the APIs it should.

TL;DR:
RBAC vs ABAC: what is the difference?
RBAC vs ABAC comes down to what decides access. Role-based access control (RBAC) grants permissions through roles such as "partner" or "admin". Attribute-based access control (ABAC) evaluates attributes of the user, the resource and the request, such as plan, region or environment, at the moment of access.
RBAC is simpler to run and audit. ABAC is more precise but harder to manage. Most teams use RBAC as the baseline and add ABAC rules where roles get too coarse.
You start with three roles for your partner APIs: reader, writer, admin. Then sales sells a premium plan. Legal says EU data must stay with EU partners. Security wants sandbox keys locked out of production. A year later you have 72 roles, nobody can say what "partner-eu-gold-write-v2" allows, and a trial partner can still read payment data because someone cloned the wrong role.
That's the real RBAC vs ABAC question. It isn't which model is "better". It's when roles stop being enough, and what to add without making access impossible to audit.
This guide compares both models side by side and runs them against the same six API requests, so you can see where each one fails. It also shows how to combine them, with tested policy code you can adapt.

RBAC vs ABAC: what is the difference?
RBAC asks "what role does this caller have?" ABAC asks "do this caller's attributes, the resource's attributes and the current context satisfy the policy?" RBAC decides with a lookup. ABAC decides with a rule evaluated on every request.
The one-line verdict: use RBAC for stable, coarse access, and add ABAC when access depends on data the role can't carry, such as plan, region, data class, environment or time.
RBAC vs ABAC at a glance
| Role-based access control (RBAC) | Attribute-based access control (ABAC) | |
|---|---|---|
| Decides by | The caller's role | Attributes of caller, resource, action and context |
| Example rule | Partners can call payments APIs | Callers on a gold plan in the EU can call EU payments APIs in production |
| Granularity | Coarse: per role | Fine: per request |
| Setup effort | Low | Medium to high |
| Audit question | "Who has this role?" (easy) | "Who could pass this rule?" (harder) |
| Main failure mode | Role explosion and over-granting | Missing or stale attributes, complex rules |
| Best fit | Stable teams and job functions | Multi-tenant, regulated or context-dependent access |
Swipe sideways to see all columns →
The rest of this guide explains both models, shows when each one breaks, and walks through the hybrid model most API programs end up with.
What is role-based access control (RBAC)?
Role-based access control gives permissions to roles and roles to users. A caller gets access because they hold a role, never directly. To change what 200 partners can do, you change one role.
Role-based access control (RBAC)
Role-based access control (RBAC) is an access control model in which permissions are assigned to roles, and users or applications gain those permissions by being assigned to roles. NIST formalised it in the early 1990s, and it became the ANSI/INCITS 359 standard in 2004.
RBAC has three building blocks:
- Users or subjects: people, partner apps, services or AI agents.
- Roles: named job functions, such as
partner,billing-adminorsupport-agent. - Permissions: allowed actions on resources, such as
GET /ordersorcall payments-v2.
The NIST model defines four levels. Flat RBAC maps users to roles. Hierarchical RBAC lets roles inherit from other roles, so admin gets everything writer has. Constrained RBAC adds separation of duties, so one person can't hold both payment-creator and payment-approver. Symmetric RBAC adds reviews of which permissions each role holds.
Here is an RBAC example in Cedar, the open-source policy language behind Amazon Verified Permissions. Every partner can call every API in the payments group:
// RBAC: the role decides. Partners may call any API in the payments group.
permit (
principal in Role::"partner",
action == Action::"call",
resource in ApiGroup::"payments"
);RBAC is everywhere because it maps to how organisations already think. Kubernetes, AWS IAM groups, Microsoft Entra ID and most API developer portals start with roles. For a working setup in a developer portal, see API developer portal RBAC.
What is role explosion?
Role explosion is what happens when every new access condition becomes a new role. Each attribute you fold into a role name multiplies the role count.
Take a partner API program with three plans (trial, standard, gold), four regions, two environments (sandbox, production) and three API groups. Encode all of that in roles and you need 3 × 4 × 2 × 3 = 72 roles. Add read and write variants and it's 144. The same rules in ABAC fit in four or five policies.

Explosion isn't only an admin burden. It's a security problem. When roles are hard to understand, people clone the closest one and over-grant. Microsoft's 2023 State of Cloud Permissions Risks report found identities used only 1% of the permissions they were granted, and more than 50% were super admins.
What is attribute-based access control (ABAC)?
Attribute-based access control decides each request by evaluating attributes against a policy. Instead of "is this caller a partner?", the rule asks "is this caller's plan high enough, in the right region, for this API, in this environment?"
Attribute-based access control (ABAC)
NIST SP 800-162 defines ABAC as an access control method where authorization to perform operations is determined by evaluating attributes of the subject, the object, the requested operation and, in some cases, the environment, against policy. (NIST SP 800-162, January 2014, updated 2019)
ABAC uses four kinds of attributes:
- Subject attributes: who is calling. Plan, tenant, region, department, clearance, whether a data processing agreement (DPA) is signed.
- Resource attributes: what is being accessed. API group, owner, data class (PII, financial, public), region, version.
- Action attributes: what the caller wants to do. Read, write, delete, export.
- Environment or context attributes: the conditions of the request. Time, IP range, device trust, environment (sandbox or production), risk score.
An ABAC system has four parts, named in NIST SP 800-162 and the XACML standard:
- Policy enforcement point (PEP): intercepts the request and enforces the decision. For APIs, this is usually the gateway.
- Policy decision point (PDP): evaluates the policy and returns allow or deny.
- Policy information point (PIP): fetches attributes the request doesn't carry, such as the caller's plan from your billing system.
- Policy administration point (PAP): where policies are written, reviewed and versioned.

Here is an ABAC example for the same payments API. No roles at all. Plan, region and environment decide:
// ABAC: attributes decide. No roles at all.
permit (principal, action == Action::"call", resource)
when {
principal.planRank >= resource.minPlanRank && // paid plan high enough
principal.region == resource.region && // data stays in region
context.environment == resource.environment // sandbox keys stay in sandbox
};ABAC isn't new. AWS IAM supports it through tags (aws:PrincipalTag, aws:ResourceTag), Azure through role assignment conditions, and Open Policy Agent (OPA) through Rego policies. Cedar, OPA and XACML are all ways to write the same idea: rules over attributes.
How do RBAC and ABAC compare side by side?
RBAC wins on simplicity, speed of setup and auditability. ABAC wins on precision, context and scale of rules. The table compares the two access control models on the points that matter when you run them.
RBAC vs ABAC: side-by-side comparison
| Dimension | RBAC | ABAC |
|---|---|---|
| Decision input | Role membership | Subject, resource, action and context attributes |
| Policy count as rules grow | Grows by multiplication (role explosion) | Grows by addition (one rule per condition) |
| Context awareness | None: a role is valid all day, from anywhere | Native: time, IP, environment, risk |
| Granularity | Per role and resource group | Per request, down to object or field |
| Audit: "who can access X?" | Easy: list role members | Hard: depends on attribute values at request time |
| Audit: "why was this allowed?" | "They had role Y" | "These attributes matched policy Z" (needs decision logs) |
| Performance | Fast lookup, easy to cache | Rule evaluation plus attribute fetches; cache attributes and decisions |
| Data dependency | Directory of users and roles | Accurate, fresh attributes from several systems |
| Change effort | Edit roles and memberships | Edit policies; attributes update on their own |
| Typical tools | IdP groups, Kubernetes RBAC, portal roles | Cedar, OPA/Rego, XACML, AWS IAM conditions |
Swipe sideways to see all columns →
What happens when you test both on the same requests?
To see the difference between RBAC and ABAC in practice, we ran the three Cedar policies in this guide against six requests to one API, payments-v2. The API holds EU personal data, needs a standard plan or higher, and lives in production.
Same six API requests, three access control models (Cedar 4.15)
| Caller | RBAC only | ABAC only | Hybrid | Correct answer |
|---|---|---|---|---|
| Gold EU partner, DPA signed | Allow | Allow | Allow | Allow |
| Trial-plan partner | Allow | Deny | Deny | Deny: plan too low |
| Partner without a DPA | Allow | Allow | Deny | Deny: PII needs a DPA |
| US-region partner | Allow | Deny | Deny | Deny: data residency |
| Internal app with no partner role | Deny | Allow | Deny | Deny: not a partner |
| Gold partner using a sandbox key | Allow | Deny | Deny | Deny: wrong environment |
Swipe sideways to see all columns →
Wrong answers are in bold. RBAC alone over-granted four times, because a role can't see plan, region, DPA status or environment. ABAC alone got two wrong: it let in a caller with no business relationship, and it had no rule for the DPA. The hybrid policy got all six right. We used Cedar 4.15 through its WebAssembly package to run these tests.

When should you use RBAC vs ABAC?
Use RBAC when access follows stable job functions. Use ABAC when access depends on facts about the caller, the data or the moment. Most API programs need both, but in different places.
RBAC is right for you if
- Access follows a handful of stable roles, such as internal teams or a single partner tier.
- Auditors need a simple answer to "who can reach this API?"
- You have fewer than about 20 roles and they aren't multiplying.
ABAC is right for you if
- Access depends on plan, tenant, region, data class or environment.
- You serve many partners or customers with different contracts on the same APIs.
- Rules must react to context, such as business hours, IP ranges or risk scores.
- Your role count keeps growing faster than your user count.
A few signals tell you it's time to add ABAC:
- Role names contain attributes, such as
partner-eu-gold-sandbox. - New contracts need new roles instead of a data change.
- Access reviews take weeks because nobody knows what each role grants.
- Regulations depend on data, such as GDPR data residency or PCI DSS cardholder data, rather than on job titles.
What about PBAC and ReBAC?
PBAC and ReBAC are close relatives of ABAC, not replacements for it. They come up often in RBAC vs ABAC vs PBAC comparisons.
- Policy-based access control (PBAC) is mostly a label for managing access as central, versioned policies, often as policy-as-code. In practice it uses attributes, so it overlaps heavily with ABAC.
- Relationship-based access control (ReBAC) decides by relationships between entities: "the caller owns this project" or "is a member of the team that owns this API". Google's Zanzibar paper (2019) popularised it, and tools such as OpenFGA and SpiceDB implement it. ReBAC fits documents and sharing models, where access follows ownership.
For most API access decisions, roles plus attributes cover the need. Add ReBAC when access follows ownership chains, such as "only the team that published an API can change its plans".
How do you combine RBAC and ABAC?
Use roles to decide who can reach which group of APIs, then use attribute rules to narrow or block access within that group. Roles stay few and readable. Attributes carry everything that changes.
This is the hybrid policy from our test. One RBAC permit, then four ABAC forbid guardrails. In Cedar, a matching forbid always overrides a permit, so a guardrail can't be bypassed by a broad role:
// 1. RBAC baseline: who can reach which API group
permit (
principal in Role::"partner",
action == Action::"call",
resource in ApiGroup::"payments"
);
// 2. ABAC guardrails: forbid always wins over permit
forbid (principal, action == Action::"call", resource)
when { principal.planRank < resource.minPlanRank };
forbid (principal, action == Action::"call", resource)
when { resource.dataClass == "pii" && !principal.dpaSigned };
forbid (principal, action == Action::"call", resource)
when { principal.region != resource.region };
forbid (principal, action == Action::"call", resource)
when { context.environment != resource.environment };The 72 roles from the role explosion example collapse to one role and four rules. Adding a fifth region or a new plan is now a data change, not a new role.
How do you move from RBAC to ABAC without a rewrite?
Add attributes next to your existing roles, one rule at a time, and log decisions before you enforce them. Teams that switch everything at once usually break access for real users.
- List your roles and spot the attributes hiding in their names.
partner-eu-goldhides region and plan. - Make those attributes real data. Store plan, region and DPA status on the consumer record, and data class and region on each API.
- Collapse roles to their job function.
partner-eu-goldandpartner-us-trialboth becomepartner. - Add one ABAC rule per hidden attribute, starting with the riskiest, such as PII and production access.
- Run new rules in log-only mode for a week or two. Compare their decisions with today's and fix the gaps.
- Enforce, then delete the old roles. Keep the decision logs for audits.
How do RBAC and ABAC apply to API access?
For APIs, RBAC decides which consumers can see and subscribe to which API products, and ABAC decides whether a specific call is allowed right now. Both run at the gateway for coarse checks. Object-level checks still run in the service.
This is the authorization half of granting API access. Authentication proves which app is calling. Authorization decides what it may do. If those two are blurred in your stack, start with authentication vs authorization.
Broken authorization is the most common API flaw. The OWASP API Security Top 10 (2023) ranks Broken Object Level Authorization first (API1) and Broken Function Level Authorization fifth (API5). Salt Security's 2025 State of API Security report found that 95% of API attacks came from authenticated sources, and the Verizon 2025 Data Breach Investigations Report found credential abuse was the top initial access vector, at 22% of breaches. Valid credentials with too much access are the real risk.
Useful attributes for API access:
Attributes for API access control
| Attribute type | Examples for API access | Where it comes from |
|---|---|---|
| Consumer (subject) | Plan, tenant, region, partner tier, DPA signed, app type (web, backend, AI agent) | Developer portal, billing, CRM, token claims |
| API (resource) | API group, owner team, data class, region, lifecycle stage, version | API catalog and OpenAPI metadata |
| Action | Method and route, read vs write, bulk export | The request itself |
| Context | Gateway environment, time, source IP, request rate, risk score | Gateway and threat signals |
Swipe sideways to see all columns →
Here is the hybrid policy enforced as gateway middleware in Node.js. The gateway acts as the PEP and Cedar as the PDP:
// gateway.mjs: Node.js 18+, Express 4.x, @cedar-policy/cedar-wasm 4.x
import express from 'express';
import cedar from '@cedar-policy/cedar-wasm/nodejs';
import { HYBRID } from './policies.mjs';
import { loadEntities } from './entities.mjs'; // consumers, roles and API metadata
export function authorize(apiId) {
return (req, res, next) => {
const consumer = req.auth.client_id; // set by your JWT or API key check
const result = cedar.isAuthorized({
principal: { type: 'Consumer', id: consumer },
action: { type: 'Action', id: 'call' },
resource: { type: 'Api', id: apiId },
context: { environment: process.env.GATEWAY_ENV ?? 'production' }, // from the deployment, never a client header
policies: { staticPolicies: HYBRID },
entities: loadEntities(consumer, apiId),
});
if (result.type === 'success' && result.response.decision === 'allow') return next();
// Fail closed: policy errors and denies both return 403
console.warn('deny', consumer, apiId, JSON.stringify(result.response?.diagnostics));
return res.status(403).json({ error: 'forbidden' });
};
}In our test, a gold partner got 200, a trial partner got 403, an unknown app got 403, and the same gold partner was refused on the sandbox gateway. Note two details. The environment comes from the gateway's own configuration, not a header the client could forge. And any policy error fails closed with a 403.
Where each check belongs:
- At the gateway: role and plan checks, environment, region, rate limits per consumer. These apply to whole APIs and routes, and running them once at the edge keeps every API consistent.
- In the service: object-level checks, such as "this order belongs to this tenant". Only the service knows who owns record 4711, and skipping this check is exactly OWASP API1.
Running this across one gateway is easy. Running it across Kong, Apigee, AWS API Gateway and an AI gateway is where policies drift. The DigitalAPI API Gateway applies one access policy across the gateways you already run, so a rule changes once, not per gateway. Teams using the DigitalAPI API Developer Portal control which consumers can see and subscribe to each API by role, team and plan, and partners get scoped credentials without waiting on a ticket.
See how DigitalAPI enforces role and attribute rules across every gateway you run → Book a Demo
How do RBAC and ABAC work for AI agents?
Give each AI agent its own identity and a narrow role, then use attributes to limit which tools, data and environments it can reach. Agents call APIs fast and unattended, so a broad role turns a prompt-injection bug into a data leak.
A practical pattern: one role per agent type, such as support-agent, plus ABAC rules on data class, tenant and action. For example, the agent can read orders only for the tenant in the current conversation, and can never call write or export endpoints. The MCP authorization specification requires MCP servers to check that tokens were issued for them, which is an attribute check by another name. For the full setup, see securing MCP endpoints.
What are the most common RBAC and ABAC mistakes?
Most access control failures come from roles that grant too much or attributes nobody maintains. Watch for these:
Common RBAC and ABAC mistakes and fixes
| Mistake | What happens | Fix |
|---|---|---|
| Encoding conditions in role names | Role explosion, cloned roles, over-granting | Keep roles for job functions; move conditions to attributes |
| One "partner" role for every API | Every partner reaches every API in the group | Scope roles to API groups and add plan and data class rules |
| Trusting client-supplied attributes | A caller sets X-Env: production or region=eu and passes | Take attributes from the token, the gateway config or your own systems |
| Stale attributes | A churned partner keeps its gold plan in the cache | Short attribute cache lifetimes; update on contract events |
| Failing open on policy errors | A missing attribute turns into "allow" | Default deny; treat errors as 403 |
| Only checking at the gateway | Object-level access (OWASP API1) goes unchecked | Gateway for coarse checks, service for object ownership |
| No decision logs | You can't explain to an auditor why a call was allowed | Log principal, resource, policy ID and decision for every request |
| ABAC rules nobody can read | Policies become a second codebase with no owner | Policy-as-code, reviews and tests, like application code |
| Sharing one identity across agents or apps | You can't revoke or scope one without breaking others | One identity per app or agent |
Swipe sideways to see all columns →
Key takeaways
- RBAC vs ABAC is about what decides access: roles for RBAC, attributes and context for ABAC.
- RBAC is simpler and easier to audit but over-grants when access depends on plan, region, data or environment.
- ABAC is precise and context-aware but needs accurate attributes, decision logs and policy reviews.
- The hybrid model wins for APIs: few roles for API groups, plus attribute guardrails that always override a permit.
- Enforce coarse rules at the gateway and object ownership in the service, and fail closed on errors.
Frequently asked questions
1. What is the main difference between RBAC and ABAC?
The main difference is what decides access. RBAC grants access based on the roles a user or app holds, such as "partner" or "admin". ABAC evaluates attributes of the caller, the resource, the action and the context, such as plan, data class, region or time, against a policy on every request. RBAC is simpler; ABAC is more precise.
2. Is ABAC better than RBAC?
ABAC isn't better in every case. It's more precise and handles context, but it's harder to design, audit and keep accurate. RBAC is the better choice when access follows a few stable roles. Most organisations use RBAC for broad access and add ABAC rules where roles become too coarse or start multiplying.
3. Can you use RBAC and ABAC together?
Yes, and most mature systems do. A common pattern uses roles to grant access to groups of resources, then attribute rules to narrow or block access within them. In policy engines such as Cedar, a forbid rule overrides any permit, so attribute guardrails can't be bypassed by a broad role.
4. What is role explosion in RBAC?
Role explosion is the uncontrolled growth of roles that happens when every new access condition becomes a new role. Three plans, four regions, two environments and three API groups already need 72 roles. Role explosion makes access hard to review and leads to cloned, over-granted roles. Moving conditions into ABAC attributes is the usual fix.
5. Does AWS use RBAC or ABAC?
AWS supports both. IAM roles and groups give RBAC-style access, and IAM policies can use tag-based conditions such as aws:PrincipalTag and aws:ResourceTag for ABAC. AWS recommends ABAC for scaling permissions across many resources. Amazon Verified Permissions adds Cedar policies for application-level authorization.
6. What is the difference between ABAC and PBAC?
Policy-based access control (PBAC) is a broad label for managing access through central, versioned policies, often written as code. Those policies usually evaluate attributes, so PBAC and ABAC overlap heavily. ABAC describes the decision inputs (attributes); PBAC describes how you manage the rules (policies).
7. Is RBAC still used?
Yes. RBAC remains the default in identity providers, Kubernetes, cloud IAM and developer portals because it's easy to understand and audit. What has changed is that teams rarely use RBAC alone for sensitive or multi-tenant access. They keep roles for job functions and add attribute rules for context.
8. Which access control model is best for APIs?
For APIs, a hybrid of RBAC and ABAC works best. Roles decide which consumers can see and subscribe to which API products. Attribute rules check plan, region, data class and environment on each call at the gateway. Object-level checks, such as tenant ownership of a record, still belong in the service.
9. What are the four access control models?
The four classic access control models are discretionary access control (DAC), mandatory access control (MAC), role-based access control (RBAC) and attribute-based access control (ABAC). Newer models include relationship-based access control (ReBAC), which decides by relationships such as ownership or team membership.
10. How do I migrate from RBAC to ABAC?
Migrate in steps rather than all at once. Find attributes hidden in role names, store them as real data on users and resources, collapse roles to job functions, and add one attribute rule at a time. Run new rules in log-only mode first, compare decisions with current access, then enforce and retire the old roles.
Conclusion
The RBAC vs ABAC choice isn't either-or. Roles give you a simple, auditable map of who belongs where. Attributes carry the facts roles can't: plan, region, data class, environment and time. Used alone, RBAC over-grants and ABAC under-specifies. Used together, they give every consumer exactly the access its contract allows.
Start by reading your role names. Every attribute hiding in one is a rule waiting to be written. Move them out, enforce them once at the gateway, and keep the decision logs your auditors will ask for.
How safely do you grant API access to partners and AI agents? Get your free readiness score: Check Your API Access Readiness
Prefer a walkthrough? Book a Demo
One email a fortnight. Worth opening.
A short digest of what we're writing, what we're learning from customers, and the handful of links you'd actually want from us. No tracking pixels.













.avif)
