post https://app.eraser.io/api/render/prompt
This endpoint generates a new AI diagram or edits an existing one from user-provided input, with support for file attachments and additional context.
An example cURL request for generating a new diagram:
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": "Azure Front Door routes to a web UI (App Service/Static Web Apps); requests go through API Management to Cognitive Search (indexing Blob Storage/DevOps Repos) and Azure OpenAI for answers; Functions handle transforms, Redis caches; responses return via API Management; monitored with Azure Monitor + Application Insights."
}'
An example cURL request for editing an existing diagram:
curl --location 'https://app.eraser.io/api/render/prompt' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"priorRequestId": "6ZoBxeDf94ix9IB7Fx8G",
"text": "Add a CDN layer in front of the Azure Front Door"
}'
An example cURL request with a file attachment:
curl --location 'https://app.eraser.io/api/render/prompt' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"text": "Generate a diagram based on this screenshot",
"attachments": [
{
"filename": "screenshot.png",
"mimeType": "image/png",
"content": "$BASE64-ENCODED-CONTENT-HERE"
}
],
}'
Here's an example cURL request using a git repository:
curl --location 'https://app.eraser.io/api/render/prompt' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"text": "Generate an architecture diagram based on Terraform files in /wordpress-fargate/.",
"diagramType": "cloud-architecture-diagram",
"mode": "standard",
"git": {
"orgName": "acme-corp",
"repoName": "terraform-iac"
}
}'
An example cURL request using a reference library (contextId
can be found on the AI references page; docs):
curl --location 'https://app.eraser.io/api/render/prompt' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"text": "Create a mobile application architecture diagram utilizing the Payment Processing Module and Authentication Module from the ACME Corp Architecture Library.",
"diagramType": "cloud-architecture-diagram",
"mode": "standard",
"contextId": "$CONTEXT-ID"
}'
An example response is:
{
"requestId": "generated-request-id",
"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: