Backend API
Use this sub-skill when an Airweave task touches the FastAPI service as a user-facing API: collection search, collection CRUD, source-connection creation/auth/sync jobs, Connect sessions, browse-tree node selection, source discovery, auth-provider connections, API keys, usage checks, source rate limits, webhook subscriptions/messages, or local debugging of agentic search streams.
Route to the right reference
- Read references/api-reference.md for endpoint tables, request bodies, response shapes, filters, auth/header rules, and status/error conventions.
- Read references/workflows.md for end-to-end recipes: create-and-search, search tier selection/cancel/retry, OAuth claim-token verification, Connect sessions, browse-tree selection, webhooks, and source rate-limit checks.
- Read references/troubleshooting.md when diagnosing 401/403/404/422/429 errors, search/SSE stalls, usage blocks, OAuth pending states, Connect mode failures, webhook delivery problems, or source rate-limit surprises.
- Use scripts/agentic_search_stream.py as the bundled CLI viewer for
POST /collections/{readable_id}/search/agentic/stream when a local backend is running.
- Cross-link to sibling source-connectors for connector registry semantics, source capability fields, browse-tree source implementation behavior, and per-source config/auth details.
- Cross-link to sibling connect-widget for iframe messaging, SDK/session-mode UX, OAuth popup handling, and parent-window token exchange details.
Operating rules
- Use root-relative backend paths such as
/collections and /source-connections; do not add an /api/v1 prefix to dashboard/client code.
- Use collection
readable_id values in collection search and collection CRUD paths. Use UUIDs for source-connection IDs, sync job IDs, webhook subscription/message IDs, and Connect session IDs.
- Preserve headers. Regular backend calls need the normal user/API auth context plus
X-Organization-ID when operating in a selected organization. Connect session calls use Authorization: Bearer <session_token> and are not ordinary API-key calls.
- Treat usage checks as preflight hints and backend checks as authoritative. Instant/classic/browse/legacy search consume
queries; agentic and agentic stream consume tokens; source creation and sync creation also check their usage actions.
- Keep the search tiers distinct: instant is direct retrieval, classic asks an LLM to plan before retrieval, agentic runs a tool-using loop, and agentic streaming returns Server-Sent Events.
- Do not mix filter dialects. V2 search tiers use
filter: [{conditions: [...]}]; the legacy search route accepts a Qdrant-style dict such as {must: [...]}.
- Preserve the OAuth claim-token contract: keep the
claim_token from source-connection creation until verify-oauth succeeds; removing it earlier leaves the flow unrecoverable for the user without re-initiation.
- Keep destructive lifecycle operations explicit. Deleting a collection or source connection cascades/cleans synced data; cancelling a sync transitions through
cancelling before cancelled.
- Keep Connect widget iframe internals and source implementation internals out of this sub-skill. Route iframe messaging to
connect-widget; route source class/config/browse-tree implementation details to source-connectors.
- Do not depend on the original repository checkout for runtime guidance. Use the bundled references and helper script here.
Quick decision map
| User intent |
Start here |
Notes |
| "Which search endpoint/body should I use?" |
api-reference.md → Search v2 and legacy search |
Check tier, filter dialect, and usage action. |
| "Search stream hangs or shows wrong events" |
troubleshooting.md → SSE/search stream |
Confirm current /collections/{id}/search/agentic/stream path and event names. |
| "Create collection and index a source" |
workflows.md → Collection to searchable data |
Covers collection, source connection, sync polling, and cleanup. |
| "OAuth source is stuck pending" |
workflows.md and troubleshooting.md → OAuth claim token |
Verify before clearing stored claim token; re-initiate when needed. |
| "Embed Airweave Connect" |
workflows.md → Connect session backend flow, then connect-widget |
Backend owns session/source-connection endpoints; widget owns iframe details. |
| "Select folders/items before sync" |
workflows.md → Browse-tree selection, then source-connectors |
Backend owns routes; connector skill owns source capability semantics. |
| "Subscribe to events" |
api-reference.md and workflows.md → Webhooks |
Include event types, secret handling, attempts, recovery. |
| "Why is a source sync slow/throttled?" |
api-reference.md → source rate limits, then troubleshooting.md |
Check feature flag, source rate_limit_level, and configured limits. |
Validation anchors for later verification
Later whole-skill verification should exercise representative native backend smoke coverage for search v2, legacy search, filters, agentic SSE, collections, Connect sessions, source connections, webhooks, source listing, rate limiting, sync run/cancel lifecycle, entity definitions, and storage-backed sync. Credentialed provider flows should remain opt-in unless the required external accounts and secrets are available.
1---2name: backend-api3description: "Operates Airweave's backend API surface for search tiers,4 collections, source connections, Connect sessions, browse-tree selection,5 sources, webhooks, usage checks, source rate limits, and streaming search6 debugging."7disable-model-invocation: true8metadata:9 source: https://skillmd.com/skills/vectorspacelab/backend-api10 disco-role: operating11license: MIT12---1314# Backend API1516Use this sub-skill when an Airweave task touches the FastAPI service as a user-facing API: collection search, collection CRUD, source-connection creation/auth/sync jobs, Connect sessions, browse-tree node selection, source discovery, auth-provider connections, API keys, usage checks, source rate limits, webhook subscriptions/messages, or local debugging of agentic search streams.1718## Route to the right reference1920- Read [references/api-reference.md](references/api-reference.md) for endpoint tables, request bodies, response shapes, filters, auth/header rules, and status/error conventions.21- Read [references/workflows.md](references/workflows.md) for end-to-end recipes: create-and-search, search tier selection/cancel/retry, OAuth claim-token verification, Connect sessions, browse-tree selection, webhooks, and source rate-limit checks.22- Read [references/troubleshooting.md](references/troubleshooting.md) when diagnosing 401/403/404/422/429 errors, search/SSE stalls, usage blocks, OAuth pending states, Connect mode failures, webhook delivery problems, or source rate-limit surprises.23- Use [scripts/agentic_search_stream.py](scripts/agentic_search_stream.py) as the bundled CLI viewer for `POST /collections/{readable_id}/search/agentic/stream` when a local backend is running.24- Cross-link to sibling [source-connectors](../source-connectors/SKILL.md) for connector registry semantics, source capability fields, browse-tree source implementation behavior, and per-source config/auth details.25- Cross-link to sibling [connect-widget](../connect-widget/SKILL.md) for iframe messaging, SDK/session-mode UX, OAuth popup handling, and parent-window token exchange details.2627## Operating rules28291. Use root-relative backend paths such as `/collections` and `/source-connections`; do not add an `/api/v1` prefix to dashboard/client code.302. Use collection `readable_id` values in collection search and collection CRUD paths. Use UUIDs for source-connection IDs, sync job IDs, webhook subscription/message IDs, and Connect session IDs.313. Preserve headers. Regular backend calls need the normal user/API auth context plus `X-Organization-ID` when operating in a selected organization. Connect session calls use `Authorization: Bearer <session_token>` and are not ordinary API-key calls.324. Treat usage checks as preflight hints and backend checks as authoritative. Instant/classic/browse/legacy search consume `queries`; agentic and agentic stream consume `tokens`; source creation and sync creation also check their usage actions.335. Keep the search tiers distinct: instant is direct retrieval, classic asks an LLM to plan before retrieval, agentic runs a tool-using loop, and agentic streaming returns Server-Sent Events.346. Do not mix filter dialects. V2 search tiers use `filter: [{conditions: [...]}]`; the legacy search route accepts a Qdrant-style dict such as `{must: [...]}`.357. Preserve the OAuth claim-token contract: keep the `claim_token` from source-connection creation until `verify-oauth` succeeds; removing it earlier leaves the flow unrecoverable for the user without re-initiation.368. Keep destructive lifecycle operations explicit. Deleting a collection or source connection cascades/cleans synced data; cancelling a sync transitions through `cancelling` before `cancelled`.379. Keep Connect widget iframe internals and source implementation internals out of this sub-skill. Route iframe messaging to `connect-widget`; route source class/config/browse-tree implementation details to `source-connectors`.3810. Do not depend on the original repository checkout for runtime guidance. Use the bundled references and helper script here.3940## Quick decision map4142| User intent | Start here | Notes |43| --- | --- | --- |44| "Which search endpoint/body should I use?" | `api-reference.md` → Search v2 and legacy search | Check tier, filter dialect, and usage action. |45| "Search stream hangs or shows wrong events" | `troubleshooting.md` → SSE/search stream | Confirm current `/collections/{id}/search/agentic/stream` path and event names. |46| "Create collection and index a source" | `workflows.md` → Collection to searchable data | Covers collection, source connection, sync polling, and cleanup. |47| "OAuth source is stuck pending" | `workflows.md` and `troubleshooting.md` → OAuth claim token | Verify before clearing stored claim token; re-initiate when needed. |48| "Embed Airweave Connect" | `workflows.md` → Connect session backend flow, then `connect-widget` | Backend owns session/source-connection endpoints; widget owns iframe details. |49| "Select folders/items before sync" | `workflows.md` → Browse-tree selection, then `source-connectors` | Backend owns routes; connector skill owns source capability semantics. |50| "Subscribe to events" | `api-reference.md` and `workflows.md` → Webhooks | Include event types, secret handling, attempts, recovery. |51| "Why is a source sync slow/throttled?" | `api-reference.md` → source rate limits, then `troubleshooting.md` | Check feature flag, source `rate_limit_level`, and configured limits. |5253## Validation anchors for later verification5455Later whole-skill verification should exercise representative native backend smoke coverage for search v2, legacy search, filters, agentic SSE, collections, Connect sessions, source connections, webhooks, source listing, rate limiting, sync run/cancel lifecycle, entity definitions, and storage-backed sync. Credentialed provider flows should remain opt-in unless the required external accounts and secrets are available.