Back to prompts
Coding & DevelopmentPremiumadvanced
4.8

Design Your API Architecture From Requirements

Transform product requirements into a complete REST or GraphQL API design with endpoints, schemas, and auth.

Copy & Paste this prompt
You are a senior API architect with 15 years of experience designing scalable APIs for companies like Stripe, Twilio, and GitHub.

Design a complete API architecture based on these requirements:

Project: [PROJECT NAME]
Type: [REST / GraphQL / both]
Requirements:
[LIST YOUR FEATURES AND USE CASES]

Deliver:

1. **Resource Model** — List all resources/entities with relationships (1:1, 1:N, N:N)
2. **Endpoint Design** — For each resource:
   - Method + path (RESTful conventions)
   - Request/response schema (TypeScript interfaces)
   - Query parameters for filtering, pagination, sorting
3. **Authentication & Authorization**
   - Auth strategy (JWT, API keys, OAuth2)
   - Permission model (roles, scopes, resource ownership)
4. **Error Handling**
   - Standard error response format
   - Common error codes with examples
5. **Versioning Strategy** — How to handle breaking changes
6. **Rate Limiting** — Tiers and limits per endpoint
7. **Pagination** — Cursor vs offset, default page sizes
8. **Webhooks** — Events to expose, payload format, retry policy

Follow these principles:
- Consistent naming conventions
- Idempotent operations where possible
- HATEOAS links for discoverability
- OpenAPI 3.0 compatible
#API#architecture#REST#GraphQL#system-design

Works with

chatgptclaudegemini

💡 Pro Tips

  • Start with the 3 most critical user flows, not all endpoints at once
  • Ask for OpenAPI YAML output for direct import into Swagger
  • Follow up with 'Add database schema for this API'

🧠 Why This Works

Good API design prevents years of technical debt. This prompt applies REST and GraphQL design principles—resource modeling, versioning strategy, and authentication patterns—to produce a comprehensive API blueprint before you write any code.

📅 When to Use This Prompt

Use when starting a new backend service and need to design endpoints from requirements, when migrating from a monolith to microservices, or when planning a public API that external developers will consume.

🎯 What You'll Get

You'll get a complete API design document including resource definitions, endpoint specifications, authentication flow, versioning strategy, pagination approach, and error response standards—ready for team review and implementation.

🔗 Related Prompts

Coding & DevelopmentPremium

RESTful API Design Architect

Design a complete, production-ready API from scratch — endpoints, auth, error handling, versioning, and documentation.

api-designrestbackend
4.8
advanced
Coding & DevelopmentPremium

Database Schema Designer

Design a normalized, scalable database schema from a project description — tables, relationships, indexes, and queries.

databaseschema-designsql
4.8
advanced
Coding & DevelopmentPremium

System Design Interview Simulator

Practice system design interviews with a realistic AI interviewer — get architecture feedback, follow-up questions, and…

system-designinterviewarchitecture
4.9
advanced