MuseMVP

MuseMVP Base: Next.js for Node and Cloudflare. MuseMVP Flare: an AI SaaS template that runs entirely on Cloudflare. Authentication, billing and administration included.

Product
  • Home
  • Pricing
  • Templates
Resources
  • Docs
  • Blog
  • Changelog
Legal
  • Privacy
  • Terms
  • Community
Open-Launch Top 1 Daily WinnerOpen-Launch Top 1 Daily WinnerVerified DR - Verified Domain Rating for musemvp.comVerified DR - Verified Domain Rating for musemvp.comMuseMVP - Featured on Startup FameMuseMVP - Featured on Startup FameFazier badgeFazier badgeLiftOff award badgeLiftOff award badge

© 2026 MuseMVP. All rights reserved.

MuseMVP
  • Pricing
  • Docs
  • Blog
  • Changelog
Buy MuseMVP Base
MuseMVP Docs
MuseMVP Docs
OverviewTech StackQuick Start
Project Structure
API ArchitectureBackend GuideDefining New RoutesAPI Keys
EmailObject Storage
Internationalization
SEOAnalytics
API

API Keys

Create, view, test, and revoke API Keys in the settings center for programmatic access.

MuseMVP uses the Better Auth API Key plugin to provide full API Token management. Logged-in users can create, view, test, and revoke API Keys on the Settings → API Keys page (/app/settings/tokens) for programmatic access to protected APIs.

Access

Path: /app/settings/tokens. Requires login; unauthenticated users are redirected to the login page.

Overview

Create API Key

Custom name, expiry, prefix, and metadata. Full key is shown only once after creation.

View & Manage

Table view of all keys (name, prefix, status, expiry); per-key actions menu to open the detail dialog or delete.

Online Test

Test dialog with a built-in panel to verify key validity and remaining quota; prefills the most recently created key.

Secure Storage

Keys stored as hashes; full value shown only at creation, not recoverable later.


Page & Routes

PathDescription
/app/settings/tokensAPI Token management page (login required)
src/app/(saas-page)/app/(account)/settings/tokens/page.tsx
src/modules/settings/components/api-keys/ApiKeyManager.tsx
src/modules/settings/components/api-keys/ApiKeyTable.tsx
src/modules/settings/components/api-keys/ApiKeyActionsMenu.tsx
src/modules/settings/components/api-keys/ApiKeyTesterDialog.tsx
src/modules/settings/lib/api-keys.ts
src/modules/settings/lib/api-keys.server.ts

Core Features

Create API Key

Configurable options:

ParameterDescription
nameOptional, human-readable label
expiresInOptional, expiry in seconds
prefixOptional, key prefix for identification
metadataOptional, custom metadata

Key Shown Once

The full key is displayed only once after creation. Save it securely; it cannot be retrieved later.

Verify API Key

Use POST /api/api-keys/verify to validate a key:

// Request body
{ "key": "your-api-key-string" }

// Response (valid)
{
  "valid": true,
  "key": { "id", "name", "referenceId", "remaining", "expiresAt", ... },
  "error": null
}

// Response (invalid)
{
  "valid": false,
  "key": null,
  "error": { "code": "KEY_NOT_FOUND", "message": "..." }
}

This endpoint is protected by authMiddleware and requires a valid session cookie. Verification ensures the key belongs to the current user.


Implementation

Data Flow

Frontend: ApiKeyManager uses useApiKeysQuery to fetch keys from Better Auth.

Create/Update/Delete: Via authClient.apiKey.create/update/delete.

Verify: POST /api/api-keys/verify calls auth.api.verifyApiKey and checks referenceId ownership.

API Endpoints

MethodPathDescription
POST/api/api-keys/verifyVerify API Key (login required)

Better Auth Native APIs

Create, list, update, delete are provided by Better Auth's apiKey plugin via authClient.apiKey.*.


Using in Business APIs

To validate API Keys in custom Hono routes, use Better Auth's verifyApiKey or call auth.api.verifyApiKey with the key from the request header. After validation, use the returned referenceId for subsequent business logic.


Related Docs

Permission Architecture

Auth entry and role middleware

API Architecture

Hono routes and OpenAPI

Defining New Routes

Step-by-step guide on how to create a new API endpoint with validation and OpenAPI metadata.

Authentication Architecture

Map Better Auth entrypoints, session behavior, and role-based middleware boundaries.

On this page

OverviewPage & RoutesCore FeaturesCreate API KeyVerify API KeyImplementationData FlowAPI EndpointsUsing in Business APIsRelated Docs

One payment. Tax included.

MuseMVP Base

Next.js for Node and for Cloudflare, with auth, payments and admin.

$69

Buy MuseMVP Base