| icon | code |
|---|---|
| description | Spice.ai APIs, SDKs, endpoints, and query best practices. |
Spice.ai exposes two sets of APIs: runtime APIs (for querying data and AI) and the Management API (for managing apps and infrastructure).
| API | Endpoint | Auth | Documentation |
|---|---|---|---|
| SQL (HTTP) | https://data.spiceai.io/v1/sql |
X-API-Key header |
HTTP API |
| SQL (Arrow Flight) | grpc+tls://flight.spiceai.io |
Password in handshake | Arrow Flight API |
| LLM Chat | https://data.spiceai.io/v1/chat/completions |
X-API-Key header |
LLM API |
| Search | https://data.spiceai.io/v1/search |
X-API-Key header |
Search API |
| Health | https://data.spiceai.io/health |
None | Health API |
The Management API at https://api.spice.ai/v1/ uses personal access tokens or OAuth tokens (not app API keys).
| Endpoint | Documentation |
|---|---|
| Apps | Apps API |
| Deployments | Deployments API |
| API Keys | API Keys API |
| Secrets | Secrets API |
| Members | Members API |
See the full Management API reference.
Official SDKs handle authentication, serialization, and connection management for you.
| Language | Package | Documentation |
|---|---|---|
| Python | spicepy |
Python SDK |
| Node.js | @spiceai/spiceai |
Node.js SDK |
| Go | github.com/spiceai/gospice |
Go SDK |
| Rust | spiceai |
Rust SDK |
| Java | Java SDK | |
| .NET | Dotnet SDK |
from spicepy import Client
client = Client("YOUR_API_KEY")
reader = client.query("SELECT * FROM my_table LIMIT 10")
df = reader.read_pandas()
print(df)| HTTP API | Arrow Flight API | |
|---|---|---|
| Format | JSON | Apache Arrow (binary) |
| Best for | Simple queries, small results | Large datasets, production workloads |
| Row limits | Yes | No |
| Streaming | No | Yes |
| Performance | Good | Best |
| SDK support | All SDKs | All SDKs |
Recommendation: Use Arrow Flight (via SDKs) for production workloads and large result sets. Use the HTTP API for quick testing, small queries, or REST-based integrations.
SELECT * FROM my_table
ORDER BY id
LIMIT 1000 OFFSET 0Increment OFFSET to page through results. Always include ORDER BY for deterministic pagination.
Recent tables provide fast access to the last ~30 minutes of data, ideal for dashboards and monitoring.
Use SQL for filtering, aggregation, and joins, then use client libraries (pandas, NumPy, etc.) for further processing:
reader = client.query("SELECT date, value FROM metrics WHERE date > '2025-01-01'")
df = reader.read_pandas()
df['rolling_avg'] = df['value'].rolling(7).mean()Enable data acceleration on frequently queried datasets to avoid hitting the source on every request.
Set the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable:
# macOS
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=/etc/ssl/cert.pemThe HTTP API has built-in row and timeout limits. Switch to Arrow Flight or an SDK for unlimited streaming results.
The Management API uses personal access tokens, not app API keys. Generate a token under Profile → Personal Access Tokens.