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. Take the schema as text — a
pg_dump --schema-onlydump, amysqldump --no-dataoutput, or anyCREATE TABLEstatements. - 2. Compress it with gzip (RFC 1952).
- 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
- v1 is permanent. Links already published — in chats, READMEs, answers — will open forever. New capabilities get a new version prefix; v1 never changes meaning.
- Mark machine-built links with
&src=ai. If you are an AI agent constructing a link in an answer, append it (as in the samples above). It changes nothing for the reader; it lets us count agent-built links separately. - Size. Keep links under ~32,000 characters — longer URLs get truncated by real-world carriers. Gzip typically fits a few hundred tables. Past that, the reader drops the file onto the paste panel in the tool and gets the same diagram.
- Any input ErdDocs reads. The parameter is named
sql=because SQL is the common case, but the same envelope carries any schema text ErdDocs accepts — SQL, Prisma, DBML, Mermaid, PlantUML, Django, SQLAlchemy, Sequelize, TypeORM and Laravel — detected automatically, so an agent never has to say which one it is building a link from. A broken or truncated payload degrades to an explanatory message, never an error page. - Other fragment parameters may appear — ignore unknown ones. For example, links copied from the tool may carry
&layout=(the manual table arrangement, same v1 gzip+base64url envelope over JSON). Agents building links only need#sql=; a link with extra parameters you do not understand is still a valid link.
Machine-readable summary of the whole site: /llms.txt