Appearance
Return
Securing APIs
Protect your APIs so only the right users can access sensitive data.
Steps at a glance
- Create an API in
Data & API → APIs. - Add
Middlewareso the API requires a signed-in user (and roles if needed). - Test the API in preview mode and confirm it is blocked when signed out.
1) Add Middleware to the API
- Open
Data & API → APIs. - Select your API endpoint.
- In the API settings, set
Middlewareto:PublicFor endpoints anyone can access.AuthenticatedFor endpoints that require a signed-in user.- A role-based rule when only certain roles should have access.
2) Return clear responses
- If the user is not signed in, return a helpful message (for example “You must sign in to continue.”).
- If the user is signed in but not allowed, return a message like “You do not have access to this.”
3) Test it quickly
- In preview mode, trigger the API from your interface.
- Test while signed in and while signed out.
- Confirm the result matches your
Middlewarerules.
Common pitfalls
Your API works in preview but fails in production
- Check that your production environment uses the same SSO Provider settings and environment variables.
You can still access the API from a public page
- Make sure the API endpoint itself is protected with
Middleware(not only the page).

