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, noting any intentional deviations. EDITABLE VARIABLES: • [APPLICATION_FEATURE] — what the API exposes (e.g. "user management for a SaaS product", "payment processing") • [CONSUMERS] — who will call this API (internal services, mobile apps, third-party developers) • [AUTH_METHOD] — preferred authentication mechanism • [SCALE_EXPECTATION] — approximate request volume to inform rate limiting decisions OUTPUT FORMAT: **Base URL:** /api/v[N]/ **Authentication:** [Mechanism + example header] **Rate Limiting:** [Strategy + headers] **Endpoints:** [For each resource group] GET /resource — [description] Request: [params/body schema] Response 200: [schema] Response 400/404/401: [schema] **Error Response Standard:** [Consistent error envelope format] **Versioning & Deprecation Policy:** [Strategy] **[TRADEOFF:] notes** [Design decisions explained] QUALITY BAR: A developer who has never spoken to you should be able to build a complete client integration using only this API design document, without asking a single clarifying question.

Make it specific to you

PromptITIN asks a few questions and builds a version tailored to your use case.

✦ Enhance with AI

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 PromptITIN 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 195 templates