Questa guida non è ancora stata tradotta nella Sua lingua.
LegalCloud provides client libraries for the three most common server-side languages. They read your LegalCloud data (documents and their versions, sites, resources, statistics, tokens and API usage), show a document in your application (as HTML or as an iframe) and send the headers that feed your source analytics. Creating, editing and deleting content is done in the dashboard.
Available SDKs
| SDK | Version | Requirements | Guide |
|---|---|---|---|
| JavaScript / TypeScript | 1.1.0 | Node 18+ (global fetch) or a modern browser; ES module + CommonJS, TypeScript types | JavaScript SDK quickstart |
| Python | 1.1.0 | Python 3.8+, requests 2.28+ | Python SDK quickstart |
| PHP | 1.1.0 | PHP 7.4+, ext-curl, ext-json (no WordPress needed) | PHP SDK quickstart |
All three expose the same features:
| Feature | What it does |
|---|---|
| Documents | getDocument (rendered HTML), list (with a paginated iterator), detail, languages, limits, versions and version diff |
| Embeds | publicUrl and iframeHtml build the public address and the <iframe> tag |
| Sites, resources | List and detail of sites, resource listing, usage and statistics |
| Statistics | Totals, KPIs, views, per-document stats, visits, source breakdown and top sites |
| Account | Token list, API usage and the log of recent API calls |
| Reliability | Timeout, automatic retries with exponential backoff for 429, 5xx and network errors (a Retry-After header wins), quota and rate-limit headers in lastQuota / lastRateLimit |
| Errors | ValidationError, AuthenticationError, PermissionDeniedError, NotFoundError, RateLimitError, ServerError, NetworkError (names adapt to each language) |
The methods map one to one to the read endpoints of the REST API; each one needs the scope that the API reference lists (documents:read, sites:read, resources:read, organization:read).
Getting the SDK
The SDKs are distributed as ZIP files from your dashboard:
- Sign in at https://dash.legalcloud.info/auth/login.
- Open Downloads.
- Download the SDK you need (for example
legalcloud_sdk-js-1.1.0.zip). The page shows the SHA-256 fingerprint of each file so you can verify it. - Unzip it: you get a
legalcloudfolder with the README, the changelog and the license. - Follow the quickstart of your language.
There are no packages published on npm, PyPI or Packagist: install them from the downloaded folder as explained in each guide.
Addresses
The SDKs call the API at https://api.legalcloud.info and build public pages on https://dash.legalcloud.info by default; you can override both (baseUrl, embedBaseUrl).
Authentication
The SDKs send your API token as a bearer credential. See Authentication with bearer tokens.
Tracking
Each request carries X-LegalCloud-Source, X-LegalCloud-Site, X-LegalCloud-Plugin-Id and X-LegalCloud-Version so that your dashboard can show which integration and which website are reading each document. See Viewing analytics.