Diagrams
The Diagrams API lets you retrieve architecture diagrams generated from your infrastructure scans. Diagrams are returned as Mermaid code that can be rendered in your own applications or documentation.
GET
/api/diagramsreadList all diagrams
GET
/api/diagrams/{id}readGet a specific diagram with Mermaid code
List Diagrams
GET
/api/diagramsreadReturns a paginated list of all diagrams generated for your organization.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
accountId | string | Filter by Fegura account connection ID |
diagramType | string | Filter by diagram type (architecture, network, dataflow, boundary, organization) |
limit | integer | Number of diagrams to return per page (1-100)Default: 20 |
cursor | string | Pagination cursor from previous response |
Example Request
curl "https://api.fegura.ai/api/diagrams?diagramType=network&limit=10" \
-H "Authorization: Bearer feg_live_your_api_key" \
-H "Fegura-Version: 2026-02-01"Response
{
"success": true,
"data": {
"diagrams": [
{
"id": "770e8400-e29b-41d4-a716-446655440000",
"scanJobId": "660e8400-e29b-41d4-a716-446655440000",
"awsAccountId": "550e8400-e29b-41d4-a716-446655440000",
"diagramType": "network",
"title": "VPC Network Architecture",
"status": "completed",
"errorMessage": null,
"createdAt": "2026-01-20T14:32:00.000Z",
"updatedAt": "2026-01-20T14:32:15.000Z"
}
],
"meta": {
"hasMore": false
}
}
}Response Fields
| Parameter | Type | Description |
|---|---|---|
id | string | Unique diagram identifier (UUID) |
scanJobId | string | ID of the scan that generated this diagram |
awsAccountId | string | Fegura account connection ID |
diagramType | string | Diagram type (see table below) |
title | string | Human-readable diagram title |
status | string | Generation status: "pending", "generating", "completed", "failed" |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |
Get Diagram
GET
/api/diagrams/{id}readRetrieves a specific diagram including the Mermaid code and metadata.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
idrequired | string | The diagram ID (UUID) |
Example Request
curl "https://api.fegura.ai/api/diagrams/770e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer feg_live_your_api_key" \
-H "Fegura-Version: 2026-02-01"Response
{
"success": true,
"data": {
"id": "770e8400-e29b-41d4-a716-446655440000",
"scanJobId": "660e8400-e29b-41d4-a716-446655440000",
"awsAccountId": "550e8400-e29b-41d4-a716-446655440000",
"diagramType": "network",
"title": "VPC Network Architecture",
"status": "completed",
"mermaidCode": "graph TB\n subgraph VPC[vpc-123abc]\n subgraph PublicSubnet[Public Subnet]\n ALB[Application Load Balancer]\n end\n subgraph PrivateSubnet[Private Subnet]\n ECS[ECS Service]\n RDS[(RDS PostgreSQL)]\n end\n end\n Internet --> ALB\n ALB --> ECS\n ECS --> RDS",
"metadata": {
"modelUsed": "claude-sonnet-4-20250514",
"tokensUsed": 3420,
"generationTimeMs": 8500
},
"errorMessage": null,
"createdAt": "2026-01-20T14:32:00.000Z",
"updatedAt": "2026-01-20T14:32:15.000Z"
}
}Additional Response Fields
| Parameter | Type | Description |
|---|---|---|
mermaidCode | string | Mermaid diagram code ready for rendering |
metadata | object | Additional context about the diagram |
metadata.modelUsed | string | AI model used to generate the diagram |
metadata.tokensUsed | integer | undefined | Number of tokens consumed during generation |
metadata.generationTimeMs | integer | undefined | Time taken to generate the diagram in milliseconds |
Diagram Types
| Type | Description |
|---|---|
architecture | High-level architecture with all resource types |
network | VPCs, subnets, security groups, and connectivity |
dataflow | Data movement between services and resources |
boundary | Security boundaries and trust zones |
organization | Organizational grouping of resources by service or team |
Rendering Mermaid Diagrams
The mermaidCode field contains Mermaid syntax that can be rendered using the official Mermaid library or various third-party tools.
Client-Side Rendering
import mermaid from 'mermaid';
// Initialize Mermaid
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
// Render the diagram
const element = document.getElementById('diagram');
const { svg } = await mermaid.render('diagram-svg', diagramData.mermaidCode);
element.innerHTML = svg;Server-Side Rendering
For server-side rendering, you can use @mermaid-js/mermaid-cli to generate static images:
# Install the CLI
npm install -g @mermaid-js/mermaid-cli
# Generate PNG from Mermaid code
mmdc -i diagram.mmd -o diagram.png -t dark