API reference

Document endpoints

Esta guía todavía no está traducida a tu idioma: se muestra en inglés.

The document endpoints let you list, create, update, publish and version documents. All of them require a token with the documents:read scope (reading) or documents:write (changes). {id} is the document id returned by the API.

Endpoints

MethodPathScopeDescription
GET/api/documentsreadList documents
POST/api/documentswriteCreate a document
GET/api/documents/languagesreadLanguages available to the organization
GET/api/documents/limitsreadDocument usage and limit of your plan
GET/api/documents/{id}readGet a document
PATCH/api/documents/{id}writeUpdate a document (send only the fields to change)
DELETE/api/documents/{id}writeDelete a document
POST/api/documents/{id}/clonewriteClone a document
POST/api/documents/{id}/publishwritePublish a document
POST/api/documents/{id}/unpublishwriteUnpublish a document
GET/api/documents/{id}/versionsreadList versions
GET/api/documents/{id}/versions/{n}readGet one version
GET/api/documents/{id}/versions/diff?from=&to=readCompare two versions
POST/api/documents/{id}/versions/{n}/restorewriteRestore a version
DELETE/api/documents/{id}/versions/{n}writeDelete a version

The document object

FieldTypeDescription
idstringIdentifier used by the API
titlestringInternal title (max 200 characters)
contentstringHTML body (only in detail responses)
typestringprivacy, cookies, legal, terms, conditions or other
languagestringLanguage code, for example en
site_idsarraySites where it is published
visiblebooleanWhether it is shown
token_requiredbooleanWhether /d/{hash} requires an access token
allowed_countriesarrayISO country codes allowed (empty = all)
inherit_stylesbooleanInherit the style of the embedding site
h1_color, h2_color, body_color, link_colorstringOptional colors
has_tokenbooleanWhether it has a document token
public_urlstringPublic path, for example /d/abc123 (detail only)
created_at, updated_atstringDates

List documents

curl -H "Authorization: Bearer YOUR_TOKEN" \
     "https://api.legalcloud.info/api/documents?page=1&per_page=20&site_id=SITE_ID"
{
  "success": true,
  "data": {
    "documents": [
      { "id": "514789b931ee4cc1", "title": "Privacy policy", "type": "privacy", "language": "en", "visible": true }
    ],
    "total": 1,
    "page": 1,
    "per_page": 20
  }
}

The list omits the content.

Create a document

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]
         }'

site_ids must contain at least one site. Creation is subject to the limits of your plan (documents and languages); when a limit is reached the API answers 403 with PLAN_UPGRADE_REQUIRED, LANGUAGE_LIMIT_REACHED or a similar code.

Get a document

curl -H "Authorization: Bearer YOUR_TOKEN" \
     https://api.legalcloud.info/api/documents/{id}

The detail includes content and public_url. The public address of the document is https://dash.legalcloud.info followed by public_url.

Update, publish and unpublish

curl -X PATCH https://api.legalcloud.info/api/documents/{id} \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"content": "<h1>Privacy policy v2</h1><p>...</p>"}'

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
     https://api.legalcloud.info/api/documents/{id}/publish

When the content changes, a new version is stored (on plans with versioning).

Versions

curl -H "Authorization: Bearer YOUR_TOKEN" \
     https://api.legalcloud.info/api/documents/{id}/versions

curl -H "Authorization: Bearer YOUR_TOKEN" \
     "https://api.legalcloud.info/api/documents/{id}/versions/diff?from=1&to=2"

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
     https://api.legalcloud.info/api/documents/{id}/versions/1/restore

Public page of a document

GET https://dash.legalcloud.info/d/{hash}?lang=en returns the rendered HTML (no API token needed unless the document requires one). GET /d/{hash}/restrictions?country=ES tells you whether a visitor from that country would be allowed.

Statistics

Statistics are available under /api/statistics/* (see Viewing analytics).

Next steps

Última actualización: 2026-10-27

Regístrate GRATIS de por vida, sin tarjeta de crédito

Crear cuenta gratis