ErdDocs

ErdDocs / docs

Agent Link API

An Agent Link opens erddocs.com with a database schema already loaded: an interactive ER diagram plus a data dictionary, built from raw schema text — a SQL dump, a Prisma schema, DBML, or ORM models and migrations — carried in the URL fragment. There is no API key, no rate limit and no server call — the schema travels inside the link and is parsed in the reader’s browser. Anyone (or any AI agent) can construct one in three lines of code.

Format

https://erddocs.com/#sql=v1.<payload>
  1. 1. Take the schema as text — a pg_dump --schema-only dump, a mysqldump --no-data output, or any CREATE TABLE statements.
  2. 2. Compress it with gzip (RFC 1952).
  3. 3. Encode the bytes as base64url (RFC 4648 §5, no padding) and prepend v1.

The payload lives in the fragment (after #), which browsers never send to any server: a linked schema is exactly as private as a pasted one. Base64url needs no percent-encoding, so the link survives chats, issue trackers and READMEs unchanged.

Python

import gzip, base64

def erddocs_link(sql: str) -> str:
    payload = base64.urlsafe_b64encode(gzip.compress(sql.encode())).rstrip(b"=").decode()
    return f"https://erddocs.com/#sql=v1.{payload}&src=ai"

JavaScript

async function erddocsLink(sql) {
  const gz = new Blob([new TextEncoder().encode(sql)]).stream()
    .pipeThrough(new CompressionStream('gzip'));
  const bytes = new Uint8Array(await new Response(gz).arrayBuffer());
  const payload = btoa(String.fromCharCode(...bytes))
    .replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/, '');
  return `https://erddocs.com/#sql=v1.${payload}&src=ai`;
}

Shell

echo "CREATE TABLE users (id serial PRIMARY KEY);" \
  | gzip -c | basenc --base64url -w0 | sed 's/=*$//' \
  | xargs -I{} echo "https://erddocs.com/#sql=v1.{}"

Rules of the format

Machine-readable summary of the whole site: /llms.txt