> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Governance API Overview

> Read each agent's review and compliance status, and turn an agent off or back on with a stored reason.

Read the review and compliance status of the agents in your workspace, and turn an agent off or back on with a stored reason. Use it when a ticketing tool or another system needs to react to that status. The API does not return an agent's instructions, conversations, documents, or action results. For conversation content and tool results, use the [Compliance API](https://docs.langdock.com/en/developer/compliance-api/export-tool-results.md).

## Before You Start

* **Governance is on**: Turn on **Enable Governance** in [Settings > Workspace > Products > Governance](https://app.langdock.com/settings/workspace/products/governance).
* **API key scope**: A workspace admin creates a workspace API key with the `GOVERNANCE_API` scope in [Settings > Workspace > Products > API](https://app.langdock.com/settings/workspace/products/api). In the key form this scope is **Governance API**, and it is available only when Governance is on. Turning it on asks the admin to confirm that anyone with the key can read governance status and disable agents, even without access to Governance. Personal API keys cannot hold this scope.

The workspace comes from the API key. You do not send a workspace id.

## Base URL

```
https://api.langdock.com
```

> [!WARNING]
>
> **Dedicated deployments**
>
> Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.

## Authentication

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Available Endpoints

| Method | Endpoint | Description |
| - | - | - |
| `GET` | `/governance/v1/agents` | [List agents](https://docs.langdock.com/en/developer/governance-api/list-agents.md) |
| `GET` | `/governance/v1/agents/{agentId}` | [Get an agent](https://docs.langdock.com/en/developer/governance-api/get-agent.md) |
| `PATCH` | `/governance/v1/agents/{agentId}/disable` | [Disable or re-enable an agent](https://docs.langdock.com/en/developer/governance-api/disable-agent.md) |

Archived agents and agent templates are left out. If **Hide private resources in Governance** is on, agents that have not been shared with anyone else are left out as well. Get and disable then return `404` for those agents.

## The agent object

List, get, and disable all return this object. List wraps it in `agents`. Get and disable wrap one object in `agent`.

| Field | Description |
| - | - |
| `id` | Agent UUID |
| `name` | Agent name, or null |
| `description` | Agent description, or null |
| `createdAt` | When the agent was created, or null |
| `updatedAt` | When the agent was last updated, or null |
| `owner` | `{ id, name, email }` for the current owner, or null. `name` can be null |
| `verified` | `true` when the agent is verified |
| `disabled` | `true` when the agent is turned off |
| `disabledAt` | When it was turned off, or null |
| `disabledReason` | Reason stored while it is off, or null |
| `reviewStatus` | Latest review decision for the current version |
| `complianceStatus` | Roll-up of the enforced compliance rules |
| `complianceRules` | Latest result for each enforced rule that has run |

`reviewStatus` is `pending_review` when nobody has decided yet. After a decision it is `approved`, `internal_flag`, or `rejected`.

`complianceStatus` is one of:

| Value | Meaning |
| - | - |
| `high_risk` | A `HIGH` or `CRITICAL` rule is `FAILING` |
| `potentially` | A `LOW` or `MEDIUM` rule is `FAILING`, and no `HIGH` or `CRITICAL` rule is `FAILING` |
| `not_high_risk` | Every rule that has a verdict is `PASSING` |
| `not_checked` | No rule has a `PASSING` or `FAILING` result yet |

`RUNNING` and `ERROR` are not verdicts. They do not by themselves mark an agent `high_risk` or `potentially`.

Each item in `complianceRules` has `ruleId`, `ruleName`, `severity` (`LOW`, `MEDIUM`, `HIGH`, `CRITICAL`), `status` (`RUNNING`, `PASSING`, `FAILING`, `ERROR`), `reasoning`, and `evaluatedAt`. Disabled and deleted rules are omitted. You only get the latest result for each rule.

## Polling

There is no webhook. Poll [List agents](https://docs.langdock.com/en/developer/governance-api/list-agents.md).

`updatedSince` filters on the agent's `updatedAt`. A compliance rule can finish later, without changing that timestamp. A poll that only uses `updatedSince` can see a rule as `RUNNING` and miss the later `FAILING` result.

* **Flagged agents.** Call the list with `complianceStatus=high_risk,potentially` and no `updatedSince`. Track each rule's `evaluatedAt` so you only act once. The API returns the latest result for each rule, so a result that was replaced between polls is no longer available.
* **New or edited agents.** Set `updatedSince` to the start of your previous run. If a returned rule is `RUNNING`, call [Get an agent](https://docs.langdock.com/en/developer/governance-api/get-agent.md) until every rule has left `RUNNING`.

## Errors

| Status | Meaning |
| - | - |
| `400` | Invalid query, path, or body. The message is `Invalid query parameters`, `Invalid path parameters`, or `Invalid request data` |
| `401` | Missing or invalid API key |
| `403` | The key lacks `GOVERNANCE_API`, or Governance is off. When Governance is off the message is `Governance is not enabled for this workspace` |
| `404` | `Agent not found`. The agent is not available in this workspace |
| `429` | More than 500 requests per minute for this workspace and API key. No token limit applies |
| `500` | Internal server error |

> [!NOTE]
>
> Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](https://docs.langdock.com/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.