> 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>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://squareplugins.gitbook.io/sentry/api/usage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
