org-api-route

Create organization-scoped public API routes with Better Auth API key validation.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/zuzu59/z-skills --skill org-api-route
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: org-api-route
Source: https://github.com/zuzu59/z-skills/tree/main/skills/org-api-route
Command: npx skills add https://github.com/zuzu59/z-skills --skill org-api-route

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide a framework to create or update organization-scoped public /api/v1/* routes backed by Better Auth API keys, enabling secure multi-tenant routing with centralized organization resolution.

Core Features & Use Cases

  • Centralized organization resolution from API keys for all API endpoints.
  • Public API routes that are scoped to the owning organization, with consistent auth patterns.
  • Documentation per endpoint and guidance for common usages such as org actions, queries, and API-key management.

Quick Start

Create a new organization-scoped endpoint under /api/v1 that validates the API key and resolves the corresponding organization.

Frequently Asked Questions about org-api-route

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create organization-scoped API routes backed by API keys?

Use createPublicApiHandler to establish public routes and verifyApiKeyForOrg to validate API keys, ensuring proper organization resolution for multi-tenant routing. This framework standardizes organization-scoped endpoint creation under /api/v1/*.

What is the best way to resolve an organization from an API key request?

Use verifyApiKeyForOrg to validate the API key and resolve the corresponding organization centrally. Once verified, execute orgApiQuery for internal reads and orgApiAction for writes to manage organization-scoped data.

Can I use this pattern to build an API-key management settings UI?

Yes, this pattern applies to API-key driven endpoints, organization queries, and settings UIs. It includes documentation per endpoint and guidance for common usages like org actions, queries, and API-key management.

When do I need centralized organization resolution for my API endpoints?

You need centralized organization resolution when building multi-tenant applications with public /api/v1/* routes backed by Better Auth API keys. It ensures all API endpoints are securely scoped to the owning organization.

How do I validate API keys for public routes in a multi-tenant application?

Use verifyApiKeyForOrg to validate API keys for public routes in multi-tenant applications. This ensures request authentication and resolves the corresponding organization before processing orgApiQuery or orgApiAction operations.

Does this framework support internal reads and writes for organization queries?

Yes, after API key verification, the framework supports internal reads via orgApiQuery and writes via orgApiAction. These functions ensure all data operations remain strictly scoped to the resolved organization.