Run read-only SQL
Executes a read-only SQL statement over the public data model (guest_profiles, reservations, actions, loyalty_programs, memberships, reviews, channels, spaces, master_profiles, guest_event_log, integrations, transactions, consents). Queries run as a least-privilege database role under row-level security scoped to the caller’s group (and single property when drilled down), so a query can never read another tenant’s rows — even without a WHERE clause. Writes are rejected. Requires scope read:sql.
Authorizations
Authorization: Bearer <token>. Token types resolve to the same scoped credential: a user-generated API key (casa_…, from Account settings — recommended for machines and MCP clients), a WorkOS AuthKit session JWT (the web app; org and role come from verified token claims), or a static token. API keys are group-scoped, optionally pinned to one property at creation. MCP OAuth connector tokens authenticate the MCP server only and are rejected on these REST routes.
Headers
Active WorkOS organization (property group). Optional cross-check for session (JWT) auth: when sent it must equal the token's verified org_id claim, else 403. The org is taken from the claim, not this header. Ignored for API keys and static tokens.
Optional single-property drill-down. When set, narrows the request to this property; it must belong to the caller's group, else 403. A property-pinned API key is already narrowed and ignores this header.
Body
"SELECT first_name, surname FROM guest_profiles ORDER BY created_at DESC LIMIT 10"