Documentation Index
Fetch the complete documentation index at: https://mintlify.com/spiceai/spiceai/llms.txt
Use this file to discover all available pages before exploring further.
Authorization and Access Control
Spice.ai implements role-based access control through API key permissions to manage what authenticated users can do with your data.Permission Levels
Spice supports two permission levels for API keys:Read-Only Access (:ro)
Read-only keys can:
- Execute
SELECTqueries - Access search functions (
vector_search,text_search) - Query data through HTTP, Flight SQL, and gRPC APIs
- Access AI inference endpoints (OpenAI-compatible APIs)
- Execute
INSERT,UPDATE,DELETE, orCREATEstatements - Modify dataset accelerations
- Write to Iceberg tables
- Execute administrative operations
Read-Write Access (:rw)
Read-write keys can:
- Perform all read-only operations
- Execute
INSERT INTOstatements to write data - Create and modify temporary tables
- Write to Iceberg tables
- Execute data modification operations
Configuring Permissions
Basic Permission Configuration
Set permissions by appending:ro or :rw to API keys:
Multiple Keys with Different Permissions
You can configure multiple keys with different permission levels for different use cases:Authorization Flow
When a request is made to Spice:- Authentication: The API key is validated
- Principal Creation: An authentication principal is created with associated permissions
- Authorization Check: Before executing operations, Spice checks if the principal has required permissions
- Operation Execution: If authorized, the operation proceeds
Use Cases by Permission Level
Read-Only Use Cases
Business Intelligence Dashboards
Business Intelligence Dashboards
BI tools and dashboards only need to query data, not modify it:
Analytics and Reporting
Analytics and Reporting
Analytics pipelines that aggregate and analyze data:
AI/LLM Applications
AI/LLM Applications
RAG applications and AI agents querying data for context:
Public APIs
Public APIs
Customer-facing APIs that expose read-only data:
Read-Write Use Cases
Data Ingestion Pipelines
Data Ingestion Pipelines
ETL/ELT processes that load data into Spice:
Application Backends
Application Backends
Applications that both read and write data:
Administrative Operations
Administrative Operations
Admin tools and operations that need full access:
Iceberg Table Writers
Iceberg Table Writers
Services writing to Iceberg tables:
Session-Based Authorization
For Flight SQL connections, Spice maintains session-based authorization:- Client authenticates with an API key during handshake
- Runtime creates a session and associates it with the key’s permissions
- All operations within that session use the original key’s permission level
- Session tokens inherit the permissions of the API key used to create them
Access Control Best Practices
1. Principle of Least Privilege
Grant the minimum permissions necessary:2. Segregate by Environment
Use different keys for different environments:3. Audit Access Patterns
Monitor API key usage to ensure appropriate access:4. Regular Permission Review
Periodically review and audit key permissions:- Remove unused keys
- Downgrade over-privileged keys to read-only
- Ensure new services use appropriate permission levels
- Rotate keys that may have been compromised
5. Combine with Network Security
Layer authorization with network-level controls:Handling Authorization Errors
When a read-only key attempts a write operation:Advanced Authorization Patterns
Dataset-Level Access Control
While Spice’s API key permissions are runtime-wide, you can implement dataset-level access control by:- Running multiple Spice instances with different datasets
- Using different API keys for each instance
- Routing requests based on required dataset access