Resources / Code generation
How to describe an API so an AI builds it right
Prompting for backend code: inputs, outputs, errors, data and limits — with examples of vague versus precise requests.
The model will build exactly what you describe — and guess at everything you don't. A few extra sentences up front save several rounds of fixes.
Say what goes in and what comes out
Name the method, the inputs and the shape of the response:
POST /quote takes { items: [{ sku, qty }], country } and returns
{ subtotal, tax, shipping, total } in cents.
Say where the data comes from
"Using the Open-Meteo API", "from our Airtable base Orders", "stored in a table". If credentials are needed, say so — a good builder will ask for them securely rather than hard-coding them.
Say what should fail
Models handle the happy path by default. Spell out the rest: "return 400 if qty is below 1", "return 404 for unknown SKUs", "if the shipping API is down, return the quote without shipping and a warning".
Mention limits and side effects
"At most 100 items", "cache results for 10 minutes", "send the email only in live mode, not in tests", "each customer can call it 60 times a minute".
Vague versus precise
- "a weather API" becomes "GET /weather?city= returns temperature in °C and a one-line summary from Open-Meteo; 404 if the city isn't found".
- "add auth" becomes "require an API key for every endpoint except /health".
- "save signups" becomes "POST /signup stores { email, source } in a signups table; 409 if the email exists".
Iterate in small steps
Build one endpoint, test it, then add the next. Small changes are easier to check and easier to undo.
In Wisp
Type the description in the prompt box. Wisp asks for the language and any API keys it needs, writes the endpoint, tests it and tells you how to call it.
Build it with Wisp — describe an API, get it live.