Organization Model
Artos uses a multi-tenant architecture where each organization’s data is completely isolated. This guide explains how organization scoping works and how it protects your data.What is an Organization?
An organization is a complete isolated environment that contains:- Users - People with access to the organization
- Resources - Templates, documents, files, etc.
- Settings - Configuration and preferences
- Data - All documents and content created by the organization
Multi-Tenancy Architecture
Bearer Token Organization Context
When a user authenticates with a Bearer token, the token contains:- User ID - Which user is making the request
- Organization ID - Which organization they belong to
- Permissions - What operations they can perform
- Expiration - When the token expires
Token Claims
Organization Scoping in API Calls
Every API call using a Bearer token is automatically scoped to the authenticated user’s organization.Example: List Documents
- API validates Bearer token
- Extracts organization ID from token (
org_id: "org-A") - Queries only documents in
org-A - Returns
org-Adocuments only
Resource Access Control
1. Create Operations
When creating a resource, it’s automatically associated with your organization:organization_id: "your-org-id"(from token)created_by: "your-user-id"(from token)- Accessible only to users in your organization
2. Read Operations
All read operations automatically filter by organization:3. Update Operations
Updates only work on resources in your organization:4. Delete Operations
Deletion only works on resources in your organization:User Access Patterns
Single Organization User
Access Verification
When Alice makes an API call:Data Isolation Guarantees
Complete Isolation
Organizations have complete data isolation:- Network Isolation - Data queries are scoped by organization
- Database Isolation - Filters applied at query level
- File Isolation - S3 paths include organization ID
- No Cross-Organization Access - Impossible to accidentally access other org’s data
Storage Example
Files are stored with organization path:Permission Levels
Different permission levels control what users can do:User Role
- Can view and download documents
- Can generate new documents
- Cannot create templates
- Cannot modify other users’ work
- Cannot access admin functions
Admin Role
- All user permissions
- Can create and manage templates
- Can manage organization settings
- Can view audit logs
- Can manage other users
- Can configure integrations
Security Considerations
1. Token Leakage
If a token is leaked:- Only that organization’s data is exposed
- Other organizations are protected
- Token can be revoked without affecting others
- Rotate token immediately if compromised
2. User Removal
When a user is removed from organization:- Token immediately becomes invalid
- User can no longer access any resources
- Historical data remains (for audit)
- User has no way to re-access data
3. Organization Deletion
When organization is deleted:- All organization data is deleted
- All user tokens become invalid
- Cannot be undone
4. Cross-Organization Prevention
The system prevents cross-organization access:Multi-Organization Users (Future)
In the future, Artos may support users belonging to multiple organizations:Organization Settings
Organizations can configure:- Name - Display name
- Timezone - For timestamps and scheduling
- Style Guide - Default formatting rules
- Storage - File retention policy
- Integrations - Connected services
- Users - Team members and permissions
Audit and Compliance
All operations within an organization are tracked:- Who - User ID performing action
- What - Operation performed
- When - Timestamp
- Resource - What was accessed/modified
- Organization - Which org it belongs to
- Compliance auditing
- Security investigation
- Usage tracking
- Regulatory compliance
Best Practices
1. Token Management
- Rotate regularly - Get new tokens periodically
- Store securely - Use environment variables, not hardcoded
- Monitor usage - Check audit logs for unusual activity
- Revoke if leaked - Request new token immediately
2. User Management
- Principle of Least Privilege - Give minimum necessary permissions
- Remove unused accounts - Delete inactive users
- Review access regularly - Audit who has access
- Use roles - Don’t create custom permissions
3. Data Management
- Regular backups - Download important documents
- Archive old docs - Remove temporary documents
- Version control - Keep template versions
- Document changes - Track modifications
4. Security Monitoring
- Review audit logs - Check for suspicious activity
- Monitor failed auth - Watch for unauthorized access attempts
- Set alerts - Notify on unusual operations
- Update tokens - Rotate on schedule
Related Topics
- Authentication - Bearer token authentication
- API Reference - Resource access patterns
- Best Practices - Security best practices