v1

latestOpenAPI 3.1.02026-07-2418848.0 KB

Prompt → Diagram (AI)

post/api/render/prompt

Request body

textstring required

The prompt. The input code or natural language which describes a diagram.

diagramType'sequence-diagram' | 'entity-relationship-diagram' | 'cloud-architecture-diagram' | 'flowchart-diagram' | 'bpmn-diagram' | 'freeform-diagram'

Select desired diagram type. Will automatically detect diagram type when unspecified. Note: "freeform-diagram" is element-based — it cannot be edited via inlineCodeEdit (use priorRequestId instead), and its responses do not include a "code" field.

mode'standard' | 'premium'

Model tier. "premium" (default) uses a higher-quality model; "standard" uses a faster, lower-cost model. Defaults to "premium".

priorRequestIdstring

ID of a previous request to edit. When provided, the API will edit the diagram from that request.

contextIdstring

ID of an AI preset to use as context for generation. Find contextId in the AI preset page (https://app.eraser.io/dashboard/ai-preset).

templateIdstring

ID (workspaceId) of a template within a preset. Both contextId and templateId are required to use a template. Find ID by navigating to AI preset (https://app.eraser.io/dashboard/ai-preset) > Templates > Open a template

returnImageAsFileboolean

When true, returns the image as a file stream instead of a URL.

returnFileboolean

Deprecated. Use returnImageAsFile instead.

backgroundboolean

Select transparent (false) or solid (true) background. Defaults to false.

theme'light' | 'dark'

Select "light" or "dark" theme. Defaults to "light".

imageQuality1 | 2 | 3

Image quality/resolution multiplier. Use 1 (low), 2 (medium), or 3 (high). Defaults to 2.

scale1 | 2 | 3

Deprecated. Use imageQuality instead.

Response

The result of the diagram generation

requestIdstring

ID of the diagram generation request

imageUrlstring

URL of the generated diagram as a PNG image

createEraserFileUrlstring

URL to create an Eraser file to edit the generated diagram. Not returned when fileOptions.create is true.

fileUrlstring

URL to the created Eraser file. Only returned when fileOptions.create is true.

relevantFilePathsstring[]

File paths from the Git repository context used to generate the diagram. Only returned when gitContexts is provided. Format: orgName/repoName:filePath

All 18 operations