Docs
Schedule demo Open app

Retrieve AI request

GET https://app.eraser.io/api/ai-requests/{requestId}

This endpoint retrieves the details and results of a previously executed AI request, such as a diagram generation or diagram edit, using its unique request ID.

An example cURL request is:

curl --location 'https://app.eraser.io/api/ai-requests/$REQUEST-ID' \
  --header 'Authorization: Bearer $YOUR-TOKEN-HERE'

requestId is the unique identifier of the AI request. This value is returned when you create an AI request using the diagram generation or edit endpoints.

Note that you do not need to explicitly specify a team in the request, since your API token is scoped to a specific team.

An example response is:

{
  "id": "abc123def456",
  "inputs": [
    {
      "type": "text",
      "text": "Create a sequence diagram for a user authentication flow with 2FA"
    }
  ],
  "outputs": [
    {
      "type": "diagram",
      "diagramType": "sequence-diagram",
      "diagramTitle": "User Authentication with 2FA",
      "code": "User -> Login Page: Navigate\nLogin Page -> Auth Server: Submit credentials\nAuth Server -> User: Request 2FA code\nUser -> Auth Server: Submit 2FA\nAuth Server -> User: Return JWT token",
      "imageUrl": "https://IMAGE-URL"
    }
  ]
}

The response includes the original inputs provided to the AI request, along with any generated outputs such as diagram code, metadata, and rendered image URLs.

Path parameters

requestId string requiredpath

ID of the AI request to retrieve. You can find this in the response of the /api/redner/prompts endpoint.

Query parameters

returnFile string query

When true, returns the PNG image file directly instead of JSON response

  • true
  • false

Responses

200 – The AI request details or PNG image file

id string

ID of the AI request

inputs object[]

Array of inputs used for the AI request

outputs object[] 5 fields

Array of generated diagram outputs

type string
  • diagram
diagramType string

Type of the generated diagram

  • sequence-diagram
  • entity-relationship-diagram
  • cloud-architecture-diagram
  • flowchart-diagram
  • bpmn-diagram
code string

The generated Eraser DSL code for the diagram

diagramTitle string

Title of the generated diagram

imageUrl string

URL of the generated diagram as a PNG image

mode string

AI mode used for generation

  • standard
  • premium
200 response
{
  "id": "string",
  "inputs": [
    null
  ],
  "outputs": [
    {
      "type": "diagram",
      "diagramType": "sequence-diagram",
      "code": "string",
      "diagramTitle": "string",
      "imageUrl": "string"
    }
  ],
  "mode": "standard"
}

400 – The request is missing required parameters

403 – Insufficient permissions to access this AI request

404 – AI request not found or PNG file not available

500 – Server error