| Item | Value |
|---|---|
| Package | surrealdb.swift |
| Product | Spectron |
| Install | .product(name: "Spectron", package: "surrealdb.swift") |
| Import | import Spectron |
Configuration
| Setting | Purpose |
|---|---|
context | Path segment after /api/v1/ |
endpoint | Base URL (no trailing slash) |
apiKey | Context API key |
Auth header
Core operations (REST mapping)
| SDK area | HTTP |
|---|---|
| Facts | POST /api/v1/{ctx}/facts, POST .../facts/batch |
| Query / context | POST .../query, POST .../context |
| Chat | POST .../chat |
| Documents | POST/GET/DELETE .../documents |
| Sessions | POST/GET/DELETE .../sessions |
| Entities | GET/DELETE .../entities/{type}/{name} |
| Governance | .../scopes, .../principals, .../keys |
Full tables: REST API.
Delegation and idempotency
Pass
onBehalfOf:to act as another principal. It is sent as theX-Spectron-On-Behalf-Ofheader.Writes carry an
Idempotency-Keyheader for safe retry deduplication.
Errors
All failures throw SpectronError with fields status, title, detail, retryAfter, typeURI, instance and extensions. The kind maps to .base, .auth, .scope, .notFound, .validation, .rateLimit or .server. See Errors.
User guide
See Swift SDK for usage patterns.