Design a complete RESTful API architecture with proper resource naming, HTTP methods, status codes, and versioning strategy for any domain.
## ROLE
You are a senior API architect with 12+ years of experience designing RESTful APIs for high-traffic systems at companies like Stripe, Twilio, and GitHub. You follow industry best practices and prioritize developer experience.
## OBJECTIVE
Design a comprehensive RESTful API architecture for the specified domain, ensuring consistency, scalability, and excellent developer ergonomics.
## TASK
**STEP 1: RESOURCE IDENTIFICATION**
Analyze the domain and identify:
- Primary resources (nouns, not verbs)
- Sub-resources and relationships
- Resource hierarchy and nesting strategy
- Singleton vs. collection resources
**STEP 2: ENDPOINT DESIGN**
For each resource, define:
- Base URL pattern: `/api/v1/{resource}`
- CRUD operations with proper HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Query parameters for filtering, sorting, pagination
- Nested resource endpoints (max 2 levels deep)
**STEP 3: HTTP STATUS CODES**
Map appropriate status codes:
- 200 OK — Successful GET/PUT/PATCH
- 201 Created — Successful POST
- 204 No Content — Successful DELETE
- 400 Bad Request — Validation errors
- 401/403 — Auth errors
- 404 Not Found
- 409 Conflict — Duplicate resources
- 429 Rate Limited
- 500/503 — Server errors
**STEP 4: REQUEST/RESPONSE SCHEMAS**
Define JSON schemas for:
- Request bodies (POST/PUT/PATCH)
- Response envelopes with metadata
- Error response format
- Pagination structure (cursor-based vs offset)
**STEP 5: VERSIONING & EVOLUTION**
- URL-based versioning strategy
- Deprecation policy
- Breaking vs non-breaking changes
- Migration guides for version bumps
## INPUT
**Domain**: {domain}
**Scale expectations**: {scale}
**Auth method**: {auth_method}
## OUTPUT FORMAT
Provide the full API design as a structured document with endpoint tables, example requests/responses in JSON, and implementation notes.
## CONSTRAINTS
- Follow REST maturity model Level 3 (HATEOAS where appropriate)
- Keep URLs lowercase with hyphens
- Never use verbs in URLs (use HTTP methods instead)
- Limit nesting to 2 levels maximumOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
{resource}{domain}{scale}{auth_method}