Blog

Share a diagram without losing control: protected links

How to share a DiagramaHub diagram with people who have no account: public or code-protected links, expiration, revocation, and exactly what the visitor sees.

You've finished the architecture diagram, and now someone who doesn't use DiagramaHub needs to see it: a client, the security team, a candidate in a technical interview. Exporting a PNG works, but it's frozen: fix something tomorrow and you have to send it again. A shared link always shows the current version of the diagram, and you decide who gets in, for how long, and what they can take with them.

Open the diagram in the editor and click Share. Before generating the link you choose:

  1. Access type. Public: anyone with the URL can open it. Code-protected: on top of the URL, visitors need a 4 to 20 character code. Leave the field empty and DiagramaHub generates a random 6-character one.
  2. Expiration. 5, 10 or 30 days, or unlimited. When it expires, the link simply stops working.
  3. Copying the code. Decide whether recipients can see and copy the Mermaid, PlantUML, D2 or DBML source, or only the rendered diagram.

Copy the URL (and the code, if it's protected) and send them through different channels: the link by email and the code by chat, for example. That way, if someone forwards the email, the access doesn't travel with it.

What visitors see

Visitors don't need an account. They land on a read-only view with:

  • The rendered diagram, with its title.
  • Zoom with the mouse wheel or the buttons, and fit to screen for large diagrams.
  • The description panel, if the diagram has a Markdown description, with a copy button.
  • The code view with a copy button, only if you allowed it.
  • The diagram type and your name as the author.

It works the same for all four languages and for the freehand whiteboard: the sketch is shown read-only, with no editing menu. Because the link points to the diagram and not to a copy, every change you save shows up the next time they open it.

sequenceDiagram
    actor V as Visitor
    participant D as DiagramaHub
    V->>D: Opens /shared/token
    D-->>V: Title and "code required"
    V->>D: Sends the code
    alt Correct code
        D-->>V: Diagram
    else Wrong code
        D-->>V: Error and attempts left
    else 5 failures in 15 min
        D-->>V: Blocked for 15 minutes
    end

A few details worth knowing:

  • The URL token is random (cryptographically secure), so nobody can guess it by walking through numbers.
  • The code isn't stored in plain text: it's kept as a bcrypt hash, just like a password. Write it down when you create it.
  • Brute force is capped: 5 failed attempts from the same IP within 15 minutes block that link for that IP for 15 minutes. On top of that, the public endpoints allow 60 requests per minute per IP.
  • Access log with the outcome of every attempt (success, wrong code, blocked, expired). The IP is stored as a SHA-256 hash, not as-is.

Change your mind any time

  • Revoke it. The same Share button shows the active link, when it expires and whether it allows copying the code. As soon as you revoke it, the URL stops responding.
  • One active link per diagram. Generating a new one revokes the previous one. It's the quick way to cut off everyone who had the old URL.
  • Need different terms? Revoke the link and generate a new one with the access, expiration or permission you need. The URL changes, so send it again.

An honest note on "copying the code"

Turning copying off removes the code view and the copy button from the interface, and for the average visitor that's enough. But to draw the diagram, their browser needs the source, so someone technical could still get it. If the content is confidential, protect the link with a code and a short expiration: that's what actually limits who sees it.

Presenting it yourself?

If you're showing it in a meeting, you don't need to share it: use the editor's presentation mode. It puts the diagram in full screen, hides the sidebar and panels, and Esc takes you back.

Try it

Open any diagram on DiagramaHub Cloud, click Share and send the link to someone on your team. If you run your own instance, links use your frontend's URL; the installation guide explains how to configure it. The code is in the repository.