This document provides a comprehensive reference for the Blueprinta API.
The Blueprinta API provides programmatic access to the multi-agent orchestration platform. All endpoints are RESTful and return JSON responses.
- Create and manage diagrams
- Run generation jobs
- Refine artifacts
- Query progress
- Export results
The app is guest-only; there is no login or API keys. Diagram endpoints identify the session via:
- Header:
x-guest-session-id(set by the frontend; usefetchDiagramApiorapiClientso it is sent automatically). - Cookie:
guest_session_id(set by the API on responses so same-origin requests carry it).
All diagram and generation endpoints use this guest session. Use the same client (or cookie) so all requests are tied to one session.
Development: http://localhost:3000/api
Production: set NEXT_PUBLIC_API_URL in your deployment (e.g. https://your-app.com/api)
POST /api/diagrams/generateEnqueues the Blueprinta orchestration and creates a diagram. Use guest session (cookie or x-guest-session-id); no login or API key required for the app.
Request Body:
{
prompt: string; // Natural language description (min 20 chars)
options?: {
includeStateManagement?: boolean;
includeAPIs?: boolean;
includeDatabase?: boolean;
model?: string; // e.g. "gemini-3-flash-preview", "gemini-3-pro-preview"
reasoning?: boolean; // Extended reasoning (slower)
};
documents?: Array<{ name?: string; content?: string }>; // Optional attached context
clarificationAnswers?: Record<string, string>; // From guided-mode questions
}Response:
{
jobId: string;
diagramId: string;
streamUrl: string; // e.g. "/api/diagrams/generate/stream?jobId=..."
}Use the streamUrl to subscribe to progress updates.
Example:
# 1) Enqueue generation
curl -X POST "http://localhost:3000/api/diagrams/generate" \
-H "Content-Type: application/json" \
-d '{"prompt": "Build a modern e-commerce platform with auth, product catalog, and checkout"}'
# 2) Stream events (SSE)
curl -N "http://localhost:3000/api/diagrams/generate/stream?jobId=<jobId>"POST /api/diagramsCreates a new diagram record (metadata only). Orchestration is started via POST /api/diagrams/generate; this endpoint is used internally or for listing/CRUD.
Request Body (if used): typically minimal; see implementation.
GET /api/diagrams/:idRetrieves a diagram by ID (scoped to the current guest session).
Response:
{
id: string;
userId: string;
title: string;
description: string;
status: "pending" | "processing" | "completed" | "failed";
metadata?: {
prompt?: string;
options?: object;
metasop_artifacts?: Record<string, MetaSOPArtifact>; // pm_spec, arch_design, etc.
metasop_steps?: any;
};
createdAt: string;
updatedAt: string;
}GET /api/diagramsLists diagrams for the current guest session (cookie or x-guest-session-id).
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number | 1 | Page number |
limit |
number | 20 | Items per page |
status |
string | - | Filter by status |
Response:
{
diagrams: Array<{
id: string;
title: string;
description: string;
status: string;
createdAt: string;
}>;
total: number;
page: number;
limit: number;
}PUT /api/diagrams/:idUpdates diagram metadata.
Request Body:
{
title?: string;
description?: string;
}DELETE /api/diagrams/:idDeletes a diagram.
POST /api/diagrams/:id/duplicateCreates a copy of an existing diagram.
Response:
{
id: string;
title: string;
description: string;
status: "pending";
createdAt: string;
}GET /api/diagrams/:id/exportExports diagram in specified format.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
artifact |
string | No | Export artifact type (default: documentation). |
format |
string | No | Format varies by artifact (default: markdown). |
Artifacts & formats:
documentation:markdown,pdf,html,pptxopenapi:jsonsql:migration,seedestimates:jsondeployment:markdownadr:markdownerd:mermaid,plantuml,markdowntech-comparison:markdowntest-plan:markdownsecurity-audit:markdownmermaid:flowchart,sequence
Response: File download
GET /api/diagrams/generate/stream?jobId=:jobIdStreams progress updates for a queued generation job. Each SSE event is a JSON payload with a type field.
Note: Jobs are in-process. A server restart will drop in-flight jobs.
Event types:
step_start, step_thought, step_complete, step_failed, orchestration_complete, orchestration_failed, agent_progress.
Refinement is done by editing artifact JSON via predefined tools. There is no instruction-based or agent re-run refinement.
POST /api/diagrams/artifacts/editApplies predefined edit operations to artifact JSON without re-running agents. Treats artifacts as documents; all changes go through validated tools (set_at_path, delete_at_path, add_array_item, remove_array_item). Deterministic and performant.
Request Body:
{
diagramId?: string;
previousArtifacts: Record<string, { content: object; step_id?: string; role?: string; timestamp?: string }>;
edits: Array<
| { tool: "set_at_path"; artifactId: string; path: string; value: any }
| { tool: "delete_at_path"; artifactId: string; path: string }
| { tool: "add_array_item"; artifactId: string; path: string; value: any }
| { tool: "remove_array_item"; artifactId: string; path: string; index?: number }
>;
}- artifactId: One of
pm_spec,arch_design,security_architecture,devops_infrastructure,ui_design,engineer_impl,qa_verification. - path: Dot-separated path, e.g.
apis.0.pathoruser_stories[1].title.
Response:
{
success: boolean;
artifacts: Record<string, ArtifactRecord>;
applied: number;
errors?: Array<{ op: EditOp; error: string }>;
}POST /api/diagrams/artifacts/refine
POST /api/diagrams/artifacts/refine?stream=trueUses intent analysis to generate edit operations, then applies them atomically.
Request Body:
{
diagramId?: string;
intent: string;
previousArtifacts: Record<string, { content: object; step_id?: string; role?: string; timestamp?: string }>;
chatHistory?: string;
activeTab?: string;
}Streaming: newline-delimited JSON events with types: analyzing, plan_ready, applying, artifact_updated, complete, error.
POST /api/diagrams/askAsks a question about a diagram.
Request Body:
{
diagramId: string;
question: string;
}Response:
{
answer: string;
relevantArtifacts: string[];
confidence: number;
}GET /api/healthChecks API health status.
Response:
{
status: "healthy" | "degraded" | "unhealthy";
version: string;
timestamp: string;
services: {
database: "healthy" | "unhealthy";
llm: "healthy" | "unhealthy";
cache: "healthy" | "unhealthy";
};
}interface MetaSOPArtifact {
step_id: string;
role: string;
content: BackendArtifactData;
timestamp: string;
}interface MetaSOPEvent {
type: "step_start" | "step_thought" | "step_partial_artifact" |
"step_complete" | "step_failed" | "orchestration_complete" |
"orchestration_failed" | "agent_progress";
step_id?: string;
role?: string;
artifact?: MetaSOPArtifact;
thought?: string;
partial_content?: any;
error?: string;
status?: string;
message?: string;
diagram?: {
id: string;
title?: string;
description?: string;
metadata?: any;
};
timestamp: string;
}type BackendArtifactData =
| ArchitectBackendArtifact
| ProductManagerBackendArtifact
| EngineerBackendArtifact
| QABackendArtifact
| DevOpsBackendArtifact
| SecurityBackendArtifact
| UIDesignerBackendArtifact;All errors follow a consistent format:
{
error: {
code: string;
message: string;
details?: any;
}
}| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid or missing guest session |
FORBIDDEN |
403 | Guest limit exceeded or insufficient permissions |
NOT_FOUND |
404 | Resource not found |
VALIDATION_ERROR |
400 | Invalid request data |
RATE_LIMIT_EXCEEDED |
429 | Too many requests |
INTERNAL_ERROR |
500 | Server error |
SERVICE_UNAVAILABLE |
503 | Service temporarily unavailable |
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid user request",
"details": {
"field": "userRequest",
"issue": "Must be at least 10 characters"
}
}
}API requests are rate limited to prevent abuse.
| Plan | Requests per Minute | Requests per Hour |
|---|---|---|
| Free | 10 | 100 |
| Pro | 100 | 1000 |
| Enterprise | Unlimited | Unlimited |
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200When rate limited, the API returns:
HTTP/1.1 429 Too Many Requests
Retry-After: 60Implement exponential backoff:
async function makeRequest(url: string, retries = 3) {
try {
const response = await fetch(url);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
await sleep(parseInt(retryAfter) * 1000);
return makeRequest(url, retries - 1);
}
return response.json();
} catch (error) {
if (retries > 0) {
await sleep(1000 * (4 - retries));
return makeRequest(url, retries - 1);
}
throw error;
}
}Last Updated: January 2025