How to control access to your API by users and by groups?
Put people in groups, decide what each group may do, and check it on every request. At a restaurant, managers change any booking, waiters only view them, and customers touch only their own.
That is easy to describe and slow to build well. Here’s what it takes, and the easy way to solve it.
Skip to the one-command waySimple to describe, weeks to build
Groups look like two database tables. The work is everything around them: a list of everyone who uses your API, groups inside groups, an admin for each of your customers, a screen for those admins, and a check on every request. Built by one developer, piece by piece, it looks like this.
- A list of everyone who uses your API2–4 days
- Groups like managers and waiters2–3 days
- Groups inside groups1–3 days
- An admin for each customer3–5 days
- A screen to manage it all1–2 weeks
- Requests to join a group2–4 days
- Whole-company sign-in1–2 days
- A check on every request, AI included1–2 weeks
- Telling your code who is calling1 day
| Piece | Estimate |
|---|---|
| A list of everyone who uses your API | 2–4 days |
| Groups like managers and waiters | 2–3 days |
| Groups inside groups | 1–3 days |
| An admin for each customer | 3–5 days |
| A screen to manage it all | 1–2 weeks |
| Requests to join a group | 2–4 days |
| Whole-company sign-in | 1–2 days |
| A check on every request, AI included | 1–2 weeks |
| Telling your code who is calling | 1 day |
And one forgotten check undoes all of it
Even once it’s built, every endpoint and every MCP tool has to check the role itself. The check gets copied into every file, and the one you forget is the one an AI assistant finds.
Built by hand: the check is copied into every file
bookings.ts
checkedif (!isManager(user)) return deny();
updateBooking(id);
reports.ts
checkedif (!isManager(user)) return deny();
buildReport();
mcp/tools.ts
forgot the check// no check here
cancelBooking(id);
Turn on users and groups with one command
APIblaze already runs every piece on that list. Point it at your API and switch users and groups on:
Get users and groups on your API
$ npx apiblaze@latest create --target https://ninopizzas.com/openapi.yaml --iamPaste it in a terminal. No sign-up, no servers. The link is a sample restaurant API; swap in your own API’s address. --iam turns users and groups on. Your code doesn’t change.
APIblaze is an API proxy: every request passes through it first
It sits between the people using your API and your API itself. Your app, a partner or an AI assistant calls APIblaze, and APIblaze passes on only the calls that are allowed.
Callers
- Chiara, a managerasks to change a booking
- Ana, a waiterasks to change a booking
- Ana’s AI assistantasks to cancel a booking
APIblaze
The API proxy
Checks each caller’s group against your rules before the call reaches your code.
Your API
Only sees the calls APIblaze lets through.
Never reached your code.
That’s why it’s the right place for roles. The check lives in one spot that every request has to pass, so no endpoint and no MCP tool can be forgotten.
With APIblaze: one rule, in one place, in front of everything
bookings.ts
coveredupdateBooking(id);
reports.ts
coveredbuildReport();
mcp/tools.ts
coveredcancelBooking(id);
Roles and groups on your API, step by step
- 1
Turn on users and groups
The command above does it. Everyone who signs in lands in one directory: with GitHub out of the box, or with your own login like Google, Microsoft or Auth0.
- 2
Write the rule in plain English
APIblaze turns the sentence into a check, and saves it in watch-only mode first, so you see what it would block before it blocks anything.
$ npx apiblaze@latest rule myapi "Only managers can change reservations" - 3
Let each customer run their own team
Make each customer’s manager their admin. From then on every hire, leaver and promotion is handled by them, not by you. Here is one restaurant, Nino’s Pizza: approve Luca’s request and watch the tree.
$ npx apiblaze@latest admins add chiara@ninopizzas.com --tenant ninosNino’s Pizza
one of your customers · admin: Chiara
Managers
CEcan change any booking
Staff
can view every booking
Waiters
AMBRPBcan view every booking, from Staff
Kitchen
GRcan view every booking, from Staff
Without APIblaze: your inbox
chiara@ninopizzas.com
“Hi! Can you add Luca as a waiter? And remove Paul, he left last week.”
Every hire, every leaver, every customer: it lands with you.
With APIblaze: Chiara handles it
Her email
Luca asked to join Waiters
The user and group administration page on your site
PBPaulWaiters
Done in seconds, by the person who knows her team. You never hear about it.
Groups inside groups
Waiters and Kitchen sit inside Staff, so one rule for Staff covers both.
Promote by moving
Move Ana into Managers and she can change any booking, live within a minute, no redeploy.
Each customer, their own tree
Nino’s admin sees Nino’s groups, and no other restaurant’s.
- 4
Give those admins a screen, already built
One React component on your site gives every customer’s admin their users, groups and co-admins.
ninopizzas.com/adminWorkspace
User and group administration
Your customer’s admins manage their own users & groups — on your site.
Users & groups
Users 3Groups 2Admins 2+ Add userAMAna Morettiana@ninopizzas.comBRBen Russoben@ninopizzas.comCEChiara Espositochiara@ninopizzas.com3 people have called your API but aren’t users yet.Review and add →▲ the drop-in
<UsersGroupsWidget/>, white-labelled to your brandapp/admin/page.tsximport { UsersGroupsWidget } from 'apiblaze/react'; export default function AdminPage() { return <UsersGroupsWidget theme={{ accent: '#7C3AED' }} />; } - 5
See the result, one role at a time
A manager, a waiter and a customer ask their AI assistant the same thing. Only the role changes the answer.
CEChiara
ManagerShow me every booking
list_bookingsGET /bookings · allowedHere are all 248 bookings.
AMAna
WaiterShow me every booking
list_bookingsGET /bookings · allowedHere are all 248 bookings.
MRMarco
CustomerShow me every booking
list_bookingsGET /bookings · only their ownHere are your 2 bookings.
1/4Same question, same tool, same API. Only the role changes, and APIblaze checks it before the request reaches your code.
What each role can do Request Manager Waiter Customer Show me every booking Allowed Allowed Allowed Move Ben’s booking to 8pm Allowed Refused Refused Make my booking a table for 4 Allowed Allowed Allowed Cancel Ben’s booking Allowed Refused Refused
Every command on this page, in one list
Turn on roles and groups for your API
$ npx apiblaze@latest create --target ./openapi.yaml --iamWrite a rule in plain English
$ npx apiblaze@latest rule myapi "Only managers can change reservations"Make Chiara the admin for Nino’s
$ npx apiblaze@latest admins add chiara@ninopizzas.com --tenant ninosCreate the Waiters group
$ npx apiblaze@latest group create waitersPut Waiters inside Staff
$ npx apiblaze@latest group add-group waiters staffAdd Luca to Waiters
$ npx apiblaze@latest group add-user luca@ninopizzas.com waitersRemove Paul
$ npx apiblaze@latest group remove-user paul@ninopizzas.com waitersLet the whole restaurant sign in, straight into Staff
$ npx apiblaze@latest preapprove ninopizzas.com --group staffSee everyone, including people seen in your traffic
$ npx apiblaze@latest group users
Common questions
How do I manage users and groups on my API?
You need a list of users, groups with members, an admin for each customer, a screen to manage them, and a check on every request. You can build each piece yourself, or put APIblaze in front of your API: one command adds users and groups, and one React component gives your customers the screen.
What is the difference between users, groups and roles?
A user is one person. A group is a set of people, like “staff”. A role is what a group may do, like “can change any booking”. In APIblaze you put people in groups and write rules about what each group may do.
What is an API proxy?
A service that sits in front of your API. Every request goes through it first, so it can check who is calling and what they may do before your code runs. APIblaze is an API proxy.
Do groups apply to AI assistants using my MCP server?
Yes. An assistant using your MCP server acts as the person who signed in, with that person’s groups, so the same rules apply. You don’t write separate rules for AI.
Can my customers manage their own users?
Yes. Make someone the admin for their company, and they add people, groups and other admins from the ready-made screen on your site. They only ever see their own company.
Can a group contain another group?
Yes. Put “waiters” inside “staff”, and waiters can do everything staff can. Rules follow the whole tree.
How does my code know who is calling?
Every request reaches your code with the caller and their groups, signed by APIblaze, so you can trust it without looking anything up.
Does it work with my existing login?
Yes. People sign in with GitHub out of the box, or with your own login: Google, Microsoft, Auth0 or any OpenID Connect provider.
Give your API users and groups today
One command, no sign-up. Your code doesn’t change.
$ npx apiblaze@latest create --target https://ninopizzas.com/openapi.yaml --iam