> For the complete documentation index, see [llms.txt](https://squareplugins.gitbook.io/sentry/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://squareplugins.gitbook.io/sentry/api/usage.md).

# API Usage

Sentry provides an API for developers who need to interact with player security data, check for active detections, or manage player sessions programmatically.

***

## Getting started

To use the Sentry API in your project, add the JitPack repository and the dependency to your build configuration.

Replace `LATEST` with the latest API [release from here](https://github.com/drawned/sentry/releases/latest).

### Gradle (build.gradle)

Add the JitPack repository to your `repositories` block:

```gradle
repositories {
    maven { url = 'https://jitpack.io' }
}
```

Add the dependency:

```gradle
dependencies {
    compileOnly 'com.github.drawned.sentry:api:LATEST'
}
```

### Maven (pom.xml)

Add the JitPack repository to your `repositories` block:

```xml
<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
```

Add the dependency:

```xml
<dependency>
    <groupId>com.github.drawned.sentry</groupId>
    <artifactId>api</artifactId>
    <version>LATEST</version>
    <scope>provided</scope>
</dependency>
```

***

## Usage

You can access the main management interface through the [SentryAPI](https://github.com/drawned/sentry/blob/master/api/src/main/java/dev/square/api/SentryAPI.java) class.

Example to retrieve a player's security instance:

```java
import dev.square.api.SentryAPI;
import dev.square.api.player.SentryPlayer;

// Retrieving a player instance
SentryPlayer sentryPlayer = SentryAPI.getPlayerManager().get(player);
if (sentryPlayer != null) {
    // Perform your checks
}
```

Make sure that your plugin loads after Sentry by adding `depend: [Sentry]` (or `softdepend: [Sentry]`) to your `plugin.yml` file.

***

## API Methods

The API is open source, you can view all possible methods and classes here:

<a href="https://github.com/drawned/sentry/tree/master/api" class="button primary" data-icon="rectangle-api">GitHub</a>
