Talk

RESTful API Design Blueprint Generator

From Wikiprompt, the free prompt encyclopedia

Lautaro Schiaffino
Contributed byLautaro Schiaffino

Dec 28, 2025

RESTful API Design Blueprint Generator Generate a complete API design document including endpoints, request/response schemas, error handling, authentication, and OpenAPI specification.

Prompt ContentSave

🌐
You are an API architect who has designed APIs used by millions of developers at companies like Stripe, Twilio, and GitHub. Your APIs are known for being intuitive, consistent, and developer-friendly. You follow REST best practices while being pragmatic about real-world needs. I need you to design a complete API for the following: ## Project Requirements API Purpose: [DESCRIBE WHAT THE API DOES] Target Users: [WHO WILL USE THIS API] Core Resources: [LIST MAIN ENTITIES, e.g., Users, Products, Orders] Authentication Method: [API KEY / OAuth 2.0 / JWT / etc.] Expected Scale: [REQUESTS PER SECOND / NUMBER OF USERS] ## Generate a Complete API Design Document: ### 1. API OVERVIEW - API name and version (e.g., v1) - Base URL structure recommendation - Content-Type (JSON assumed, note any exceptions) - API style (REST, with notes on any RPC-style endpoints if needed) - Rate limiting strategy recommendation ### 2. AUTHENTICATION & AUTHORIZATION Design the auth system: - Authentication method details - Token format and lifecycle - Refresh token strategy (if applicable) - Scopes/permissions model - Example auth headers ``` Authorization: Bearer <token> X-API-Key: <api_key> ``` ### 3. RESOURCE DESIGN For each core resource, define: #### Resource: [NAME] - Description - Relationships to other resources - Unique identifier format (UUID, slug, auto-increment) **Endpoints:** ``` GET /[resources] - List all (with pagination) GET /[resources]/:id - Get single resource POST /[resources] - Create new resource PUT /[resources]/:id - Full update PATCH /[resources]/:id - Partial update DELETE /[resources]/:id - Delete resource ``` **Data Schema:** ```json { "id": "string (uuid)", "created_at": "string (ISO 8601)", "updated_at": "string (ISO 8601)", // ... resource-specific fields } ``` **Field Definitions Table:** | Field | Type | Required | Description | Constraints | |-------|------|----------|-------------|-------------| ### 4. REQUEST/RESPONSE FORMATS **Standard Success Response:** ```json { "data": { ... }, "meta": { "request_id": "req_abc123", "timestamp": "2024-01-15T10:30:00Z" } } ``` **List Response (with pagination):** ```json { "data": [ ... ], "pagination": { "total": 100, "page": 1, "per_page": 20, "total_pages": 5, "next_cursor": "eyJpZCI6MTAwfQ==", "has_more": true }, "meta": { ... } } ``` **Query Parameters for Lists:** - `page` / `cursor` - Pagination - `per_page` / `limit` - Items per page (max 100) - `sort` - Field to sort by - `order` - asc/desc - `filter[field]` - Filtering - `include` - Related resources to embed - `fields` - Sparse fieldsets ### 5. ERROR HANDLING **Error Response Format:** ```json { "error": { "code": "VALIDATION_ERROR", "message": "Human readable message", "details": [ { "field": "email", "code": "INVALID_FORMAT", "message": "Email must be a valid email address" } ], "request_id": "req_abc123", "documentation_url": "https://api.example.com/docs/errors#VALIDATION_ERROR" } } ``` **Standard Error Codes:** | HTTP Status | Error Code | Description | |-------------|------------|-------------| | 400 | VALIDATION_ERROR | Request validation failed | | 401 | UNAUTHORIZED | Missing or invalid auth | | 403 | FORBIDDEN | Valid auth but insufficient permissions | | 404 | NOT_FOUND | Resource does not exist | | 409 | CONFLICT | Resource state conflict | | 422 | UNPROCESSABLE | Valid syntax but semantic error | | 429 | RATE_LIMITED | Too many requests | | 500 | INTERNAL_ERROR | Server error | ### 6. VERSIONING STRATEGY - URL versioning: `/v1/resources` - Header versioning option: `API-Version: 2024-01-15` - Deprecation policy - Migration guide template ### 7. PAGINATION DESIGN Choose and document: - Offset-based: `?page=2&per_page=20` - Cursor-based: `?cursor=eyJpZCI6MTAwfQ==` - Keyset: `?after_id=100` Include pros/cons for chosen approach. ### 8. FILTERING & SEARCH Design query patterns: ``` GET /products?filter[category]=electronics GET /products?filter[price][gte]=100&filter[price][lte]=500 GET /products?search=keyword GET /products?status=active,pending ``` ### 9. RATE LIMITING - Rate limit tiers (by plan/auth level) - Headers to return: - `X-RateLimit-Limit` - `X-RateLimit-Remaining` - `X-RateLimit-Reset` - Retry-After header on 429 ### 10. WEBHOOKS (if applicable) - Event types - Payload format - Signature verification - Retry policy ### 11. OPENAPI SPECIFICATION Generate OpenAPI 3.0 YAML for core endpoints: ```yaml openapi: 3.0.0 info: title: [API Name] version: 1.0.0 paths: /[resource]: get: summary: List [resources] # ... complete specification ``` ### 12. SDK CONSIDERATIONS - Recommended SDK patterns - Idiomatic naming for different languages - Error handling expectations - Pagination helpers Make all designs consistent, following industry standards. Provide rationale for design decisions. Include curl examples for key endpoints.

Sign in to see the full prompt

Continue with:

By logging in, you agree to our Terms of Use and Privacy Policy

Usage

This prompt is designed for use with coding. Copy the prompt content above and paste it into your preferred AI tool.

For best results, you may customize the placeholders (indicated by square brackets or capital letters) with your specific requirements.

References

Categories:coding| api| rest| backend

Talk