# API Endpoint

> Generate Express.js API endpoint with Auth0 JWT middleware, Zod validation, and Swagger docs Use when this capability is needed.

- Skill: `tomevault-io/api-endpoint-3` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/api-endpoint-3`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/api-endpoint-3/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/api-endpoint-3

---


Create a new Express.js API endpoint for {{feature}}.

Include:
- Route registration in services/api-backend/routes/
- Auth0 JWT middleware (requireAuth)
- Request validation with Zod schemas
- Winston logging
- Error handling with proper HTTP status codes
- OpenAPI/Swagger documentation comment

Follow existing patterns in services/api-backend/routes/auth.js

Example structure:
```javascript
import express from 'express';
import { requireAuth } from '../middleware/auth.js';
import { logger } from '../utils/logger.js';
import { z } from 'zod';

const router = express.Router();

// Request schema
const schema = z.object({
  // fields
});

// POST /api/{{feature}}
router.post('/', requireAuth, async (req, res, next) => {
  try {
    // Validate request
    const validated = schema.parse(req.body);

    // Log request
    logger.info({ userId: req.auth.payload.sub, action: '{{feature}}' }, '{{feature}} request');

    // Business logic

    res.json({ success: true });
  } catch (error) {
    next(error);
  }
});

export default router;
```

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/cloudtolocalllm-online) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

