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

  • Java 17 or later
  • Maven 3.6+ (build tool)
  • No runtime dependencies — uses Java standard library only

Install

Add to your pom.xml:
<dependency>
  <groupId>eu.law4devs.sdk</groupId>
  <artifactId>java</artifactId>
  <version>1.0.0</version>
</dependency>
Then run:
mvn install
To pin to a specific version:
<dependency>
  <groupId>eu.law4devs.sdk</groupId>
  <artifactId>java</artifactId>
  <version>1.0.0</version>
</dependency>

First Call

import eu.law4devs.sdk.Law4DevsClient;
import eu.law4devs.sdk.models.Framework;
import eu.law4devs.sdk.pagination.Page;

Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .build();

Page<Framework> page = client.frameworks().list();
System.out.println(page.data().get(0).name()); // e.g. "Cyber Resilience Act"

Configuration

import eu.law4devs.sdk.Law4DevsClient;
import java.time.Duration;

Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .baseUrl("https://api.law4devs.eu/v1") // default
    .timeout(Duration.ofSeconds(30))           // default 30s
    .maxRetries(3)                             // retries on 429/5xx, default 3
    .build();
OptionTypeDefaultDescription
apiKeyStringnullYour API key (required for authenticated endpoints)
baseUrlStringProduction URLOverride for dev/staging environment
timeoutDurationDuration.ofSeconds(30)Per-request HTTP timeout
maxRetriesint3Retries on 429/5xx responses

Environment Variable

export LAW4DEVS_API_KEY="your-key"
Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .build();
Never hardcode your API key in source code or commit it to version control.

Verify the Install

// VerifyInstall.java
import eu.law4devs.sdk.Law4DevsClient;

public class VerifyInstall {
    public static void main(String[] args) {
        var client = Law4DevsClient.builder()
            .apiKey(System.getenv("LAW4DEVS_API_KEY"))
            .build();
        System.out.println(client.frameworks().list().meta().total() + " frameworks");
    }
}
LAW4DEVS_API_KEY=your-key mvn compile exec:java -Dexec.mainClass="VerifyInstall"
# → 19 frameworks