@lexapi/client 0.2.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Official TypeScript SDK for [LexAPI](https://lex-api.com/?ref=npm-sdk) — Europ
10
10
  npm install @lexapi/client
11
11
  ```
12
12
 
13
- Node ≥ 18 (native `fetch`); the built package is also smoke-tested on Bun and Deno in CI. Zero runtime dependencies, ESM + CommonJS, strict hand-curated types. **Server-side only** — API keys are secrets and must never ship in client-side code (the SDK also skips the `User-Agent` header on browser runtimes, where setting it is forbidden).
13
+ Version 0.5.0 targets LexAPI API 3.0.0. Node ≥ 18 (native `fetch`); the built package is also smoke-tested on Bun and Deno in CI. Zero runtime dependencies, ESM + CommonJS, strict hand-curated types. **Server-side only** — API keys are secrets and must never ship in client-side code (the SDK also skips the `User-Agent` header on browser runtimes, where setting it is forbidden).
14
14
 
15
15
  ## Quickstart
16
16
 
@@ -36,10 +36,17 @@ LexAPI bills a monthly credit pool ([plans](https://lex-api.com/pricing?ref=npm-
36
36
  | 5 → 4 → 1 | `getDocument`, `getDocumentsBatch` (per item), `getDocumentByUrl`, `getDocumentMetadata` — 5 for a live browser fetch, settled to **4** when the Publications Office Cellar API answered, to **1** from the LexAPI corpus (`result.headers.source`); a text-unavailable answer settles at 1 |
37
37
  | 5 → 1 | `extractCitations` — refunded to 1 when the document was `alreadyExtracted` |
38
38
  | 5 | `semanticSearch`, `semanticLegislationSearch` (+ per live `asOf` fetch, see below) |
39
+ | 1 → 4 / 5 | `legislationAsOf` — 1 for the version alone or a provision read from the LexAPI corpus; 4 when the text is fetched (5 live from EUR-Lex), whatever the answer; 1 if the fetch fails |
40
+ | 5 | `getTransposition` — every plan |
39
41
  | 15 | `semanticSearch({ hyde: true })` — refunded to 5 if HyDE falls back |
40
42
  | 20 | `getCitationNetwork`, `getCitationPath`, `getRelatedDocuments`, `getCitationStats` |
43
+ | 20 | `getCounterparts` — BUSINESS, SCALE and ENTERPRISE only |
44
+ | 0 | `getNationalCoverage` (public) |
45
+ | 1 | `getNationalDocument` — every national read is a corpus read, so the 5-credit reservation always settles to 1 (an unknown id too) |
46
+ | 3 per call | `listNationalDocuments` — flat; pagination does not multiply the price |
47
+ | 5 | `nationalSemanticSearch`, `nationalLegislationSemanticSearch` — `hyde` never raises this for national case law; `asOf` adds nothing |
41
48
 
42
- Failed requests refund automatically (400/403 and 5xx in full; a 404 settles at 1). Refunds land just after the response, so a response's `credits` block can still show the upfront charge.
49
+ Failed requests refund automatically (400/403 and 5xx in full; a 404 settles at 1). Refunds land just after the response, so a response's `credits` block can still show the upfront charge. The national-law call allowance follows the same rule: a failed call (other than a 404) gives its call back too.
43
50
 
44
51
  ## Search & documents
45
52
 
@@ -75,7 +82,8 @@ console.log(batch.textUnavailable, batch.headers?.batch); // source counts — t
75
82
  const recent = await client.getRecentDocuments({ days: 7, documentType: "regulation" }); // one type; use search() for several
76
83
  const meta = await client.getDocumentMetadata({ celexNumber: "32016R0679" });
77
84
  const byUrl = await client.getDocumentByUrl({ url: "https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679" });
78
- const resolved = await client.resolve("ECLI:EU:C:2020:559"); // → { celex: "62018CJ0311", resolvedVia: "ecli-corpus" }
85
+ const resolved = await client.resolve("ECLI:EU:C:2020:559"); // → { celex: "62018CJ0311", resolvedVia: "ecli-corpus", verified: true }
86
+ // ELIs resolve via "eli-corpus" or "eli-cellar"; resolvedVia "eli" + verified: false = unconfirmed pattern guess, resolve again later
79
87
  ```
80
88
 
81
89
  ### Text availability and languages
@@ -107,6 +115,14 @@ const cases = await client.semanticSearch({
107
115
  includeText: true, // full text per hit instead of the default ~600-char `snippet`
108
116
  });
109
117
  if (cases.hint) console.warn(cases.hint); // present only on low-confidence result sets
118
+ for (const hit of cases.results) {
119
+ // With includeText (API 2.30.0): { available: true } or { available: false, reason }
120
+ const celex = hit.metadata?.celex_id;
121
+ if (hit.textAvailability?.available === false && celex) {
122
+ console.log(hit.textAvailability.reason, hit.snippet); // the snippet is not court text
123
+ const { document } = await client.getDocument({ celexNumber: celex }); // read the document itself
124
+ }
125
+ }
110
126
 
111
127
  // HyDE query rewriting — 15 credits instead of 5, ~1-3 s extra latency.
112
128
  // Best-effort: on LLM failure the response reports hyde: false and the premium is refunded.
@@ -127,6 +143,10 @@ for (const hit of articles.results) {
127
143
 
128
144
  Persistent identity for case-law hits is `(metadata.celex_id, metadata.document_type)` — `case_id` is snapshot-scoped and does not survive index rebuilds.
129
145
 
146
+ With `includeText: true`, every case-law hit carries `textAvailability` (API 2.30.0). A hit whose text LexAPI does not hold carries `{ available: false, reason: "not_in_corpus" }` (or `"unknown"` when LexAPI could not check; a retry may return the text) and keeps its `snippet`; `getDocument` with `metadata.celex_id` reads the document. A case-law `snippet` is cut from the machine-written `summary` when the hit has one, with or without `includeText`: it is not court text. The reason is an open string (do not switch on it exhaustively), and these reasons are not the ones a document's `textAvailability` uses. National hits do not carry `textAvailability`.
147
+
148
+ EU legislation hits, `getDocument`, `getDocumentsBatch`, `getDocumentByUrl` and `getDocumentMetadata` carry the in-force label of the act when its status is known (API 2.19.0): `inForce` (today, UTC), with `notInForceReason`, `endOfValidity` or `entryIntoForce`; all absent when unknown. `semanticLegislationSearch({ inForce: true })` keeps only hits known to be in force today and reports what it removed in `inForceFilter`. Documents, snapshots and EU semantic hits also carry `provenance` and `fieldProvenance` (API 2.20.0).
149
+
130
150
  ### The text in force on a date (`asOf`)
131
151
 
132
152
  ```ts
@@ -145,6 +165,27 @@ for (const hit of asOf.results) {
145
165
 
146
166
  The act must be in force on that date; the version is the act as published before its first consolidation, otherwise the consolidated version in force (later versions never count). `asOf` accepts `1952-01-01` … today (UTC); an invalid date is a 400 `InvalidParamsError`, refunded in full. **Cost:** 5 for the search; each live fetch of a version the corpus doesn't hold reserves 5 and settles by outcome (Cellar 4, browser 5, no text 1, failed 0), at most 3 per request by default. A fetch your pool can't cover is skipped (`asOfReason: "insufficient_credits"`) — never a 402. `AS_OF_REASONS` lists every documented reason.
147
167
 
168
+ ### An act on a date (`legislationAsOf`)
169
+
170
+ ```ts
171
+ // POST /legislation/as-of — needs LexAPI API 2.26.0
172
+ const answer = await client.legislationAsOf({
173
+ document: "32016R0679",
174
+ asOf: "2019-06-01",
175
+ provision: "art_17", // optional: an article, an annex ("anx_III") or recitals ("rct_26-28")
176
+ });
177
+
178
+ if (answer.asOfResolved) {
179
+ console.log(answer.asOfVersion); // { celex: "02016R0679-20160504", kind: "consolidated", date: "2016-05-04" }
180
+ console.log(answer.provision?.text);
181
+ if (answer.consolidated) console.log(answer.baseCelex, answer.consolidatedNote); // cite the authentic act
182
+ } else {
183
+ console.log(answer.asOfReason); // e.g. "not_yet_in_force" — a normal answer, not an error
184
+ }
185
+ ```
186
+
187
+ For an act you already know; `semanticLegislationSearch` with `asOf` (above) is the search by meaning. The answer is the newest consolidated version dated on or before `asOf`, or the act as published in the Official Journal when none is. An answer that cannot be established is returned, not thrown: `asOfResolved: false` with an `asOfReason` and no `provision` — use a text only when `asOfResolved` is `true`. Unresolved answers are not thrown, so a `try`/`catch` never sees them: `fetch_*`, `request_deadline`, `version_list_unavailable` and `version_lookup_cap` are worth asking again; the other reasons are final for that date. Consolidated versions have no legal force; only the act as published in the Official Journal (`baseCelex`) is authentic. `document` is always the act itself; `asOfVersion.celex` (and `date`) name the version the text comes from. `asOfVersion.validUntil`, when present, is the last day that version is the answer. The answer does not say whether an individual provision applied on that date, and `act.inForceToday` is about today, not `asOf`. An unknown act is a 404 `NotFoundError`; invalid input is a 400 (`InvalidCelexError` / `InvalidParamsError`). An API older than 2.26.0 has no such endpoint and also answers 404 (`NotFoundError`). `err.unknownEndpoint` is `false` there (the API sends it from 2.27.0): check `err.message.includes("Unknown API endpoint")`. **Cost:** 1 credit when no text is fetched; when the provision's text has to be fetched, 4 (5 when it is fetched live from EUR-Lex) whatever the answer, and 1 if the fetch fails or finds no text. A fetch reserves up to 5 credits: a pool holding fewer gets `asOfReason: "insufficient_credits"`. `AS_OF_LOOKUP_REASONS` lists every documented reason.
188
+
148
189
  ## Citations
149
190
 
150
191
  ```ts
@@ -165,9 +206,168 @@ if (!path.found) console.log(path.message); // graceful 200, not an er
165
206
 
166
207
  const related = await client.getRelatedDocuments("32016R0679", { limit: 10 }); // bibliographic coupling
167
208
  const stats = await client.getCitationStats();
209
+
210
+ // National documents in the graph (BUSINESS, SCALE, ENTERPRISE only — 403 TierForbiddenError below that):
211
+ const withNational = await client.getCitedBy("32016R0679", { includeNational: true });
212
+ console.log(withNational.includeNational); // present once honoured; absent while no jurisdiction is live
213
+ const nationalEdges = await client.getCites("AT-NOR-10001597"); // a national id works directly, no flag needed
214
+ ```
215
+
216
+ `citationType` is one of `reference`, `amendment`, `repeal`, `corrigendum`, `implementation`, `legal-basis`, `proposal`, `transposition` (`CITATION_TYPES`). All graph reads accept `language` for neighbour titles, and `includeNational` (`getCites`, `getCitedBy`, `getCitationNetwork`, `getCitationPath`, `getRelatedDocuments`, `getCitationStats`) to also return/follow national documents of live jurisdictions — BUSINESS, SCALE and ENTERPRISE only. `celexNumber` (and `getCitationPath`'s `from`/`to`) accept a national document id (e.g. `"AT-NOR-10001597"`) directly, with or without the flag; such an id whose jurisdiction isn't live is a plain `NotFoundError`.
217
+
218
+ ### Provenance, filters and node identity
219
+
220
+ Every edge says where it comes from (`provenance`: `notice`, `cellar`, `notice+cellar`,
221
+ `cellar-nim`, `source`, `resolver`) and how its target was identified (`resolution`: `id`, `key`,
222
+ `abbreviation`, `text-pattern`; `null` on EUR-Lex / Cellar edges) — on `citations[]` of
223
+ `getCites` / `getCitedBy` and on `edgeDetails[]` of network neighbours. Every node carries `id`,
224
+ `jurisdiction` (`EU`, `AT`, …) and `documentKind` (`act` | `decision` | `null`) next to
225
+ `celexNumber`.
226
+
227
+ ```ts
228
+ const edges = await client.getCitedBy("32016L0680", {
229
+ citationType: ["transposition", "implementation"], // one value or a list (sent comma-separated)
230
+ provenance: ["source", "cellar-nim"],
231
+ jurisdictions: ["eu", "at", "de"], // a national code implies includeNational (BUSINESS+)
232
+ resolution: ["id", "key"], // leave out abbreviation matches
233
+ });
234
+ for (const g of edges.citedBy) console.log(g.jurisdiction, g.id, g.citations?.map((c) => c.provenance));
235
+ console.log(edges.totalEdges, edges.countsSource); // page until offset + limit >= totalEdges
236
+
237
+ const refs = await client.getCites("DE-JUD-BFH-KBRE202550123", { unresolved: true }); // national id: references with no edge
238
+ for (const r of refs.unresolved ?? []) console.log(r.kind, r.text, r.status, r.targetId);
239
+ ```
240
+
241
+ `getCitationNetwork`, `getCitationPath` and `getRelatedDocuments` take the same four filters;
242
+ `getCitationNetwork` also takes `unresolved`. An unknown value is an `InvalidParamsError` with
243
+ `err.param` and `err.allowed`, refunded. `countsSource` (`stats` | `counted`, and
244
+ `paging.countsSource` on the network) says where the totals were read from; both are exact.
245
+ With `includeNational: true`, `getCitationStats` adds `byJurisdiction`, `byProvenance` and
246
+ `transposition`.
247
+
248
+ ### Notified measures and counterparts
249
+
250
+ ```ts
251
+ const t = await client.getTransposition("32016L0680", { jurisdictions: ["es", "cz"] }); // 5 credits, every plan
252
+ console.log(t.note); // a notification is not a finding that the measure transposes the act
253
+ for (const c of t.jurisdictions) {
254
+ for (const m of c.measures) console.log(c.jurisdiction, m.title, m.officialJournal.date, m.id ?? "(not held)");
255
+ }
256
+ console.log(t.source.cellar?.attribution); // keep with anything you republish
257
+
258
+ const cp = await client.getCounterparts("AT-NOR-10001597"); // 20 credits, BUSINESS+
259
+ for (const v of cp.via) {
260
+ for (const c of v.counterparts) console.log(v.euAct.id, c.rank, c.jurisdiction, c.id ?? c.title);
261
+ }
262
+ ```
263
+
264
+ `getTransposition` lists the measures the member states notified to the Commission for an EU act
265
+ (CELEX sector 3), from the Publications Office's Cellar records. On BUSINESS, SCALE and ENTERPRISE,
266
+ for live jurisdictions, it also says which measures LexAPI holds (`id`, `resolved`, `resolution`,
267
+ `counts.resolved`, `source.lanes`) and adds the documents whose national source records that they
268
+ transpose or implement the act; `resolvedOnly: true` keeps only those. Otherwise those fields are
269
+ `null` (and `termsRequired: true` while the national-source terms are not accepted). A CELEX that
270
+ is not an EU act is a `NotFoundError`.
271
+
272
+ `getCounterparts` returns a national document's counterparts in the other live jurisdictions,
273
+ through the EU acts it transposes or implements, ranked `1` (the national source records it), `2`
274
+ (a notified measure LexAPI holds) or `3` (a notified measure LexAPI does not hold, `id: null`). A
275
+ lookup past the server's budget throws `TimeoutError` (503, `err.partial`), refunded. The SDK does
276
+ not retry it; retry yourself, or narrow with `jurisdictions`.
277
+
278
+ ## National law
279
+
280
+ Member-state (and non-EU) legal orders alongside EUR-Lex. BUSINESS, SCALE and ENTERPRISE get full
281
+ access; FREE, STARTER and PROFESSIONAL get it within a monthly allowance of national calls. A
282
+ jurisdiction that isn't launched yet answers 404, exactly like a path that doesn't exist — check
283
+ `getNationalCoverage()` first.
284
+
285
+ ```ts
286
+ const coverage = await client.getNationalCoverage(); // public, free — no allowance consumed
287
+ for (const j of coverage.jurisdictions) {
288
+ if (j.live) console.log(j.code, j.name, j.legislation.documents, j.sources.map((s) => s.attribution));
289
+ }
290
+
291
+ const { document } = await client.getNationalDocument("AT", "AT-NOR-10001597"); // 1 credit
292
+ console.log(document.attribution); // always show this alongside the text
293
+ for (const a of document.content?.articles ?? []) console.log(a.number, a.title, a.text ?? "(no text)");
294
+
295
+ const page = await client.listNationalDocuments("AT", { q: "Datenschutz", limit: 20 }); // 3 credits flat
296
+ for await (const p of client.paginateNationalDocuments("AT", { q: "Datenschutz", limit: 100 })) {
297
+ console.log(p.results.length, p.hasMore); // cursor paging — reaches past the first 1,000 rows, `page` doesn't
298
+ }
299
+
300
+ const hits = await client.nationalSemanticSearch("AT", { query: "Datenschutz bei Bankgeschäften" }); // 5 credits
301
+ for (const h of hits.results) console.log(h.document.documentKind, h.document.ecli, h.document.dateOfDocument);
302
+ const articles = await client.nationalLegislationSemanticSearch("DE", { query: "Kündigungsfrist" }); // 5 credits
303
+ if (articles.partial) console.warn(articles.hint); // SEARCH_INCOMPLETE: results may be missing better matches
304
+
305
+ // asOf labels each hit for a date (API 2.29.0); the texts searched and returned are today's
306
+ const dated = await client.nationalLegislationSemanticSearch("AT", { query: "Recht auf Auskunft", asOf: "2020-06-01" });
307
+ for (const h of dated.results) {
308
+ if (h.asOfResolved) console.log(h.article_ref, h.asOfVersion?.validFrom, h.asOfVersion?.checkedAt);
309
+ else console.log(h.article_ref, h.asOfReason); // e.g. "provision_amended_since" — today's wording, not established for the date
310
+ }
311
+ ```
312
+
313
+ **National `asOf` (API 2.29.0).** The search runs over today's texts only: a provision repealed or
314
+ replaced since the date cannot be found, and the text is never swapped. A hit is resolved
315
+ (`asOfResolved: true`, `asOfVersion: { kind: "current_unit", validFrom, validTo, sourceId, checkedAt }`)
316
+ only when the publisher's dates, as of LexAPI's last recorded read of the act (`checkedAt`), show
317
+ that today's wording already applied on the date. An unresolved hit keeps today's wording; it is not
318
+ established as the text for the date (`asOfReason`, listed in `NATIONAL_AS_OF_REASONS`). LexAPI
319
+ holds such dates for Austria and Spain; elsewhere every hit is `asof_not_available`. `asOf` is a
320
+ `YYYY-MM-DD` string. `isNationalAsOfVersion(v)` tells it from the EU `asOfVersion` by `kind`.
321
+
322
+ **Incomplete national searches.** When the national index could not complete a semantic search,
323
+ results may be incomplete: with hits left the answer carries `partial: true`,
324
+ `partialReason: "SEARCH_INCOMPLETE"` and a `hint` (retry, or rephrase / change the filters). With
325
+ nothing left to return it throws instead — `NationalSemanticUnavailableError` (503,
326
+ `partialReason: "SEARCH_INCOMPLETE"`, `retryAfter` when a retry may help — retried at most once per call, and only with `retryReadOnlyPosts`) or
327
+ `NationalSemanticFilterUnreachableError` (422, not retryable as is). Both are refunded; an empty
328
+ answer would not have meant "no matches".
329
+
330
+ **One shape for every country (requires LexAPI API 2.8.0).** National documents have the same
331
+ fields, types and formats in every jurisdiction, so code written for one country works for all of
332
+ them. Every field is always present — one the source does not provide is `null` (or `[]`), never
333
+ missing:
334
+
335
+ - `documentKind` (`"act"` | `"decision"`) tells legislation from case law everywhere; `documentType`
336
+ is the source's own label, in its language.
337
+ - `decision` — on a decision, `{ court, chamber, caseNumbers, citedNorms: [{ text, documentId }] }`,
338
+ read server-side from whichever fields the source uses (also when the decision has no text);
339
+ `null` for acts. `isNationalDecision(document)` narrows it.
340
+ - `content` (or `null` when there is no text — see `textAvailability`) is always
341
+ `{ fullText, articles, textLanguages, textLanguage, embeddedForeignText, textSource, ocr, repeal, source, details }`;
342
+ every article is `{ number, title, section, text, inForceFrom, inForceTo, details }` (`text: null`
343
+ when the source publishes no text for that unit). What a source adds beyond these fields is under
344
+ `content.details` / `articles[].details` — source-specific, keys differ by country.
345
+ - Semantic hits carry `document` (the listing's summary of the matched document); legislation hits
346
+ always carry `law_title`, `article_ref`, `section`, `language`, `in_force`, `valid_from`,
347
+ `valid_to` and `law_type`, `null` when the index has nothing.
348
+
349
+ ```ts
350
+ import { isNationalDecision } from "@lexapi/client";
351
+
352
+ const { document: d } = await client.getNationalDocument("DE", "DE-JUD-BFH-KBRE202550123");
353
+ if (isNationalDecision(d)) {
354
+ console.log(d.decision.court, d.decision.caseNumbers.join(", ")); // "BFH 3. Senat" "III R 27/24"
355
+ for (const n of d.decision.citedNorms) console.log(n.text, n.documentId ?? "(not identified)");
356
+ }
168
357
  ```
169
358
 
170
- `citationType` is one of `reference`, `amendment`, `repeal`, `corrigendum`, `implementation`, `legal-basis`, `proposal`. All graph reads accept `language` for neighbour titles.
359
+ A document its source withdrew (a takedown, a pseudonymisation fix) throws `DocumentWithdrawnError` (410) from `getNationalDocument` and from the citation methods for a withdrawn national id — nothing of it is served, not even the title; drop any copy you hold.
360
+
361
+ `getNationalCoverage()` also reports each live jurisdiction's `citationGraph`: its extraction
362
+ `methods` (with `unmeasured` rates and their reason codes), `edges`, the measured rates
363
+ (`decisionResolutionRate`, `actEuRate`, `textPatternRate`, `nimResolvedRate`), `transposition`,
364
+ `precision` and `floors` — `null` wherever nothing was measured. National `content` also carries
365
+ `textSource` (`html` | `pdf-text` | `ocr` | `null`) and `ocr` (engine and confidence when the text
366
+ was machine-read — never the official text).
367
+
368
+ A used-up allowance is `NationalAllowanceExhaustedError` (402); its headroom is also on
369
+ `result.headers.nationalAllowance` (`{ limit, remaining, resetsAt }`) on every admitted call from a
370
+ plan below BUSINESS.
171
371
 
172
372
  ## Webhooks
173
373
 
@@ -190,7 +390,7 @@ for await (const page of client.webhooks.paginateDeliveries(created.webhook.id))
190
390
  await client.webhooks.delete(created.webhook.id);
191
391
  ```
192
392
 
193
- Webhooks per account: FREE 0 · STARTER 2 · PROFESSIONAL 10 · BUSINESS 50 · SCALE 100 · ENTERPRISE 100. Unsupported criteria are refused with a 400 `InvalidParamsError` whose `details` names each problem. Write calls are never retried on 5xx.
393
+ Webhooks per account: FREE 0 · STARTER 2 · PROFESSIONAL 10 · BUSINESS 50 · SCALE 100 · ENTERPRISE 100. Unsupported criteria are refused with a 400 `InvalidParamsError` whose `details` names each problem. Write calls are retried only on a 429 that is neither an exhausted quota nor a failed payment, or when the request never reached the API (connect failure, Cloudflare 521/522/523).
194
394
 
195
395
  ### Receiving deliveries
196
396
 
@@ -214,6 +414,8 @@ app.post("/webhooks/lexapi", express.raw({ type: "application/json" }), async (r
214
414
  });
215
415
  ```
216
416
 
417
+ `verifyWebhook` decodes the body as strict UTF-8 (one leading byte order mark is ignored) and parses it from the same bytes the signature covers; a body that is not valid UTF-8, or not one strict JSON object (no `NaN` or `Infinity`), throws `WebhookSignatureError("malformed_body")`. The error's `reason` is the first check that fails: `missing_secret`, `missing_signature` (header absent or empty), `invalid_signature`, `malformed_body`, `stale_timestamp` (a `timestamp` that is not `YYYY-MM-DDTHH:MM:SS[.fraction]` with `Z` or `±HH:MM` naming a real date and time in years 0001–9999, or further than `toleranceMs` from now; the edge passes). `toleranceMs: 0` turns the window off, a negative value rejects every delivery, and `NaN` is a `RangeError`. A secret with a lone surrogate is `missing_secret`. The header is trimmed of spaces, tabs, CR and LF only. Pass the raw bytes (`Buffer`, `Uint8Array`, `ArrayBuffer`); a string stands for its UTF-8 encoding, and a string with a lone surrogate, which has none, fails verification (`verifySignature` returns `false`, `verifyWebhook` throws `invalid_signature`, `computeSignature` throws `malformed_body`).
418
+
217
419
  `verifySignature(rawBody, signature, secret)` is the signature-only check. Both use Web Crypto (constant-time comparison); an empty `secret` throws `WebhookSignatureError("missing_secret")` (a configuration error, not a bad delivery).
218
420
 
219
421
  ## Corpus export (BUSINESS, SCALE, ENTERPRISE)
@@ -224,7 +426,7 @@ app.post("/webhooks/lexapi", express.raw({ type: "application/json" }), async (r
224
426
 
225
427
  **Filters:** `documentType` matches the stored label exactly, ignoring case; `documentTypeCode: "regulation"` selects the family (incl. implementing and delegated regulations); `author` matches whole values; `dateFrom` / `dateTo` are `YYYY-MM-DD`; `changedSince` returns rows whose text changed (the cheapest incremental sync) and `fetchedSince` rows written to at all — both an ISO date or a date-time with a timezone, or a `Date`; `limit` is a positive integer (anything else throws `RangeError`).
226
428
 
227
- Licensing: exported content may not be used to train or evaluate ML models without a separate licence ([Terms §6](https://lex-api.com/terms?ref=npm-sdk#acceptable-use)).
429
+ Licensing: exported content may not be used to train or evaluate ML models without a separate licence ([Terms §6](https://lex-api.com/terms?ref=npm-sdk#acceptable-use)). For training data, [Arieta Data](https://data.arietalabs.com/?ref=npm-sdk), a sister product from Arieta Labs, licenses datasets drawn from the same corpus for training, retrieval and evaluation.
228
430
 
229
431
  ```ts
230
432
  const stream = await client.export({ documentTypeCode: "regulation", dateFrom: "2024-01-01", limit: 10_000 });
@@ -232,31 +434,42 @@ const stream = await client.export({ documentTypeCode: "regulation", dateFrom: "
232
434
  console.log(stream.meta?.totalMatching, stream.headers.total); // leading _meta envelope / X-Export-Total
233
435
 
234
436
  for await (const row of stream) {
235
- process(row.celex, row.documentTypeCode, row.parsedContent);
437
+ handleRow(row.celex, row.documentTypeCode, row.parsedContent);
236
438
  }
237
439
 
238
440
  console.log(stream.done?.written, stream.done?.skippedStubs);
239
441
  if (stream.truncated) console.warn(`rows not reached (${stream.done?.truncatedBy}) — narrow filters or resume via changedSince`);
240
442
  ```
241
443
 
242
- The `_meta`/`_done` envelope lines are never yielded as rows; the stream is single-pass (re-iterating a fully read stream yields nothing; iterating one you ended early raises `IncompleteExportError` — call `export()` again to re-read). Breaking out of the loop (or `stream.cancel()`, or the call's `signal`) releases the connection. **A stream that ends without its `_done` trailer throws `IncompleteExportError`** (so does a `_done` with `complete: false`, or an `_error` line, which is never yielded as a row) after yielding the rows that did arrive — the server stopped mid-export and they are not the whole set (`stream.complete` stays `false`; `stream.rowsRead` counts them). A dropped connection throws `NetworkError`, a stall longer than `timeoutMs` throws `TimeoutError`. Lines that are not JSON objects are counted in `stream.invalidLines`. For "did matching rows remain that this export did not reach?" read `stream.truncated` — after iterating it is the server's authoritative `_done.truncated` (`stream.done?.truncatedBy`: `limit`, `max_rows`, `credits` or `recovered`); before that, a hint from the up-front count. Metadata-only rows are skipped unless `includeStubs: true`.
444
+ The `_meta`/`_done` envelope lines are never yielded as rows; the stream is single-pass (re-iterating a fully read stream yields nothing; iterating one you ended early raises `IncompleteExportError` — call `export()` again to re-read). Breaking out of the loop (or `stream.cancel()`, or the call's `signal`) releases the connection. **A stream that ends without its `_done` trailer throws `IncompleteExportError`** (so does a `_done` with `complete: false`, or an `_error` line, which is never yielded as a row) after yielding the rows that did arrive — the server stopped mid-export and they are not the whole set (`stream.complete` stays `false`; `stream.rowsRead` counts them). A dropped connection throws `NetworkError`, a stall longer than `timeoutMs` throws `TimeoutError`. A line ends at a line feed byte; lines are read as strict UTF-8 whatever charset the response names (one byte order mark at the very start of the stream is ignored) and trimmed of spaces, tabs and CR; lines that are not UTF-8, or not one JSON object, are counted in `stream.invalidLines`, and blank lines are skipped. `stream.meta` comes only from the very first line. For "did matching rows remain that this export did not reach?" read `stream.truncated` — after iterating it is the server's authoritative `_done.truncated` (`stream.done?.truncatedBy`: `limit`, `max_rows`, `credits` or `recovered`); before that, a hint from the up-front count, and `false` when nothing says. Metadata-only rows are skipped unless `includeStubs: true`.
243
445
 
244
446
  ## Point-in-time versions
245
447
 
246
- Versions are LexAPI *observation snapshots* — the document as fetched — not legal in-force reconstructions; history begins at first ingestion. (For the text in force on a date, use a consolidated CELEX or `semanticLegislationSearch({ asOf })`.)
448
+ Versions are LexAPI's fetch snapshots — the document as LexAPI fetched it — not the law in force on a date; history begins at first ingestion. (For the version of an EU act for a date, use `legislationAsOf`.)
247
449
 
248
450
  ```ts
451
+ import { NotFoundError } from "@lexapi/client";
452
+
249
453
  const history = await client.listDocumentVersions("32016R0679");
250
454
  console.log(history.currentVersion, history.trackedSince);
251
455
 
252
456
  const snapshot = await client.getDocumentVersion("32016R0679", 2);
253
457
  console.log(snapshot.document.parsedContent, snapshot.corpusVersion);
254
458
 
255
- const atDate = await client.getDocumentAtDate("32016R0679", "2026-03-20");
256
- console.log(atDate.asOf, atDate.document.version);
459
+ try {
460
+ const atDate = await client.getDocumentAtDate("32016R0679", "2026-04-01");
461
+ console.log(atDate.kind); // "observation_snapshot" — not the law in force on that date
462
+ console.log(atDate.document.observedFrom); // when this version began in LexAPI's fetch history (null: no record of it)
463
+ console.log(atDate.document.observedUntil); // when the next version's text arrived (null: current version)
464
+ if (atDate.inForceLookup) console.log("for the act on a date, use legislationAsOf");
465
+ } catch (err) {
466
+ if (err instanceof NotFoundError && err.beforeTracking) console.log(err.trackedSince); // tracking began later
467
+ else if (err instanceof NotFoundError && err.boundaryUnknown) console.log(err.candidates); // read them with getDocumentVersion
468
+ else throw err;
469
+ }
257
470
  ```
258
471
 
259
- Each call costs 1 credit. Dates before the document entered the corpus reject with `NotFoundError` carrying the tracking start date.
472
+ `fetchedAt` is when a version's text arrived at LexAPI; `observedFrom` is when the version began in LexAPI's fetch history, `null` when LexAPI has no record of it — then `fetchedAt` is the last fetch of its text, not when the version began. A future date returns the current version with `dateInFuture: true` (and `xWarning`). Each call costs 1 credit; a `boundaryUnknown` 404 is refunded. A date before the document entered the corpus rejects with `NotFoundError` (`beforeTracking`, `trackedSince`); a date next to a version stored before API 2.28.0 whose start LexAPI has no record of rejects with `boundaryUnknown` and `candidates` (`{ version, fetchedAt, observedFrom }`, at most 10, `candidatesTruncated` beyond; `[]` when none).
260
473
 
261
474
  ## Response headers
262
475
 
@@ -273,9 +486,13 @@ r.headers?.corpusVersion; // X-Corpus-Version
273
486
 
274
487
  Also: `searchSource`, `searchCache`, `warning`, `ignoredDocumentTypes`, `postFilteredBy`, `documentTypeFanOut`, `batch`. The older `xWarning` (and `corpusVersion` on version responses) are still set.
275
488
 
489
+ On the four national document/semantic endpoints, `headers.nationalAllowance` (`{ limit, remaining, resetsAt }`, from `X-National-Limit`/`X-National-Remaining`/`X-National-Reset`) reports the monthly national-call allowance left — present only for FREE/STARTER/PROFESSIONAL callers (absent for BUSINESS and above, and for `getNationalCoverage`).
490
+
276
491
  ## Configuration
277
492
 
278
493
  ```ts
494
+ import { LexAPI } from "@lexapi/client";
495
+
279
496
  const client = new LexAPI({
280
497
  apiKey: "lex_...", // or LEXAPI_API_KEY env var
281
498
  baseUrl: "https://lex-api.com/api/v1", // default
@@ -286,9 +503,11 @@ const client = new LexAPI({
286
503
  });
287
504
  ```
288
505
 
506
+ Redirects are followed only within the origin of `baseUrl` (or to the same host over HTTPS on the default ports), at most five per attempt; any other redirect is refused with a `NetworkError`, so the API key is never sent to another origin. A custom `fetch` must honour `redirect: "manual"` for this to hold.
507
+
289
508
  ## Retries, timeouts and cancellation
290
509
 
291
- The SDK retries automatically **only when a retry cannot charge you twice** (the shared SDK contract, [PLAN.md §1.2](PLAN.md)). Up to 3 retries (`retry.maxRetries`), exponential backoff with full jitter (base 0.5 s, cap 30 s):
510
+ The SDK retries automatically **only when a retry cannot charge you twice** (the shared SDK contract, [§1.2](https://github.com/Lex-API/lexapi-typescript/blob/main/docs/sdk-contract.md)). Up to 3 retries (`retry.maxRetries`), exponential backoff with full jitter (base 0.5 s, cap 30 s):
292
511
 
293
512
  | Failure | GET, billed | GET, free (`getInfo`, webhook reads) | Read-only POST | Mutating call |
294
513
  |---|---|---|---|---|
@@ -300,11 +519,13 @@ The SDK retries automatically **only when a retry cannot charge you twice** (the
300
519
  | Any other transport error (reset, connection closed — `fetch` cannot tell before-response from mid-response — read error, `REQUEST_TIMEOUT`) | no | retry | no | no |
301
520
  | 400 / 401 / 402 / 403 / 404 / 500 and anything else | no | no | no | no |
302
521
 
303
- - **Read-only POSTs** are `search`, `getDocument`, `getDocumentsBatch`, `getDocumentByUrl`, `getDocumentMetadata`, `resolve`, `semanticSearch`, `semanticLegislationSearch`. **Mutating calls** are the webhook writes and `extractCitations` (it persists edges).
522
+ - **Read-only POSTs** are `search`, `getDocument`, `getDocumentsBatch`, `getDocumentByUrl`, `getDocumentMetadata`, `resolve`, `semanticSearch`, `semanticLegislationSearch`, `legislationAsOf`, `nationalSemanticSearch`, `nationalLegislationSemanticSearch`. **Mutating calls** are the webhook writes and `extractCitations` (it persists edges).
304
523
  - **App-origin** = the response carries a non-empty `X-LexAPI-Version` header or a `RateLimit-Limit` header (the API's rate limiter sets `RateLimit-*` on every billable app response; proxies never do). A JSON error body alone is not enough. Anything else is treated as a proxy answer: the API may have charged the call and not refunded it, so a billed call is not retried.
305
- - **Wait:** `Retry-After` on any status (an empty or unparseable value counts as absent); on a 429 only, then `RateLimit-Reset` and the JSON `retryAfter` field. `X-RateLimit-*` is not read. Every hint is clamped to the 30 s cap; numbers above 1e12 / 1e9 are read as epoch ms / s. A quota 429 has `retryAfter: undefined`.
524
+ - **Wait:** `Retry-After` on any status (decimal seconds such as `5` or `2.5`, or an HTTP-date in one of the three RFC 9110 forms with `GMT`, `UTC` or `+0000`; anything else counts as absent); on a 429 only, then `RateLimit-Reset` (decimal seconds) and the JSON `retryAfter` field (a number ≥ 0, else absent; the top-level field first, then the one in `details`); on a 503 `NATIONAL_SEMANTIC_UNAVAILABLE` (an incomplete national search), the JSON `retryAfter` field. `X-RateLimit-*` is not read. Every hint is clamped to the 30 s cap (`retry.maxDelayMs`; a cap below the server's requested wait shortens it); numbers above 1e12 / 1e9 are read as epoch ms / s. A quota 429 has `retryAfter: undefined`. An incomplete national search whose only hint is unusable is not retried. No wait is longer than 2^31−1 ms (about 24.8 days), whatever `maxDelayMs` says: a longer timer would fire at once.
525
+
526
+ **Timeout:** `timeoutMs` (default 95 s) is an *inactivity* limit per attempt: the longest the SDK waits for the next bytes — until the response head, then between body chunks (the timer restarts on every chunk), for JSON bodies and export streams alike. It is not a deadline for the whole call. On expiry you get `TimeoutError` with `code: "REQUEST_TIMEOUT"` (status 0). `fetch` cannot time the connect phase separately, so it counts inside the first window. The 95 s default sits above the API's 90 s deadline on document reads, so that timeout comes back as a typed, refunded 504; the CDN ends any wait at 100 s. `timeoutMs: Infinity` sets no limit, and `0` times out at once (on an export stream's body reads, `0` sets no idle limit); a value above 2^31−1 ms is clamped to that.
306
527
 
307
- **Timeout:** `timeoutMs` (default 95 s) is an *inactivity* limit per attempt: the longest the SDK waits for the next bytes — until the response head, then between body chunks (the timer restarts on every chunk), for JSON bodies and export streams alike. It is not a deadline for the whole call. On expiry you get `TimeoutError` with `code: "REQUEST_TIMEOUT"` (status 0). `fetch` cannot time the connect phase separately, so it counts inside the first window. 95 s lets the API's own 90 s limit on one live EUR-Lex fetch reach you as a typed, refunded 504; a request needing several upstream fetches can still exceed it.
528
+ **Iterators:** `paginateCites`, `paginateCitedBy`, `webhooks.paginateDeliveries` and `paginateNationalDocuments` yield each page as it arrives and end by the documented stop conditions (a short or empty page, `totalEdges` / `total` reached, no `nextCursor`, `hasMore` not `true`, a page without its list). They throw `InvalidResponseError` when the server stops advancing: a cites/cited-by page echoing an `offset` other than the one requested; a `nextCursor` already sent in the walk; and, only when the answers carry no usable `totalEdges`/`offset` (cites, cited-by) or `total` (deliveries), three pages in a row that repeat the one before (cites, cited-by: the same list; deliveries: no unseen `id`); a page with such a signal ends a run (on cites/cited-by its list is still the one the next page is compared with). A national `nextCursor` that is not a string throws too. When a walk throws, the pages already yielded stay valid; the page that showed the stall is not yielded and is on `err.body`. A starting `offset` that is not an integer ≥ 0, or a `limit` that is not an integer ≥ 1 (each at most 2^53 − 1), is a `RangeError` before any request (every iterator, `paginateNationalDocuments` included). Cites/cited-by advance by each group's `citationCount`; a group whose count is 0 but whose edge list is not empty counts its list.
308
529
 
309
530
  **Cancellation:** every method takes `{ signal }`. Aborting cancels the in-flight request, any retry wait and an export stream (the connection is released), and rejects with `RequestAbortedError` (`code: "ABORTED"`, `cause` = the signal's reason).
310
531
 
@@ -319,7 +540,7 @@ await client.semanticSearch({ query: "gdpr" }, { signal: controller.signal });
319
540
  Every non-2xx response maps to a typed error carrying `code`, `status`, `message`, `details`, `retryAfter`, the raw `body` and parsed `headers`:
320
541
 
321
542
  ```ts
322
- import { CreditsExhaustedError, NotFoundError, RateLimitedError, TierForbiddenError } from "@lexapi/client";
543
+ import { CreditsExhaustedError, NotFoundError, PaymentPastDueError, RateLimitedError, TierForbiddenError } from "@lexapi/client";
323
544
 
324
545
  try {
325
546
  await client.semanticSearch({ query: "gdpr" });
@@ -327,30 +548,41 @@ try {
327
548
  if (err instanceof RateLimitedError && err.quotaExhausted) console.log(`legacy quota resets ${err.resetsAt}`);
328
549
  else if (err instanceof RateLimitedError) console.log(`retry in ${err.retryAfter}s`, err.rateLimit);
329
550
  else if (err instanceof CreditsExhaustedError) console.log(`need ${err.weight}, have ${err.available}; resets ${err.resetsAt}`);
551
+ else if (err instanceof PaymentPastDueError) console.log(`pay the open invoice: ${err.billingUrl ?? "in the dashboard"}`); // before TierForbiddenError: it extends it
330
552
  else if (err instanceof TierForbiddenError) console.log((err.body as { upgradeUrl?: string })?.upgradeUrl);
331
- else if (err instanceof NotFoundError) console.log("no such document");
553
+ else if (err instanceof NotFoundError) console.log(err.unknownEndpoint || err.message.includes("Unknown API endpoint") ? "no such endpoint" : "no such document");
332
554
  else throw err;
333
555
  }
334
556
  ```
335
557
 
336
558
  | Class | `code` | HTTP |
337
559
  | --- | --- | --- |
338
- | `NotFoundError` | `NOT_FOUND` | 404 |
339
- | `InvalidCelexError` / `InvalidUrlError` / `InvalidParamsError` | `INVALID_CELEX` / `INVALID_URL` / `INVALID_PARAMS` | 400 |
560
+ | `NotFoundError` | `NOT_FOUND` | 404 — `.unknownEndpoint` is `true` when the API (2.27.0 or later) has no such endpoint: a mistyped path, a method newer than the API, or a national route for a country that is not available. Always `false` on APIs before 2.27.0; there the message contains "Unknown API endpoint". `.reason` is `details.reason`; on `getDocumentAtDate` (API 2.28.0) `.beforeTracking` (with `.trackedSince`, `.inForceLookup`) or `.boundaryUnknown` (with `.candidates`, `.candidatesTruncated`). |
561
+ | `DocumentWithdrawnError` | `DOCUMENT_WITHDRAWN` | 410 — a national document its source withdrew; nothing of it is served; `.id`/`.jurisdiction`/`.withdrawnAt`; not retryable, drop any copy you hold |
562
+ | `InvalidCelexError` / `InvalidUrlError` / `InvalidParamsError` | `INVALID_CELEX` / `INVALID_URL` / `INVALID_PARAMS` | 400 — `InvalidParamsError.param` / `.value` / `.allowed` name a refused filter, the value sent and the allowed values |
340
563
  | `AuthenticationError` | `UNAUTHORIZED` (derived) | 401 |
341
564
  | `CreditsExhaustedError` | `CREDITS_EXHAUSTED` | 402 |
565
+ | `NationalAllowanceExhaustedError` | `NATIONAL_ALLOWANCE_EXHAUSTED` | 402 — FREE/STARTER/PROFESSIONAL's monthly national-law call allowance is used up; `resetsAt`/`limit`/`upgradeUrl` |
566
+ | `NationalSemanticNotEnabledError` | `NATIONAL_SEMANTIC_NOT_ENABLED` | 409 — this jurisdiction has no semantic index to search; `.jurisdiction`; not retryable, refunded |
342
567
  | `TierForbiddenError` | `TIER_FORBIDDEN` | 403 |
568
+ | `PaymentPastDueError` (extends `TierForbiddenError`) | `PAYMENT_PAST_DUE` | 403 — a subscription payment failed and was not completed in time; API requests are refused until the payment succeeds; pay the open invoice in the dashboard (`.billingUrl`; `.accessEndedAt` when known); not retryable. Before API 2.27.0 a failed payment was refused at once with a 403 without a code, raised as `TierForbiddenError`. |
343
569
  | `RateLimitedError` | `RATE_LIMITED`, `QUOTA_EXHAUSTED` | 429 — `QUOTA_EXHAUSTED` (legacy plans' used-up quota) is never retried; `resetsAt` says when it refills |
344
570
  | `InternalServerError` | `INTERNAL` | 500 |
345
571
  | `UpstreamError` | `UPSTREAM_ERROR` | 502; Cloudflare 520–523 |
346
572
  | `ServiceUnavailableError` | `SERVICE_UNAVAILABLE` (derived) | 503 |
347
- | `TimeoutError` | `TIMEOUT` (504, 524) / `REQUEST_TIMEOUT` (status 0, the SDK's own timeout) | |
573
+ | `NationalSemanticUnavailableError` (extends `ServiceUnavailableError`) | `NATIONAL_SEMANTIC_UNAVAILABLE` | 503 — a jurisdiction's semantic index is temporarily unreachable, or could not complete this search with nothing left to return (`.partialReason === "SEARCH_INCOMPLETE"`, `retryAfter` — absent once the same search has repeatedly come back incomplete, and then not retried); `.jurisdiction`; retry later |
574
+ | `NationalSemanticFilterUnreachableError` (extends `InvalidParamsError`) | `NATIONAL_SEMANTIC_FILTER_UNREACHABLE` | 422 — the national index cannot search this slice (jurisdiction, document kind, filters) completely and there is nothing left to return; a coverage limit, not a malformed request (the request may be valid; `.param` is absent); `.jurisdiction`, `.partialReason`; not retryable as is — rephrase the query or change the filters; refunded |
575
+ | `TimeoutError` | `TIMEOUT` (504, 524; 503 from `getCounterparts`, with `.partial` / `.serverTimeoutMs`) / `REQUEST_TIMEOUT` (status 0, the SDK's own timeout) | |
348
576
  | `NetworkError` | `CONNECTION_ERROR` | 0 (transport failure, or the connection dropped — incl. mid-export) |
349
577
  | `RequestAbortedError` | `ABORTED` | 0 (your `signal` fired) |
350
- | `InvalidResponseError` | `INVALID_RESPONSE` | a 2xx whose body was not JSON (e.g. a proxy HTML page) |
578
+ | `InvalidResponseError` | `INVALID_RESPONSE` | a 2xx that is not the documented shape: no body, a body that is not JSON (e.g. a proxy HTML page), JSON that is not an object, `success: false`, a list such as `results` that is missing where the endpoint always sends it, is not a list, or holds items that are not objects, or an object such as `document` that is missing or not an object. Never read as an empty result; unknown extra fields are accepted. The message never quotes the body. |
351
579
  | `IncompleteExportError` | `INCOMPLETE_EXPORT` | 0 — an export ended without a complete `_done` trailer, or the server sent an `_error` line (`rowsRead`, `details`) |
352
580
  | `LexAPIError` (base) | `INTERNAL` | any other status (e.g. 409, 413), with `status` kept |
353
581
 
582
+ `PaymentPastDueError` extends `TierForbiddenError`, so a handler for `TierForbiddenError` still catches a failed payment, as it did before API 2.27.0. To tell the two apart, check `PaymentPastDueError` (or `err.code === "PAYMENT_PAST_DUE"`) first.
583
+
584
+ **Response text on errors.** No error message quotes the response body. For a body that is not JSON, the first 200 characters (code points) are on `err.bodyExcerpt`; for an `InvalidResponseError` about JSON of the wrong shape, the parsed value is on `err.body`. Both are raw response content that may contain document text: do not show them to a model or log them by default. Neither is an own property of the error (both are read through getters), so `console.log(err)`, `util.inspect(err)` and `JSON.stringify(err)` leave them out. A `2xx` answer with `success: false` and an API error in its body throws that error (e.g. `NotFoundError`) with the `2xx` status.
585
+
354
586
  **`instanceof` across builds.** The package ships an ESM and a CommonJS build; in a process that loads both (a CommonJS dependency wrapping the SDK inside an ESM app, Next.js, …) they are two copies of every class. The error classes carry a shared brand (`Symbol.for`), so `err instanceof NotFoundError` is still true for an error thrown by the other copy. `isLexAPIError(err)` / `isLexAPIError(err, NotFoundError)` does the same as a function.
355
587
 
356
588
  Both the typed envelope (`{success: false, error: {code, message, details}}`) and the legacy bare `{error, message, details?}` shape (still used by 429s, API-key 401s, `/search` and webhook validation, the export tier gate and semantic upstream errors) are parsed; unknown codes stay on the base `LexAPIError` with the raw code string.
@@ -375,6 +607,7 @@ npm run lint # tsc --noEmit (strict)
375
607
  npm test # vitest (Node ≥ 20)
376
608
  npm run build # tsup -> dist/ (ESM + CJS + d.ts / d.cts)
377
609
  npm run smoke:dist # framework-free check of the built bundles (runs on Node 18+)
610
+ npm run check:readme # type-check this README's TypeScript examples against dist/
378
611
  ```
379
612
 
380
- See [PLAN.md](PLAN.md) for the endpoint coverage matrix and SDK contract. Docs: <https://lex-api.com/docs?ref=npm-sdk>
613
+ See [docs/sdk-contract.md](https://github.com/Lex-API/lexapi-typescript/blob/main/docs/sdk-contract.md) for the SDK contract. Docs: <https://lex-api.com/docs?ref=npm-sdk>