API & PLANS REFERENCE
HTTP API, RBAC & Plans Reference
Technical reference for Owlly’s session and Bearer authentication, workspace RBAC, MCP token & access log endpoints, atomic observation ledger, and grounded AI search providers.
Authentication: Cookies vs MCP Bearer Tokens
Browser/REST routes and the MCP endpoint use distinct authentication mechanisms with strict origin and workspace isolation.
| Surface | Mechanism | Rules & Headers |
|---|---|---|
| Browser & REST API (/api/*) | owlly_session HttpOnly cookie (24h) or Google OAuth | SameSite=Strict, Secure on HTTPS. Pass X-Workspace-ID: <id> when belonging to multiple workspaces. Mutating requests enforce Origin and Sec-Fetch-Site checks. |
| MCP Server (POST /api/mcp) | Authorization: Bearer owlly_sk_... | Does not accept cookies or X-Workspace-ID; workspace and optional Project Access Scope derive strictly from the token. Supports CORS OPTIONS preflight. |
Workspace RBAC Matrix
All workspace operations require a verified account email and enforce server-side role permissions:
| Capability | owner | admin | editor | viewer |
|---|---|---|---|---|
| Read reports, opportunities, citations, and exports | Yes | Yes | Yes | Yes |
| Manage projects, prompts, drafts, tasks, and brand facts | Yes | Yes | Yes | No |
| Trigger manual or project-wide prompt collection | Yes | Yes | Yes | No |
| Manage MCP tokens (/api/workspace/tokens) & view MCP logs | Yes | Yes | No | No |
| Invite members (admin invites require owner) & rename workspace | Yes | Yes | No | No |
| Billing checkout/portal, refunds, transfer ownership, delete workspace | Yes | No | No | No |
Token Management & MCP Access Log Endpoints
Workspace owners and admins manage MCP tokens and audit logs via the following endpoints:
| Method & Path | Role | Behavior |
|---|---|---|
| GET /api/workspace/tokens | owner / admin | Returns mcp_endpoint, plan, allowed_scopes, and active token metadata (prefix, effective scopes, project scope, paused state, last used). |
| POST /api/workspace/tokens | owner / admin | Accepts {name, scopes, project_ids?, expires_in_days} and returns 201 {token, secret} once. Rate-limited to 20/hour; max 25 active tokens. |
| PATCH /api/workspace/tokens/{id} | owner / admin | Pauses/resumes a token or updates its name and Project Access Scope. |
| DELETE /api/workspace/tokens/{id} | owner / admin | Immediately revokes the token and returns {"ok": true}. |
| GET /api/workspace/mcp-logs | owner / admin | Returns workspace MCP Access Logs (timestamp, token prefix, tool name, outcome status) for auditability. |
Core REST API Endpoints Summary
Full JSON payloads and concurrency contracts are documented in docs/api.md. Key endpoint groups include:
| Domain | Primary Endpoints |
|---|---|
| Projects & Brands | GET/POST /api/projects, PATCH/DELETE /api/projects/{project} |
| Prompts & CSV Import | GET/POST /api/projects/{project}/prompts, POST /api/projects/{project}/prompts/import (up to 250 rows) |
| Collection & Runs | POST /api/prompts/{prompt}/run, POST /api/projects/{project}/run, GET /api/projects/{project}/runs, GET /api/runs/{run} |
| Reports & Opportunities | GET /api/projects/{project}/report, /opportunities, /export.csv, /export.json, /opportunities/export.* |
| Content Pages & Drafts | GET/POST /api/projects/{project}/content-pages, PATCH .../content-pages/{page}, POST .../assessments, GET .../comparison |
| Optimization & Outcomes | GET/POST /api/projects/{project}/optimization-tasks, POST .../publication, POST .../followup, GET .../optimization-report |
| Brand Facts & Alerts | GET/POST /api/projects/{project}/brand-facts, DELETE .../brand-facts/{fact}, GET/PUT .../alert-rule, GET .../alerts |
Plan Quotas & Atomic usage_ledger
One observation equals one newly queued prompt-provider request. Active duplicate jobs do not consume quota, while failed or interrupted requests retain their reservation because upstream API charges may occur (demo fixtures are excluded).
Reservations are recorded atomically in PostgreSQL usage_ledger and persist across project deletions. There are no automatic overage charges; reaching a cap blocks new collection while preserving read and export access.
| Plan | Monthly Price (ex-tax) | Projects | Prompts | Seats | Observations / Period |
|---|---|---|---|---|---|
| Trial (14 days) | ¥0 | 1 | 10 | 1 | 100 total (14 days) |
| Starter | ¥9,800 | 3 | 50 | 3 | 1,000 / billing period |
| Growth | ¥29,800 | 10 | 250 | 10 | 5,000 / billing period |
| Agency | ¥79,800 | 50 | 1,000 | 30 | 20,000 / billing period |
| Self-hosted | — | Unlimited (-1) | Unlimited (-1) | Unlimited (-1) | Unlimited (-1) |
AI Search Providers & Grounding Contract
Search-enabled runs (search: true) must receive verifiable evidence of completed native web search (source="api_grounded"); Owlly never silently falls back to ungrounded model output or across providers.
| Provider ID | Default / Recommended Model | Transport & Grounding | Availability |
|---|---|---|---|
| openai | OPENAI_MODEL (default gpt-6.1-sol / lightweight SaaS slug) | Responses API with web_search tool (user_location.country) | Primary (SaaS default) |
| claude | CLAUDE_MODEL (default claude-opus-5-5 / Sonnet or Haiku) | Messages API with web_search_20250305 (max_uses: 2) | Primary (SaaS default) |
| gemini | GEMINI_MODEL (default gemini-3.8-flash) | Interactions API with google_search (sandboxed search suggestions) | Primary (SaaS default) |
| perplexity | PERPLEXITY_MODEL (default perplexity/sonar) | Agent API (/v1/responses) with web_search_options (search_context_size: medium) | Primary (SaaS default) |
| deepseek | DEEPSEEK_MODEL (default deepseek-v4-pro) | Responses API native search (requires deepseek-v4-pro) | Optional (optional: true) |
| brave | BRAVE_MODEL (default brave-web-grounding) | Web Search API GET /web/search (country=JP, search_lang=jp) | Optional & Quick Check fallback |
| chatgpt | CHATGPT_MODEL (default gpt-6.1-sol) | ChatGPT plan OAuth (siwc-login) | Self-hosted only |