
- Prompt at a glance
- Category
- Text & chat
- Works with
- Claude · ChatGPT · Gemini
- Length
- 85 words
- Fields to fill
- STACK, METHOD AND PATH, LIST
- Last updated
Build a REST API endpoint with validation
This prompt builds one API endpoint properly: validated input, the right status codes, one error format and no internal details leaked. It also handles two requests arriving at once and includes tests.
Act as a senior backend developer using [STACK, e.g. Node.js with Express and Zod]. Endpoint: [METHOD AND PATH, e.g. POST /api/bookings] What it does: [e.g. creates a booking if the slot is free] Input fields and rules: [LIST] Data store: [e.g. Postgres with Prisma] Write the route with input validation, clear status codes, error responses in one consistent shape, and no internal details leaked to the client. Handle the case where two requests arrive at once. Include two example requests with curl and two tests.
Ask for the error format you already use in your app, so every endpoint answers in the same shape.
From copy to answer in four steps
- 1
Open Claude and start a new chat.
- 2
Paste the prompt.
- 3
Replace each [BRACKETED] field with your real details and paste in your own text where asked.
- 4
Reply with follow-ups such as "make it shorter" or "make it sound more like me".
About this prompt
Which AI tools work with this prompt?
It is written for Claude, ChatGPT and Gemini. Paste it into your preferred tool and adjust the wording if the result is off.
What do I need to fill in?
Replace these fields before you send it: STACK, METHOD AND PATH, LIST. Each field shows an example in the prompt.
Should I paste private information into the prompt?
Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.