api-layer

api-layer is a cursor rule for Cursor from airweave-ai/airweave. It costs 0 tokens per session (2,105 once invoked), scanned A, original, MIT.

An HTTP interface built with FastAPI exposes REST endpoints for an SDK and a frontend. REST endpoints are URLs that applications use to request or change data, with authentication through Auth0 or API keys.

In plain words
What is it for?
Use it to connect frontends and SDKs to Airweave, authenticate requests, manage data sources, and create short-lived sessions for embedded connection flows.
Why use it?
It provides one place for applications to access sources, collections, connections, users, and other Airweave data while checking who is allowed to use them.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to connect frontends and SDKs to Airweave, authenticate requests, manage data sources, and create short-lived sessions for embedded connection flows.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/airweave-ai/airweave/api-layer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/airweave-ai/airweave

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-layer

README.md
[![agentmods](https://agentmods.dev/badge/rules/airweave-ai/airweave/api-layer/github.svg)](https://agentmods.dev/rules/airweave-ai/airweave/api-layer)
Your own site
<a href="https://agentmods.dev/rules/airweave-ai/airweave/api-layer"><img src="https://agentmods.dev/badge/rules/airweave-ai/airweave/api-layer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-layer

Your own site · 80×15
<a href="https://agentmods.dev/rules/airweave-ai/airweave/api-layer"><img src="https://agentmods.dev/badge/rules/airweave-ai/airweave/api-layer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,105 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02105
Opus 5.5 $0.00000 $0.00842
Sonnet 5.5 $0.00000 $0.00421
Haiku 4.5 $0.00000 $0.00211

Measured 1mo ago against content hash 97bbb4a190b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-layer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/api-layer.mdc · 242 lines

How it starts

The opening of the file, as written. The whole thing — 242 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Airweave API Layer Rules

Overview

FastAPI-based HTTP interface providing RESTful endpoints for SDK access and frontend communication, with unified Auth0/API key authentication.

Architecture

Structure

api/
├── v1/
│   ├── api.py              # Main router aggregation
│   └── endpoints/          # Individual endpoint modules
├── deps.py                 # Dependency injection & auth resolution
├── router.py              # Custom TrailingSlashRouter
├── middleware.py          # Request processing & CORS
└── auth.py               # Auth0 integration & token validation

Endpoint Categories

  • Public API (SDK): /sources/, /collections/, /source-connections/
  • Internal Frontend: /users/, /organizations/, /api-keys/, /sync/, /dag/, /entities/, /destinations/
  • Connect Frontend API: /connect/ - Short-lived session tokens for embedded frontend integration flows (Plaid-style Connect modal)

Key Endpoints

Sources API
  • GET /sources/{short_name}: Retrieves source details including:
    • Core metadata (name, description)
    • Authentication methods (auth_methods)
    • Configuration schemas (auth_fields, config_fields)
    • Auth Provider Support (supported_auth_providers): List of auth provider short names that support this source
Source Connections API
  • POST /source-connections: Creates a new connection with validation:
    • For direct auth: validates credential format
    • For OAuth: handles authorization flows
    • For auth providers: validates provider exists and supports the source
  • POST /source-connections/{id}/verify-oauth: Verifies claim-token ownership and triggers deferred sync. Called after the OAuth callback completes to prove the caller that initiated the flow is the one completing it. Required for all browser-based OAuth flows.

Core Components

1. TrailingSlashRouter

from airweave.api.router import TrailingSlashRouter
router = TrailingSlashRouter()  # Handles /endpoint and /endpoint/

Read the full file on GitHub · 242 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 242 lines · 2,105 tokens per session scan A 97bbb4a190b8

Subscribe to this mod's changes

api-layer is a cursor rule published in the GitHub repository airweave-ai/airweave (6,558 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,105 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.