API Reference¶
The PADAI backend exposes a REST API on port 8000 (default). All endpoints require authentication via Bearer token or Basic authentication.
Authentication¶
Include your API token in the Authorization header:
Or use Basic authentication if configured with AUTH_USERNAME / AUTH_PASSWORD_HASH.
Core Endpoints¶
Health Check¶
Returns server status, license validity, and version information. No authentication required.
Response:
Generate Code (Plan)¶
Generate PAD (Robin) code from a natural language prompt.
Request body:
{
"prompt": "Create a flow that copies all .xlsx files from C:\\Import to C:\\Archive",
"context": {
"subflows": ["Main"],
"current_code": ""
}
}
Response:
{
"run_id": "abc123",
"status": "success",
"pad_text": "# Generated Robin code...",
"plan": { ... },
"lint_issues": [],
"stats": {
"total_steps": 5,
"actions_used": ["Folder.GetFiles", "File.Copy"]
}
}
Patch Code¶
Apply targeted modifications to existing PAD code. Supports both LLM-driven and deterministic patching.
Request body:
{
"prompt": "Add error handling around the file copy step",
"current_code": "# Existing Robin code...",
"patch_mode": "llm"
}
Fix Warnings¶
Automatically fix warnings in PAD code (placeholders, invalid paths, missing function ends).
Request body:
{
"code": "# Robin code with warnings...",
"warnings": [
{"code": "placeholder_detected", "line": 5}
]
}
Generate Flowchart¶
Generate a Mermaid diagram from PAD code.
Request body:
Analysis Endpoints¶
Analyze Quality¶
Analyze code quality and return a score with metrics.
Analyze Variables¶
Inspect and analyze variables in PAD code.
Suggest Refactoring¶
Get refactoring suggestions for PAD code.
Compare Flows¶
Diff and compare two versions of a PAD flow.
Run Management¶
Recent Runs¶
List recent code generation runs with status and metadata.
Get Run¶
Get details of a specific run.
Get Run PAD Code¶
Get the generated PAD code for a specific run.
Run Status¶
Check the status of a running generation.
License Management¶
License Status¶
Returns current license status, quotas, features, and expiration date.
Response:
{
"valid": true,
"plan": "pro_team",
"max_users": 5,
"max_runs_per_month": 5000,
"current_runs": 142,
"expires": "2027-04-12",
"features": ["workbench", "fleet", "audit"]
}
Error Handling Endpoints¶
Analyze Error Handling¶
Identify unprotected actions in PAD code.
Generate Error Handlers¶
Automatically generate error handling blocks for PAD code.
Documentation Generation¶
Generate Docs¶
Generate technical documentation for a PAD flow.
Snippet Library¶
List Snippets¶
List all available code snippets.
Get Snippet Categories¶
List snippet categories.
Render Snippet¶
Render a snippet with custom parameters.
HTTP Status Codes¶
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Invalid request (check your parameters) |
| 401 | Authentication failed (check your API token) |
| 402 | License expired or run quota exceeded |
| 429 | Rate limit exceeded (wait and retry) |
| 500 | Internal server error |
Rate Limiting¶
When rate limiting is enabled (RATE_LIMIT_ENABLED=true), the server enforces a maximum number of requests per minute (RATE_LIMIT_PER_MIN, default 120). Exceeding this limit returns HTTP 429.
Version¶
Returns the current server version and build information.