# Documentation

<figure><picture><source srcset="/files/LvXYZo0uYCiEgUYPqrsD" media="(prefers-color-scheme: dark)"><img src="/files/Om6YuiUgNAFnYPImvcVR" alt=""></picture><figcaption></figcaption></figure>

<h4 align="center">Advanced fraud detection and risk assessment for modern applications</h4>

<p align="center">Detect bots, VPNs, browser tampering, and suspicious behaviour with enterprise-grade accuracy.</p>

<p align="center"></p>

{% columns %}
{% column width="50%" %}

### Stop fraud before it costs you

Built for teams who can't afford to get security wrong. Crystal-clear endpoints, proven examples, and rock-solid authentication get you from zero to protected in one commit.

**Deploy fast. Sleep better.**

<a href="/spaces/aQpbYgAyZEBrDPFZtNaq" class="button primary" data-icon="rocket-launch">Get started</a> <a href="/spaces/WdkycQNlII5Zn99VIAkw" class="button secondary" data-icon="terminal">Help Center</a>
{% endcolumn %}

{% column width="50%" %}
{% code title="Your Frontend" overflow="wrap" %}

```javascript
// frontend/guardian.ts
import { loadAgent } from '@guardianstack/guardian-js';

// 1) Initialize once at app startup
const guardian = await loadAgent({
  siteKey: 'site_XXXXXXXX',
});

// 2) Trigger an identification exactly where it matters (login, signup, checkout)
const res = await guardian.get();

// 3) Extract the requestId and send it to your backend for risk evaluation
const requestId = res?.requestId;

```

{% endcode %}

{% code title="Your Backend" overflow="wrap" %}

```javascript
// server/guardian.ts
import { createGuardianClient } from '@guardianstack/guardianjs-server';

// 1) Create the server client with your secret (server-only; never expose in the browser)
const guardian = createGuardianClient({ secret: 'sec_XXXXXXXX' });

// 2) Fetch the processed event by requestId (includes IP intel + detections)
const event = await guardian.getEvent(requestId);

// 3) Make a simple allow/deny decision based on detections
const risky = Boolean(
  event.botDetection?.detected ||
  event.tampering?.detected ||
  event.virtualization?.detected ||
  event.incognito?.detected ||
  event.privacySettings?.detected ||
  event.vpn?.detected
);

if (risky) { 
  /* High risk: deny or require step-up (CAPTCHA/OTP/KYC) */ 
} else { 
  /* Low risk: proceed */ 
}
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

<h3 align="center">Learn more about Guardian</h3>

<p align="center">Transform from integration to expertise with in-depth guides, advanced techniques, and the security patterns that keep the bad actors out and your users protected.</p>

<p align="center"> <a href="/spaces/aQpbYgAyZEBrDPFZtNaq" class="button primary" data-icon="book">Documentation</a></p>

<h2 align="center"></h2>

<h2 align="center"></h2>


---

# Agent Instructions: 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://docs.guardianstack.ai/readme.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.
