legal-docs-client
v0.2.6
Published
TypeScript client for accessing legal documents from the Case Law Explorer API
Maintainers
Readme
Legal Docs Client
A TypeScript client library for accessing legal documents from the Case Law Explorer API.
Installation
npm install legal-docs-clientUsage
Basic Setup
import { createLegalDocsClient } from 'legal-docs-client';
const client = createLegalDocsClient({
apiKey: process.env.CITATIONS_API_KEY
});Fetching Documents
const documents = await client.fetchDocuments({
query: {
dataSources: ["RS"],
degreesSource: 0,
degreesTarget: 0,
dateStart: "1900-01-01",
dateEnd: "2026-03-10",
docTypes: ["DEC"],
engine: "ES",
attributesToFetch: "ALL",
keywords: ["armenia"],
selectedLawsIntersect: true,
},
});
console.log(documents);Getting Full Text
const fullTextDocs = await client.getFullText(['ECLI:NL:HR:2005:AO9006', 'ECLI:NL:RBSGR:2012:BY5532']);
console.log(fullTextDocs);Fetching Laws
const laws = await client.fetchLaws('Art. 7:669 BW');
console.log(laws);Environment Configuration
This package requires an API token from the Case Law Explorer API for document requests.
Setup Instructions
- Install dotenv (if working in Node.js):
npm install dotenv- Create a
.envfile in your project root:
CITATIONS_API_KEY=your_api_token_here- Load environment variables in your application:
import 'dotenv/config';
import { createLegalDocsClient } from 'legal-docs-client';
const client = createLegalDocsClient({
apiKey: process.env.CITATIONS_API_KEY
});Note: For Vite projects, use
import.meta.env.VITE_CITATIONS_API_KEYinstead and prefix your.envvariable withVITE_.
Getting an API Token
New API keys can be generated at: https://api.caselawexplorer.tech/login.html?next=/account.html
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
