> For the complete documentation index, see [llms.txt](https://docs.sudoplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sudoplatform.com/guides/site-reputation/use-the-site-reputation-sdk.md).

# Use the Site Reputation SDK

## Querying Site Reputation

The **Site Reputation SDK** enables you to warn or guard your users from accessing low reputation websites. The `getSiteReputation` function of the SDK returns a `SiteReputation` structure with attributes you can use to form a decision on whether to block access to a site or display a warning to your users.

{% tabs %}
{% tab title="TypeScript" %}

```typescript
// const client = new SudoSiteReputationClient({...})

import {
  SiteReputation
} from '@sudoplatform/sudo-site-reputation'

let siteReputation: SiteReputation
try {
  siteReputation = client.getSiteReputation('https://sudoplatform.com')
  console.log(siteReputation.reputationStatus)
} catch (error) {
  // implement error handling
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
var client: SudoSiteReputationClient!

let uri = "http://www.wikipedia.com"
let result = try await instance.getSiteReputation(url: uri)
switch result.status {
case .notMalicious:
    break
case .malicious:
    break
case .unkown:
    break
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// val client: SudoSiteReputationClient

launch {
    try {
        val siteReputation = withContext(Dispatchers.IO) {
            client.getSiteReputation(
                url = "http://somedodgyhost.com/somewhere"
            )
        }
        if (badSite.status == SudoSiteReputation.MaliciousState.MALICIOUS) {
           System.out.println("This page is bad mkay")
        } 
    } catch (e: SudoSiteReputationException) {
        // Handle/notify user of exception
    }
}
```

{% endtab %}
{% endtabs %}

## SiteReputation Interface

{% tabs %}
{% tab title="Typescript" %}

```typescript
/**
 * The state of knowledge of a site's reputation.
 */
export type ReputationStatus = 'NOTMALICIOUS' | 'MALICIOUS' | 'UNKNOWN'

/**
 * The response of a given url's site reputation.
 */
export interface SiteReputation {
  /** Returns `MALICIOUS` if malicious, `NOTMALICIOUS` if not, and `UNKNOWN` if unable to be determined. */
  reputationStatus: ReputationStatus
}

```

{% endtab %}

{% tab title="Swift" %}

```swift
public struct SiteReputation {
    
    /// Search status
     public enum ReputationStatus {
         // URI not in dataset as not malicious
         case notMalicious
         // URI found in dataset as malicious
         case malicious
         // URI not found in the dataset
         case unkown
    }

    /// The returned result of the lookup for the site. If .success you can expect the other properties to be non nil.
    public let status: ReputationStatus
}
```

{% endtab %}

{% tab title="Kotlin" %}

<pre class="language-kotlin"><code class="lang-kotlin">public data class SiteReputation(
    /** status of the search */
    val status: ReputationStatus,
) : Parcelable {

    enum class ReputationStatus {
        /** site is <a data-footnote-ref href="#user-content-fn-1">known</a> to be malicious */
        MALICIOUS,
        /** site is not known to be malicious */
        NOTMALICIOUS,
        /** no site data available to make a determination */
        UNKNOWN
    }
}
</code></pre>

{% endtab %}
{% endtabs %}

[^1]:


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.sudoplatform.com/guides/site-reputation/use-the-site-reputation-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
