> 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/digital-account-protection/organization-analysis.md).

# Organization Analysis

The Privacy Interaction SDK allows analysis of an organization, specified by domain name, without association with a data holder.

An organization analysis contains a structured privacy analysis for an organization, keyed by its domain. Unlike an AnalysisResult which is tied to a specific virtual presence and data holder that you have discovered, an organization analysis is a shared, organization-generic view that any caller can request for any domain.

The same underlying analysis is returned to every caller asking about the same domain. It summarizes how an organization collects, retains, and shares user data based on their publicly available privacy policy and other documents, and carries only organization-generic signals.

## Retrieving an Organization Analysis

To retrieve the shared analysis for a domain, use the `getOrganizationAnalysis` method. This returns the organization analysis if one is available, or undefined if not found.

By default the call is a read-through: if no analysis is stored or the stored analysis is stale, the backend requests analysis from its sources. This work may be asynchronous, in which case the returned analysis has a `PENDING` status. Re-query for the terminal result.

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

```typescript
try {
  const organizationAnalysis =
    await privacyInteractionClient.getOrganizationAnalysis({
      domain: 'example.com',
    })

  if (organizationAnalysis) {
    console.log(organizationAnalysis.status)
    if (organizationAnalysis.data) {
      console.log(
        'Privacy score:',
        organizationAnalysis.data.privacyScore?.score,
      )
      console.log(
        'Summary:',
        organizationAnalysis.data.privacySummary.bulletPoints,
      )
    }
  }
} catch (error) {
  // Handle/notify user of errors
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
do {
    let organizationAnalysis = try await privacyInteractionClient.getOrganizationAnalysis(
        withInput: GetOrganizationAnalysisInput(domain: "example.com")
    )

    if let organizationAnalysis {
        print(organizationAnalysis.status)
        if let data = organizationAnalysis.data {
            print("Privacy score:", data.privacyScore?.score ?? "n/a")
            print("Summary:", data.privacySummary.bulletPoints)
        }
    }
} catch {
    // Handle/notify user of errors
}

```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
launch {
    try {
        val organizationAnalysis = withContext(Dispatchers.IO) {
            privacyInteractionClient.getOrganizationAnalysis(
                GetOrganizationAnalysisInput(domain = "example.com"),
            )
        }
        if (organizationAnalysis != null) {
            println(organizationAnalysis.status)
            val data = organizationAnalysis.data
            if (data != null) {
                println("Privacy score: ${data.privacyScore?.score}")
                println("Summary: ${data.privacySummary.bulletPoints}")
            }
        }
    } catch (e: AnalysisResultException) {
        // Handle/notify user of errors
    }
} 
```

{% endtab %}
{% endtabs %}

The `data` field is populated when the status is `COMPLETE` or `PARTIAL`. For the full structure of `data` including privacy score, summary, category signals, capabilities, risk indicators, and more, see [Analysis Data](/guides/digital-account-protection/analysis-data.md).

**Input Parameters:**

| Parameter | Type   | Required | Description                                                                                  |
| --------- | ------ | -------- | -------------------------------------------------------------------------------------------- |
| `domain`  | string | Yes      | The domain to analyze (for example, `example.com`).                                          |
| `mode`    | enum   | No       | How to obtain source results. When omitted, the backend behaves as `ANALYZE` (read-through). |

#### Organization Analysis Mode

The `mode` parameter controls how `getOrganizationAnalysis` obtains source results when the stored analysis is stale or absent.

| Mode      | Description                                                                                                                                                          |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ANALYZE` | Read-through. Requests analysis from the sources, which may compute and leave the result `PENDING` until asynchronous work completes. This is the default behaviour. |
| `FETCH`   | Pull only the sources' existing values; never request new work. A stale domain with no existing source value is not moved to `PENDING`.                              |

Use `FETCH` when you want a fast, best-effort read of what is already known and do not want to trigger new analysis work:

#### Organization Analysis Object

| Property         | Type                            | Description                                                                                                                                           |
| ---------------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`             | string                          | Unique identifier for the shared analysis. Equal to the analyzed domain.                                                                              |
| `domain`         | string                          | The analyzed domain (equal to `id`).                                                                                                                  |
| `status`         | AnalysisResultStatus            | Aggregate status of the analysis. See [Analysis Status](/guides/digital-account-protection/analysis-data.md#analysis-status).                         |
| `lastAnalyzedAt` | Date                            | When the aggregate was last derived.                                                                                                                  |
| `data`           | AnalysisResultData \| undefined | Structured analysis data, populated when status is `COMPLETE` or `PARTIAL`. See [Analysis Data](/guides/digital-account-protection/analysis-data.md). |
| `owner`          | string                          | The caller who requested this view. The underlying analysis is shared.                                                                                |
| `version`        | number                          | Entity version, increments on update.                                                                                                                 |
| `createdAt`      | Date                            | When the analysis was created.                                                                                                                        |
| `updatedAt`      | Date                            | When the analysis was last updated.                                                                                                                   |
