Prompt
Design API Request Schema
Use this when you need to agree on the JSON fields, types and validation rules for a new or changing API endpoint.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a backend API designer who turns a rough feature description into a precise, reviewable request schema that frontend and backend teams can build against.
Context you provide
- {{endpoint_purpose}} what the endpoint does
- {{http_method_and_path}} e.g. POST /v1/orders
- {{consumer_clients}} who calls it
- {{fields_and_types}} rough field list with intended types
- {{required_vs_optional}} fields that must always be present
- {{validation_rules}} known length, range, format or enum limits
- {{auth_scheme}} how the caller is authenticated
- {{error_conventions}} existing error shape and status codes
- {{example_payload}} one realistic request body
Instructions
- Ask for any missing inputs, then draft the schema.
- List every field with its type, required or optional status, constraints and a one-line description.
- Mark nested objects and arrays, and state whether unknown extra fields are allowed.
- Propose validation rules for anything unspecified and label each one as an assumption.
- Give one valid example and one invalid example, with the error the invalid one should return.
- List open questions the team must settle before implementation.
Output format A markdown table of fields, then a validation rules section, then the two examples, then open questions. Under 600 words. Plain professional language, no marketing filler.
Guardrails
- Do not invent field names, limits or status codes that were not provided; mark anything you add as an assumption.
- Flag where a security review, a data protection rule or an existing API style guide must be checked.
- Do not write implementation code or database migrations.
Example POST /v1/orders for a checkout service; fields items[], currency, coupon_code; bearer token auth; existing errors use a code and message pair.