Skip to main content

api-designer

Design REST API specifications.

Basic Info

PropertyValue
Version1.0.0
CategoryDesign Specs
FormatNew Format

Features

  • Generate RESTful endpoint designs
  • Define request/response schemas
  • Specify authentication requirements
  • Include error handling patterns

Usage

npx cogn@2.2.12 run api-designer --args "user management system with registration, login, profile CRUD" --pretty

Output Example

{
"api_name": "User Management API",
"base_path": "/api/v1",
"endpoints": [
{
"method": "POST",
"path": "/auth/register",
"description": "Register new user",
"request": {
"body": {
"email": "string (required)",
"password": "string (required, min 8 chars)",
"name": "string (optional)"
}
},
"response": {
"201": { "user_id": "string", "email": "string" },
"400": { "error": "VALIDATION_ERROR", "message": "string" },
"409": { "error": "EMAIL_EXISTS", "message": "string" }
},
"auth": "none"
},
{
"method": "POST",
"path": "/auth/login",
"description": "User login",
"request": {
"body": {
"email": "string",
"password": "string"
}
},
"response": {
"200": { "access_token": "string", "refresh_token": "string" },
"401": { "error": "INVALID_CREDENTIALS" }
},
"auth": "none"
},
{
"method": "GET",
"path": "/users/me",
"description": "Get current user profile",
"response": {
"200": { "id": "string", "email": "string", "name": "string" }
},
"auth": "bearer"
}
],
"authentication": {
"type": "JWT Bearer",
"header": "Authorization: Bearer <token>"
},
"rationale": "Designed RESTful endpoints following best practices...",
"confidence": 0.92
}

Output Fields

FieldTypeDescription
api_namestringAPI name
base_pathstringBase URL path
endpointsarrayEndpoint definitions
endpoints[].methodstringHTTP method
endpoints[].pathstringEndpoint path
endpoints[].descriptionstringEndpoint description
endpoints[].requestobjectRequest schema
endpoints[].responseobjectResponse schemas by status code
endpoints[].authstringAuth requirement
authenticationobjectAuth configuration
rationalestringDesign reasoning
confidencenumberConfidence 0-1