Reference Library
A reference library is a collection of reference diagrams that can be used by Eraser AI. They can be modular patterns meant to be used as re-usable building blocks in a larger diagram or fully fledged example diagrams meant to be a base template.
Navigate to the AI reference page to create and manage reference libraries and diagrams.

Creating a reference library
- Open to the AI reference page
- Click on the library selection dropdown
- Click on "New library"
- Fill out a "Name" for the library and a "Description" in a few words

Creating a reference diagram
If you have not done so already, first create the diagram that you would like to set as a reference diagram. You can do so using Eraser's AI features (text-to-diagram, image-to-diagram), or manually writing the diagram-as-code syntax. You will want to access this diagram for the final step of the below:
- Open the AI reference page and select the library that you'd like to add a reference diagram into
- Note that you cannot add reference diagrams to pre-built libraries (AWS, Azure, GCP)
- Click on the "New Reference" button
- Enter a name for the reference
- Select a diagram type
- Enter a reference diagram description. Describing what the diagram is, when it is relevant, and how to use it will help Eraser AI best utilize the reference diagram
- On the right half (canvas) of the page, click on one of the diagram creation options
- In the diagram code editor, paste the diagram code of the diagram that you would like to set as a reference

Using the reference library in the app
Once you have a reference library and some reference diagrams inside of it, you can use the library when you are generating AI diagrams.
- In an Eraser file, create a blank AI diagram
- In the sidebar, click on "Add source"
- Select "Reference Library"
- Select the library you want to use
- Enter a prompt, directly referencing the library name and the reference diagram name as necessary.
- Example #1. Create a mobile application architecture diagram utilizing the Payment Processing Module and Authentication Module from the ACME Corp Architecture Library
- Example #2. Using the User Flow Template in the ACME Corp Diagram Library as a base, create a user flow diagram that shows the new user sign up process.

Using the reference library in the API
In the /api/render/prompt
endpoint (docs), you can specify a contextId
to use a reference library in a diagram generation API call.
The contextId
can be obtained using the below steps:
- Open the AI references page
- Select the library you want to use in your API call in the library selection dropdown
- The URL in the browser URL bar will contain a
contextId
- Copy the
contextId
and provide it in the/api/render/prompt
API call
Updated about 15 hours ago