api-designer prompt

Version 1.0.0 — registry.pascalai.org

Design a RESTful API with endpoints, request/response schemas, error codes and OpenAPI spec.

Variables

Variable Description
{{resource_name}} Name of the resource or system to design API for
{{auth_method}} Authentication: JWT Bearer, API Key, OAuth2, Basic Auth, none
{{versioning_strategy}} URL versioning (/v1/), header versioning, query param
{{output_format}} Spec format: OpenAPI 3.0 YAML, Markdown table, JSON Schema

Prompt Template

You are a senior API architect with expertise in RESTful design, OpenAPI specifications, and API security best practices. Design a complete RESTful API for: {{resource_name}} Authentication method: {{auth_method}} Versioning strategy: {{versioning_strategy}} Output format: {{output_format}} Produce a thorough API design document covering: 1. **Resource Modeling** — Entities, relationships, and data schemas with field types and constraints 2. **Endpoint Inventory** — Full CRUD + custom actions; HTTP method, path, summary, and status codes for each 3. **Authentication & Authorization** {{auth_method}} flow, token lifecycle, scopes, and role-based access rules 4. **Error Handling (RFC 7807)** — Problem Detail objects for 4xx/5xx responses; consistent error catalog 5. **Pagination, Filtering, Sorting** — Cursor or offset pagination; filterable fields; sort parameters and defaults 6. **Full Spec** — Complete {{output_format}} output ready to import into tooling (Swagger UI, Postman, etc.) ...

Install

ppm install api-designer

API Usage

# Raw prompt text
GET https://registry.pascalai.org/v1/packages/api-designer/1.0.0/raw

# Rendered with variables
GET https://registry.pascalai.org/v1/packages/api-designer/1.0.0/render?resource_name=User+Management&auth_method=JWT+Bearer&versioning_strategy=URL+%28%2Fv1%2F%29&output_format=OpenAPI+3.0+YAML

PascalAI Usage

uses promptlib;

var
  Prompt   := Get('api-designer');
  Rendered := Bind(Prompt, [
    'resource_name',       'User Management',
    'auth_method',         'JWT Bearer tokens',
    'versioning_strategy', 'URL versioning (/v1/)',
    'output_format',       'OpenAPI 3.0 YAML'
  ]);
  Spec := LLM.Complete(Rendered);

Output Sections

What the prompt produces

The rendered prompt instructs the model to return a complete API design document with the following sections:

  1. Resource Modeling
  2. Endpoint Inventory
  3. Authentication & Authorization
  4. Error Handling (RFC 7807)
  5. Pagination, Filtering, Sorting
  6. Full OpenAPI / Markdown spec