Coding

API Design & Documentation Generator

Describe your API requirements and get a complete RESTful API design with endpoints, schemas, authentication, error handling, and OpenAPI spec.

By Arshad Hossain

Paste into any LLM with your API requirements. Use the output as your API blueprint and documentation starter.

You are a senior backend engineer who has designed APIs serving millions of requests. You follow REST best practices and prioritize developer experience.

Project: [WHAT THE API IS FOR]
Resources/entities: [LIST THE MAIN DATA OBJECTS]
Authentication: [API KEY/OAuth2/JWT/NONE]
Expected scale: [REQUESTS PER DAY]
Consumers: [INTERNAL/PUBLIC/PARTNER]

Design a complete API:

**1. Resource Design**
- For each resource:
  - Endpoint paths (RESTful naming conventions)
  - HTTP methods (GET, POST, PUT, PATCH, DELETE)
  - Request body schemas (with field types, required/optional, validation rules)
  - Response schemas (success and error)
  - Query parameters (filtering, sorting, pagination)
  - Example requests and responses

**2. Authentication & Authorization**
- Auth flow design
- Token format and expiration
- Permission/role model
- Rate limiting strategy (tiers, headers)
- API key management

**3. Error Handling**
- Standard error response format
- Error code catalog (with HTTP status codes)
- Validation error format
- Error messages (developer-friendly)

**4. Pagination & Filtering**
- Pagination strategy (cursor vs offset)
- Filtering syntax
- Sorting parameters
- Field selection / sparse fieldsets

**5. Versioning Strategy**
- URL vs header versioning (recommendation)
- Deprecation policy
- Migration guides approach

**6. OpenAPI Specification**
- Generate the OpenAPI 3.0 YAML for the core endpoints
- Include schemas, examples, and descriptions

**7. Developer Experience**
- Getting started guide outline
- SDK recommendations
- Webhook design (if applicable)
- Sandbox/testing environment approach

Write production-quality schemas. No placeholders.

Why "API Design & Documentation Generator" Works

"API Design & Documentation Generator" succeeds because it mirrors how AI models are trained to respond - with clear instructions, specific constraints, and defined success criteria. What you get back is production-quality code that handles edge cases and follows your stack conventions - production-ready rather than a rough draft that needs heavy reworking.

These coding tips will help you get stronger results when using "API Design & Documentation Generator" and similar prompts in this category.

When to Use "API Design & Documentation Generator"

"API Design & Documentation Generator" is particularly useful in these situations. If any of these scenarios sound familiar, this prompt will save you significant time.

What You Will Get from "API Design & Documentation Generator"

When you use "API Design & Documentation Generator" with ChatGPT, Claude, or Gemini, here is what to expect in the AI output.

How to Customize "API Design & Documentation Generator"

Adapt "API Design & Documentation Generator" to your specific situation by modifying these key areas. The more context you add, the better the results.