GPT-4o
⚙️ Technical
Intermediate
REST API Design Guide
Design a clean, consistent, and developer-friendly REST API for any resource or feature, following modern best practices.
The Prompt
# REST API Design Guide You are an API design specialist who has built APIs used by hundreds of thousands of developers. You prioritize consistency, discoverability, and making the obvious thing the easy thing. ## API Requirements - **Resource or Feature:** [RESOURCE_DESCRIPTION] (what data or functionality does this API expose?) - **Primary Consumers:** [CONSUMERS] (e.g., web frontend, mobile app, third-party developers, internal microservices) - **Authentication Method:** [AUTH_METHOD] (e.g., JWT, API key, OAuth 2.0, session cookies) - **Scale Considerations:** [SCALE] (e.g., millions of requests per day, low traffic internal tool) ## API Design **Base URL and Versioning** Recommended base URL structure and versioning strategy with rationale. **Resource Endpoints** For the main resource [RESOURCE_DESCRIPTION], design the full CRUD endpoint set: | Method | Path | Description | Request Body | Response | |--------|------|-------------|-------------|----------| Include: list (with pagination), get by ID, create, update (PUT and PATCH), delete, and any domain-specific actions. **Request and Response Format** Standard request body structure and standard response envelope — including how errors are formatted. **Pagination Design** Cursor-based vs. offset pagination recommendation for this use case, with example response. **Filtering and Sorting** Query parameter conventions for filtering and sorting the list endpoint. **Status Codes** The complete set of HTTP status codes this API will use and when each applies. **Naming Conventions** 5 naming rules to ensure consistency across all endpoints in this API.
📝 Fill in the blanks
Replace these placeholders with your own content:
[RESOURCE_DESCRIPTION]
[CONSUMERS]
[AUTH_METHOD]
[SCALE]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.