What is RBAC?
RBAC lets you create service accounts for your automated systems - like event ingestion services, analytics dashboards, or CI/CD pipelines - and assign each one specific roles that control what it can access. Key Benefits:- Enhanced Security: Limit what each service can access
- Controlled Access: Assign specific permissions based on what each service needs to do
- Easy Management: Create and revoke service account access without affecting your main account
- Clear Separation: Different API keys for different purposes
How It Works
When you create a service account, you assign it one or more roles. Each role grants specific permissions to access certain resources. Example Flow:- Create a service account and assign it the
event_ingestorrole - Generate an API key for that service account
- The API key inherits the
event_ingestorpermissions - Your service can now ingest events but cannot access customer data or billing information
User Types
Regular Users (User Accounts)
Your standard user accounts for people. These accounts:- Can log in to the dashboard
- Have full access to all Flexprice resources
- API keys from user accounts have full access
Service Accounts
Automated accounts for your services and integrations. These accounts:- Cannot log in to the dashboard
- Must have at least one role assigned
- Access Flexprice only through API keys
- API keys from service accounts have restricted access based on assigned roles
Available Roles
event_ingestor
For services that send events to Flexprice. Can do:- Send events
- Read events
- Access any other resources
event_reader
For services that read event data. Can do:- Read events
- Send events
- Modify any data
Real-World Use Cases
Use Case 1: Event Ingestion Service
Scenario: You have a microservice that sends usage events to Flexprice. Solution: Create a service account with theevent_ingestor role and generate an API key.
What happens:
- ✅ Your service can send events successfully
- ❌ If it tries to read events, it gets 403 Forbidden
- ❌ It cannot access any other resources
Use Case 2: Analytics Dashboard
Scenario: Your analytics dashboard needs to read events for reporting. Solution: Create a service account with theevent_reader role and generate an API key.
What happens:
- ✅ Your dashboard can read event data
- ❌ If it tries to send events, it gets 403 Forbidden
- ❌ It cannot modify any data
Validation Rules
Common Validation Errors
Error: No Roles AssignedError Responses
403 Forbidden
When a service account tries to access a resource it doesn’t have permission for:- Check which role the service account has
- Verify that role includes the permission you need
- If needed, assign a different role to the service account
- Generate a new API key (permissions are set when the key is created)
Getting Started
Step 1: Create a Service Account
Choose the appropriate role for your use case and create a service account:Step 2: Generate an API Key
Create an API key for your service account:Step 3: Use the API Key
Use the API key in your service:Best Practices
Use Specific RolesAssign only the roles your service needs. Don’t use broader permissions than necessary.
Rotate API Keys RegularlyGenerate new API keys periodically (recommended: every 90 days) and delete old ones.
Store Keys SecurelyUse environment variables or secret management systems. Never commit API keys to your code repository.
Troubleshooting
Getting 403 Errors
Symptom: Your service is getting “Forbidden” errors when making API calls. Possible Causes:- The service account doesn’t have the role that grants the required permission
- The API key was created before you assigned roles to the service account
- You’re trying to access a resource that the assigned role doesn’t cover
- Check what roles the service account has
- Verify those roles include the permission you need
- If you recently added roles, create a new API key
- Test with a simple request to verify permissions
Cannot Create Service Account
Symptom: Getting an error when trying to create a service account. Possible Causes:- Didn’t specify any roles
- Specified an invalid role name
roles array.

