API Reference

From Prompt (AI diagram)

This endpoint generates an AI diagram from a user-provided input.

An example cURL request is:

curl --location 'https://app.eraser.io/api/render/prompt' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
    "theme": "dark",
    "mode": "standard",
    "diagramType": "cloud-architecture-diagram",
    "text": "An Azure-based RAG application for querying a company’s codebase. Azure Front Door manages global request routing, directing users to a web interface hosted on Azure App Service or Static Web Apps. When a user asks a question, it’s routed through Azure API Management. Azure Cognitive Search indexes the codebase stored in Azure Blob Storage or Azure DevOps Repos to retrieve relevant snippets. These results are then passed to Azure OpenAI Service to generate context-rich responses. Azure Functions handle data transformations, while Azure Cache for Redis speeds up response times by caching frequent queries. The response flows back through API Management to the web interface, with monitoring managed by Azure Monitor and Application Insights."
}'

An example response is:

{
    "imageUrl": "https://IMAGE-SITE-URL/IMAGE-NAME.png",
    "createEraserFileUrl": "https://ERASER-URL-TO-OPEN-DIAGRAM-IN-EDITOR",
    "diagrams": [
        {
            "diagramType": "cloud-architecture-diagram",
            "code": "// EXAMPLE DIAGRAM \n A > B \n B > C"
        }
    ]
}

Full documentation of the endpoint below:

Language
Credentials
Bearer
Click Try It! to start a request and see the response here!