ErdDocs / docs
Agent Link API
An Agent Link opens erddocs.com with a database schema already loaded, as an interactive ER diagram plus a data dictionary. They are built from raw schema text carried in the URL fragment: a SQL dump, a Prisma schema, DBML, or ORM models and migrations. 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 and answers keep working. We never break or reinterpret them. New capabilities get a new version prefix.
- 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, and it lets us count agent-built links separately. - Size. Keep links under ~32,000 characters. Longer URLs get truncated by real-world carriers. With gzip that is a schema of a few dozen tables: Northwind’s 13 take 1,400 characters, a 68-table schema with comments on every column takes 38,000. 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. The same envelope carries any schema text ErdDocs accepts: SQL, Prisma, DBML, Mermaid, PlantUML, Django, SQLAlchemy, Sequelize, TypeORM and Laravel. The format is 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