Home/Templates/API Design
Coding

API Design Prompt Template

Design a RESTful API with endpoints, request/response schemas, error codes, and versioning strategy for any application.

The Prompt

ROLE: You are a senior API architect who has designed the public APIs for multiple developer platforms — you design APIs that developers enjoy using, not just APIs that technically work. CONTEXT: You are designing a RESTful API that will be used by internal teams, external developers, or both. A poorly designed API is a permanent liability — every design decision you make now will be lived with for years. The goal is an API that is predictable, consistent, and self-documenting. TASK: Design a complete, production-ready RESTful API for the application or feature described below. RULES: • Resource names must be plural nouns, never verbs (e.g. /users not /getUsers) • Every endpoint must have a request schema, a success response schema, and at least 2 error response schemas • Authentication approach must specify the exact mechanism (Bearer JWT, API key in header, OAuth 2.0 scope) — not just "add auth" • Include the versioning strategy in the base URL and explain the deprecation policy • Flag any design decision that requires a tradeoff (e.g. REST vs RPC for a specific operation) with a [TRADEOFF:] note CONSTRAINTS: All schemas in JSON format. HTTP status codes must be correct (don't use 200 for created resources — use 201). Use RESTful conventions strictly, not

🔒

Upgrade to see the full prompt

Get unlimited access to all 215+ templates — starting at $9/month.

✦ Upgrade to Pro

Already have an account? Sign in

How to use this template

1

Copy the template

Click the copy button to grab the full prompt text.

2

Fill in the placeholders

Replace anything in [BRACKETS] with your specific details.

3

Paste into any AI tool

Works with ChatGPT, Claude, Gemini, Cursor, and more.

4

Or enhance with AI

Sign in to PromptIt and let AI tailor the prompt to your exact situation in seconds.

Why this prompt works

The '[TRADEOFF:] note' requirement forces the AI to acknowledge design decisions rather than presenting one approach as obvious — this is what distinguishes a thoughtful design from a formulaic one. The error schema requirement per endpoint prevents the common failure of designing success paths only.

Tips for best results

  • Give the AI your existing data models before running this — an API designed around your actual entities is far more accurate than one built from scratch
  • Ask for OpenAPI 3.0 YAML output after the design is agreed — it becomes immediately usable in Swagger UI and code generators
  • The pagination strategy decision (cursor vs offset) is the most commonly under-specified — add your expected data volume to SCALE_EXPECTATION so the AI recommends correctly
  • Run this for one resource group at a time for complex applications — you'll get more detailed schemas and catch edge cases earlier

More Coding templates

Code Review

Get a comprehensive AI code review covering bugs, performance issues, security vulnerabilities, best practice violations, and refactoring opportunities with specific line references.

View →

Debug an Error

Diagnose any code error with a structured breakdown: root cause analysis, step-by-step fix, and prevention strategies for the future.

View →

Explain Code Simply

Translate complex code into plain English with line-by-line explanations, real-world analogies, and edge-case analysis for any skill level.

View →
← Browse all 215 templates