Java SDK

We now present a high-level Java API as a type-safe and gentle wrapper for the OpenMetadata backend.

The open-source OpenMetadata SDK for Java simplifies provisioning, managing, and using OpenMetadata resources from the Java application code. \ The OpenMetadata SDK for Java libraries build on top of the underlying OpenMetadata REST API, allows you to use those APIs through familiar Java paradigms. However, you can always use the REST API directly from Java code, if you prefer to do so.

You can find the source code for the OpenMetadata libraries in the GitHub repository. As an open-source project, contributions are always welcome!

You can add the below Maven Dependency for OpenMetadata Java Client.


To create OpenMetadata Gateway, you will need to establish a connection with OpenMetadata Server. The following inputs will be needed for the same.

  • Host Port: The url on which your instance of OpenMetadata is up and running.
  • ApiVersion: The value will be "v1".
  • Auth Provider: Provide the auth provider with which you need to configure.
  • Security Config: Provide the config for the selected auth provider.
        OpenMetadataConnection server = new OpenMetadataConnection();

Once the connection details are provided, you can create an OpenMetadata Gateway using the following piece of code.

    // OpenMetadata Gateway                                     
    OpenMetadata openMetadataGateway = new OpenMetadata(server);

To use Java Client without any authentication, you can use \

    NoOpAuthenticationProvider noOpAuthenticationProvider = new NoOpAuthenticationProvider();

Establish the OpenMetadata Server Connection and provide noOpAuthenticationProvider in the config.


The OpenMetadata Java SDK supports several auth providers:

Apart from the above mentioned auth providers, OpenMetadata Java SDK also supports Custom OIDC.

To set up Google as the auth provider, the following details are required:

    GoogleSSOClientConfig googleSSOClientConfig = new GoogleSSOClientConfig();

Provide the Google config while creating the server connection.


To set up Okta as the auth provider, the following details should be provided:

  • Client ID: Provide the client ID for the service application
  • Org URL: It is the same as the ISSUER_URL with v1/token. It is recommended to use a separate authorization server for different applications, rather than using the default authorization server.
  • Private Key: Use the Public/Private Key Pair that was generated while Creating the Service Application. When copy-pasting the keys ensure that there are no additional codes and that it is a JSON compatible string.
  • Email: Enter the email address
  • Scopes: Add the details of the scope created in the Authorization Server. Enter the name of the default scope created.
    OktaSSOClientConfig oktaSSOClientConfig = new OktaSSOClientConfig();
    oktaSSOClientConfig.setPrivateKey("{public/private keypair}");

Provide the Okta config while creating the server connection.


To set up Auth0 as the auth provider, the following details are required:

  • Client ID: Provide the client ID for the service application
  • Secret Key: Provide the client secret.
  • Domain: Provide the Auth0 domain. For example
    Auth0SSOClientConfig auth0SSOClientConfig = new Auth0SSOClientConfig();

Provide the Auth0 config while creating the server connection.


To set up Azure as the auth provider, the following details should be provided:

  • Client ID: The Application (Client) ID is displayed in the Overview section of the registered application.
  • Client Secret: The clientSecret can be accessed from the Certificates & secret section of the application.
  • Authority: When passing the details for authority, the Tenant ID is added to the URL as:
  • Scopes: Add the details of the scope created.
    AzureSSOClientConfig azureSSOClientConfig = new AzureSSOClientConfig();

Provide the Auth0 config while creating the server connection.


To set up OpenMetadata as the auth provider, the following details should be provided:

  • JWT Token: Provide the JWT Token. For example eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5Mmo....XN0aW9uLWJvdEBvcGVubWV0YWRhdGEub3JnIn0.Ku_FHGIS3Id3ARusMaXZDYKcq...Ztap9KDU7nZilNT2Bq-o75aIsgKKmtSuVdBTzpFK8aLGLmRp_8J007t-kpcjIW7Qf0l4...dGb0QqhoZin0JA
    OpenMetadataJWTClientConfig openMetadataJWTClientConfig = new OpenMetadataJWTClientConfig();

Provide the OpenMetadata config while creating the server connection.


To set up Custom auth provider. The following details are required:

  • Client ID: Provide the client ID of the preferred auth provider
  • Client Secret: Provide the client secret of your preferred auth provider
  • Token Endpoint: Provide the token endpoint of your preferred auth provider
    CustomOIDCSSOClientConfig customOIDCSSOClientConfig = new CustomOIDCSSOClientConfig();

Provide the custom auth provider config while creating the server connection.


You can use an API from the OpenMetadata Gateway. Using OpenMetadata Gateway, you will need to build the client by providing the class of the respected API. Below are some examples:

    // Dashboards API
    DashboardsApi dashboardApi = openMetadataGateway.buildClient(DashboardsApi.class);

    // Tables API
    TablesApi tablesApiClient = openMetadataGateway.buildClient(TablesApi.class);

    // Users API
    UsersApi usersApi = openMetadataGateway.buildClient(UsersApi.class);

    // Locations API
    LocationsApi locationsApi = openMetadataGateway.buildClient(LocationsApi.class);

Please refer to the examples to access an API:

  • Tables API
    TablesApi tablesApi = openMetadataGateway.buildClient(TablesApi.class);
    tablesApi.addLocationToTable("{table_id}", "{location_id}");
  • Location API
    LocationsApi locationsApi = openMetadataGateway.buildClient(LocationsApi.class);
    CreateLocation createLocation = new CreateLocation();
    Location location = locationsApi.createLocation(createLocation);
  • Elastic Search API
    ElasticSearchApi esApi = openMetadataGateway.buildClient(ElasticSearchApi.class);
    Response response = esApi.searchEntitiesWithQuery("", "pipeline_search_index", false, 0, 0, null, null, true, "{\"query\":{\"bool\":{}}}", null, false, null  );
    String data = IOUtils.toString(response.body().asInputStream(), Charsets.UTF_8);

If you want more examples of using different Java SDK methods, you will find them in our demo repository here.

Still have questions?

You can take a look at our Q&A or reach out to us in Slack

Was this page helpful?

editSuggest edits