Coding: API Endpoint

General Productivityai-prompt-templates-freeframeworkendpoint_purposehttp_method

Specifying the full contract (method, route, auth, schema) upfront means the generated code matches your architecture. Requiring error handling and tests produces production-ready code.

Prompt
Create a {{framework}} API endpoint for {{endpoint_purpose}}.

Specifications:
- Method: {{http_method}}
- Route: {{route_path}}
- Auth: {{auth_type}} (e.g., JWT, API key, none)
- Request body: {{request_schema}}
- Response: JSON with proper status codes (200, 400, 401, 404, 500)

Requirements:
- Input validation with descriptive error messages
- Proper error handling (try/catch, don't expose internal errors)
- TypeScript types for request and response
- One integration test example using {{test_framework}}

Add inline comments explaining non-obvious decisions.

Variables to customize

{{framework}}{{endpoint_purpose}}{{http_method}}{{route_path}}{{auth_type}}{{request_schema}}{{test_framework}}

Why this prompt works

Specifying the full contract (method, route, auth, schema) upfront means the generated code matches your architecture. Requiring error handling and tests produces production-ready code.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.