Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt

Use this file to discover all available pages before exploring further.

Requirements

  • Node.js 18+ (uses the native fetch API — no polyfill needed)
  • npm, yarn, or pnpm
The SDK uses the global fetch available in Node 18 and all modern browsers. No additional HTTP dependencies are required.

Install

npm install law4devs
yarn add law4devs
pnpm add law4devs

First Call

import { Law4DevsClient } from 'law4devs';

const client = new Law4DevsClient({
  apiKey: process.env.LAW4DEVS_API_KEY!,
});

const page = await client.frameworks.list();
console.log(`Found ${page.meta.total} EU regulatory frameworks`);

for (const fw of page.data) {
  console.log(`${fw.shortName}: ${fw.name}`);
}

Constructor Options

const client = new Law4DevsClient({
  apiKey: process.env.LAW4DEVS_API_KEY!,
  baseUrl: 'https://api.law4devs.eu/v1',  // default
  timeout: 30_000,   // ms before request is aborted (default: 30000)
  maxRetries: 3,     // retries on 429/5xx (default: 3)
});
OptionTypeDefaultDescription
apiKeystringRequired. Your API key
baseUrlstringProduction URLOverride for dev environment
timeoutnumber30000Request timeout in milliseconds
maxRetriesnumber3Retries on 429/5xx
Never hardcode your API key in source code or commit it to version control. Always use environment variables.
Retries use exponential backoff. Timeouts are enforced via AbortController and work in both Node.js and browsers.