Skip to main content

Java SDK

Java SDK


Getting Started

  • Sign-in to Basis Theory and go to Applications
  • Create an Application using the Full Access template
  • Use the API Key issued for this application when initializing an ApiClient


Building the API client library requires:

  1. Java 8+
  2. Maven (3.8.3+)/Gradle (7.2+)


Gradle users

Add this dependency to your project's build file:

  repositories {
maven { url '' }

dependencies {
implementation 'com.github.Basis-Theory:basistheory-java:[version]'

The latest release version can be found in GitHub.

Maven users

Add the JitPack repository to your build file:


Then add the following dependency to your project's POM:


The latest release version can be found in GitHub.


Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.basistheory.ApiClient;
import com.basistheory.ApiException;
import com.basistheory.Configuration;
import com.basistheory.auth.*;
import com.basistheory.models.*;
import com.basistheory.ApplicationsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g., "Token" (defaults to null)

ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
CreateApplicationRequest createApplicationRequest = new CreateApplicationRequest(); // CreateApplicationRequest |
try {
Application result = apiInstance.create(createApplicationRequest);
} catch (ApiException e) {
System.err.println("Exception when calling ApplicationsApi#create");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());