SDK Usage

Here you find examples of how to use our SDKs.


We provide a ready-to-use Java Software Development Kit (SDK) to use our REST APIs and the graphQL API. The Java SDK makes it easy to authenticate using API Tokens, call methods from the API and transform the results. Our SDKs are available under the Open Source MIT License. Each LeanIX API needs its own SDK, check Available APIs.

You can also generate your own SDK using Swagger Codegen. All of our APIs include Swagger documentation. Approach us if you need help.

The following lines are an introduction to our Java SDK.

Includw the SDK in your project

The easiest way to incorporate the SDK into your Java project is to use Maven. If you're using Maven already; add a new dependency to your pom.xml file. The LeanIX Java SDK is published into the central maven repository at

The latest version of the Java SDK can be found at

To include in your ‘pom.xml’ file:


You can also build the SDK by running:

$ mvn package

You'll find leanix-sdk-java-3.9.9.jar, together with a sources jar and a javadoc jar in the target directory after the build completes.
In target/lib you will find the required libraries to use the SDK.

Authenticate and fetch Applications

The following example starts by authenticating your LeanIX workspace with an API token. It then fetches a list of applications and filters by the term design and outputs each Application name.

You will need to import the following packages in your Java code:

import net.leanix.api.*;
import net.leanix.api.common.*;
import net.leanix.api.models.*;

You first need to instantiate a LeanIX API Client (apiClient) using the builder class ApiClientBuilder.
You need to provide an API token and the hostname of the corresponding workspace. The workspace and privileges of the apiClient are determined by the API token.

ApiClient apiClient = new ApiClientBuilder()
    .withApiToken(“<INSERT API TOKEN HERE>“)

You can then use an API class to execute functions. For each of the different REST resources of LeanIX, there is one API class (for example the Fact Sheet resource class is named FactSheetsApi). Additionally, there is one API class called GraphqlApi for GraphQL queries.

In order to print the names of all applications which match the full-text search of "design", the GraphQL request would look like this:

    GraphqlApi graphqlApi = new GraphqlApi(apiClient);

String query = "{" + 
  "allFactSheets(filter: {fullTextSearch: \"design\"}) {" + 
    "edges { node {id displayName}}" + 
  "}" + 

GraphQLRequest graphqlRequest = new GraphQLRequest();

GraphQLResult result = graphqlApi.processGraphQL(graphqlRequest);

Map<String, Map<String, Object>> data = (Map<String, Map<String, Object>>) result.getData();
List<Map<String, Object>> edgeList = (List<Map<String, Object>>) data.get("allFactSheets").get("edges");

for (Map<String, Object> edge : edgeList) {
  Map<String, Object> node = (Map<String, Object>) edge.get("node");

    catch(Exception e){

This is the simplest approach to use the GraphQL API. If you want to page through the records found from your request, we suggest you create helper functions for iterating over the results and mapping them directly into POJOs (Plain Old Java Objects) or other data structures.

Using variables to set the startCursor value is a good way to implement this, since this avoids having a string replacement within a query.

Creating new Applications

The following example shows how a new Application can be created with the graphQL API:

GraphQLRequest graphQLRequest = new GraphQLRequest();

String mutationQuery = "mutation ($patches: [Patch]!) {"
    + "  createFactSheet(input: {name: \"New Test App\", type: Application}, patches: $patches) {"
    + "    factSheet {"
    + "      id name"
    + "      ... on Application { release }"
    + "    }"
    + "  }"
    + "}";


Map<String, Object> patches = new HashMap<>();
Patch patch = new Patch(PatchOperation.ADD, "/release", "4.4");
patches.put("patches", patch);

GraphQLResult result = graphqlApi.processGraphQL(graphQLRequest);

To ensure the request was successful, you need to check for the existence of an errors element in the GraphQLResult.

Using a proxy

In case that you need to use a proxy to access LeanIX you can setup a https proxy by setting the standard proxy system properties:

-Dhttps.proxyHost=<proxy hostname>
-Dhttps.proxyPort=<proxy port> (default is 443)