Back to Prompt Library
Coding
APIBackendRESTCoding

REST API Endpoint Generator

Scaffolds a complete, validated, well-documented REST API endpoint in any stack.

Prompt Template

Design and implement a REST API endpoint for [ENDPOINT PURPOSE — e.g. 'user authentication', 'product search', 'order creation']. Stack: [LANGUAGE/FRAMEWORK — Node.js/Express, Python/FastAPI, etc.]. Include: (1) the route definition with HTTP method and path, (2) request validation (required fields, types, constraints), (3) business logic with inline comments, (4) success response with example JSON (200/201), (5) error responses for: 400 bad request, 401 unauthorized, 404 not found, 500 server error, (6) one middleware function for authentication/logging if relevant. Follow RESTful conventions. Add JSDoc or docstring comments.

How to use this prompt

  1. Copy the prompt template using the button above.
  2. Paste it into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.).
  3. Replace all bracketed placeholders like [TOPIC] with your specific details.
  4. Send the prompt and refine the output as needed.
Advertisement