This guide walks through creating, publishing and managing your first document in LegalCloud. By the end you'll understand versioning, languages and the public address of a document.
What is a "document"?
A document is the atom of LegalCloud. It's a piece of legal text with:
- A title (internal name).
- A type:
privacy,cookies,legal,terms,conditionsorother. - A language (a code such as
en,es,fr,de,it). - A body (HTML or plain text).
- A set of sites it is published on.
- Access rules: visible or hidden, token required, allowed countries.
- Optional styling: colors of titles, body text and links, and whether it inherits the style of your site.
- A version history: when the content changes, the previous version is stored (on plans that include versioning).
Creating a document
In the dashboard, go to Documents and click New document. Fill in the title, type, language and body, choose at least one site and save.
You can also create documents through the API:
curl -X POST https://api.legalcloud.info/api/documents \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Privacy policy",
"type": "privacy",
"language": "en",
"content": "<h1>Privacy policy</h1><p>...</p>",
"site_ids": [1]
}'
The token needs the documents:write scope. Creating documents is subject to the limits of your plan (documents and languages).
Publishing
Documents are published on the sites you selected. You can unpublish and publish them again from the document detail or through the API:
curl -X POST https://api.legalcloud.info/api/documents/{id}/publish \
-H "Authorization: Bearer YOUR_TOKEN"
POST /api/documents/{id}/unpublish hides it again.
The identifiers of a document
A document has two identifiers, and it is important not to mix them up:
id— the identifier used by the REST API (/api/documents/{id}).public_url— the public path of the document, for example/d/abc123. The part after/d/is the hash you use to embed it:
https://dash.legalcloud.info/d/{hash}
Both values are returned when you read the document (GET /api/documents/{id} returns public_url). The public address stays the same when you edit the document: visitors always receive the current published version.
Versioning
When you change the content of a document (on plans that include versioning) LegalCloud keeps the previous version. In the document detail you can see the history, compare versions and restore an old one. Through the API:
# List versions
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.legalcloud.info/api/documents/{id}/versions
# Get one version
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.legalcloud.info/api/documents/{id}/versions/2
# Compare two versions
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.legalcloud.info/api/documents/{id}/versions/diff?from=1&to=2"
# Restore a version (rollback)
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
https://api.legalcloud.info/api/documents/{id}/versions/2/restore
Multi-language
Each document has one language. To offer the same text in several languages, create one document per language (you can clone a document and translate the copy) and embed the one that matches the visitor's language. The languages available to your organization are listed by GET /api/documents/languages.
Assigning to sites
A document must be assigned to at least one site. In the document detail, the Sites section lets you select one or more. When a document is assigned to specific sites, the integration that embeds it must belong to one of them.
Access rules
- Allowed countries — only visitors from the listed countries (ISO codes) can read the document.
- Token required — the public address only opens with an access token (a document token, see API tokens).
Deleting a document
Deleting a document is irreversible: its public address stops working. For legal documents we recommend unpublishing instead, so you keep the history.