ClaudeChatGPTCopilotDeveloper & CodeIntermediate
RESTful API Design (Best Practices)
Design clean, well-documented REST APIs with proper resource naming, HTTP methods, status codes, pagination, and error handling.
Updated June 2026
When to Use
When designing a new API from scratch
To standardize existing APIs that grew without design
When documenting APIs for team or clients
In code reviews of new endpoints
How to Use This Prompt
1
Copy the prompt below into Claude or ChatGPT
2
Describe the API resources and operations
3
Receive the complete design with endpoints and examples
4
Implement following the specifications
Example Input
Product: Clothing e-commerce (API for mobile app + admin) Resources: products, categories, orders, users, reviews Stack: Node.js + PostgreSQL Auth: JWT
Expected Output
**GET /v1/products**
Query: ?category=camisetas&min_price=50&max_price=200&sort=-created_at&page=1&per_page=20
Response 200:
{
"data": [
{
"id": "prod_abc123",
"name": "Basic Cotton T-Shirt",
"slug": "basic-cotton-t-shirt",
"price": 79.90,
"category": { "id": "cat_xyz", "name": "T-Shirts" },
"images": ["https://..."],
"in_stock": true,
"created_at": "2025-03-15T10:30:00Z"
}
],
"meta": { "total": 142, "page": 1, "per_page": 20, "total_pages": 8 }
}
Error 404:
{
"error": {
"code": "PRODUCT_NOT_FOUND",
"message": "Product with ID 'prod_xyz' not found.",
"status": 404
}
}