codingadvanced

REST API Designer

Designs RESTful API endpoints with request/response schemas, status codes, and error handling.

Prompt

Design a RESTful API for the following resource or feature:

**Resource/Feature**: {{feature}}
**Context**: {{context}}

For each endpoint provide:
1. **Method + Path** (following REST conventions)
2. **Request** -- headers, path params, query params, body schema (with types and validation rules)
3. **Response** -- status codes (success + error cases), response body schema
4. **Error responses** -- 400/401/403/404/409/422/429/500 with error body format
5. **Pagination** -- if returning lists, include cursor or offset pagination
6. **Rate limiting** -- suggested limits
7. **Authentication** -- required scopes or permissions

Use consistent naming (camelCase for JSON fields, kebab-case for URLs). Include OpenAPI-compatible type annotations.

Variables

{{feature}}{{context}}

Example Output

### POST /api/v1/users
Request body: { email: string (required), name: string (required, 1-100 chars) }...

Use Cases

  • Greenfield API design
  • API review and standardization
  • OpenAPI spec generation

Compatible Models

claude-sonnet-4-20250514gpt-4ogemini-2.5-pro

Tags

api-designrestopenapibackend

Details

Author
PromptIndex
Updated
2026-04-01
Difficulty
advanced

Related Prompts

  • Code Review Assistant

    Performs a thorough code review covering correctness, performance, security, and maintainability.

  • Bug Finder

    Identifies bugs, edge cases, and potential runtime errors in a code snippet.

  • Test Generator

    Generates comprehensive unit tests for a function or module with edge cases and mocks.