> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendx.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Learn how to configure and add your first contact with SendX Java SDK

## Prerequisites

To get the most out of this guide, you’ll need to:

* [**Create a SendX Account**](https://app.sendx.io/register)
* [Install Java 1.8+](https://www.oracle.com/java/technologies/downloads/?er=221886)
* [Install Maven (3.8.3+)/Gradle (7.2+)](https://maven.apache.org/download.cgi)

## 1. Install

To install the API client library to your local Maven repository, simply execute:

```shell shell theme={null}
mvn clean install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell shell theme={null}
mvn clean deploy
```

### Maven users

Add this dependency to your project's POM:

```xml POM theme={null}
<dependency>
  <groupId>io.sendx</groupId>
  <artifactId>sendx-java-sdk</artifactId>
  <version>1.0.1</version>
  <scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy theme={null}
  repositories {
    mavenCentral()  
    mavenLocal()       

  dependencies {
     implementation "io.sendx:sendx-java-sdk:1.0.1"
  }
```

### Others

At first generate the JAR by executing:

```shell theme={null}
mvn clean package
```

Then manually install the following JARs:

* `target/sendx-java-sdk-1.0.1.jar`
* `target/lib/*.jar`

## 2. Getting Started

```java Java theme={null}

// Import classes:
import sendx_java_sdk.ApiClient;
import sendx_java_sdk.ApiException;
import sendx_java_sdk.Configuration;
import sendx_java_sdk.auth.*;
import sendx_java_sdk.models.*;
import sendx_java_sdk.CampaignApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.sendx.io/api/v1/rest");
    
    // Configure API key authorization: apiKeyAuth
    ApiKeyAuth apiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("apiKeyAuth");
    apiKeyAuth.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //apiKeyAuth.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    ContactRequest contactRequest = new ContactRequest(); // ContactRequest | 
    contactRequest.setFirstName("John")
    contactRequest.setLastName("Doe")
    contactRequest.setEmail("john.doe@sendx.io")
    contactRequest.setCompany("SendX")
    contactRequest.setLastTrackedIp("32.342.12.322")

    // Set tags as a list of strings
    List<String> tags = Arrays.asList("sner1jin3ij34b4", "234bjk2n42ednj32";
    contactRequest.setTags(tags)

    try {
      OperationResponse result = apiInstance.createContact(contactRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CampaignApi#createCampaign");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

## 3. Try it for yourself

<Card title="Java Example" icon="arrow-up-right-from-square" href="https://github.com/sendx/sendx-java-sdk">
  See detailed sdk example
</Card>
