---
title: extraction_policy operations
---

The exact fields each `extraction_policy.*` operation takes and returns.

<!-- Generated by `python scripts/codegen/docs_reference.py` from the op registry; edit the models, not this page. -->

Every op is `POST /v1/<op>` over HTTP and the MCP tool `loom_<op>`. The identity fields (`org`, `namespace`, `agent`, `user_id`, `session_id`) are filled from the token and the MCP session when a transport can; for an HTTP call with no token on a single-user server, the install's org on every op but `code.*` and `tracker.*` (which keep their plane's), and on [some ops](/reference/http-api#request) its namespace and agent; see [identities and namespaces](/concepts/identities-and-namespaces). The [operations index](/reference/operations) explains role, kind and the MCP `all` listing. Unknown input fields are served and named in `ignored_args`.

<!-- prettier-ignore-start -->

## `extraction_policy.clear`

Remove the scope's policy.

`POST /v1/extraction_policy.clear` · MCP `loom_extraction_policy_clear` · role `org_admin` · idempotent · audited · not listed under the MCP `all` toolset

| Input field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `org` | `str` | required | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | required | `org` removes the org's own policy; `namespace` removes that namespace's, leaving the org's in force. |
| `namespace` | `str` | `''` | The namespace whose policy to remove; ignored for scope `org`. |

| Output field | Type | Meaning |
| --- | --- | --- |
| `org` | `str` | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | `org` or `namespace`, as asked. |
| `namespace` | `str` | The namespace for scope `namespace`; "" for scope `org`. |
| `policy` | `str` | This scope's policy; "" when none is set. |
| `updated_by` | `str` | Who set it; "" when none is set. |
| `updated_at` | `datetime \| None` | When it was set (UTC); None when none is set. |
| `effective` | `str` | What extractions in this scope run under: the org's policy, then the namespace's; "" when neither is set. |
| `namespace_policies` | `list[NamespacePolicy]` | For scope `org`: every namespace of the org that holds a policy of its own, by name, including a deleted namespace's, which still counts toward LOOM_EXTRACTION_POLICY_MAX_NAMESPACES until it is cleared. |

## `extraction_policy.get`

The scope's policy and the one its extractions run under.

`POST /v1/extraction_policy.get` · MCP `loom_extraction_policy_get` · role `org_admin` · idempotent · not listed under the MCP `all` toolset

| Input field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `org` | `str` | required | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | required | `org` reads the org's own policy; `namespace` reads `namespace`'s. |
| `namespace` | `str` | `''` | The namespace whose policy to read; ignored for scope `org`. |

| Output field | Type | Meaning |
| --- | --- | --- |
| `org` | `str` | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | `org` or `namespace`, as asked. |
| `namespace` | `str` | The namespace for scope `namespace`; "" for scope `org`. |
| `policy` | `str` | This scope's policy; "" when none is set. |
| `updated_by` | `str` | Who set it; "" when none is set. |
| `updated_at` | `datetime \| None` | When it was set (UTC); None when none is set. |
| `effective` | `str` | What extractions in this scope run under: the org's policy, then the namespace's; "" when neither is set. |
| `namespace_policies` | `list[NamespacePolicy]` | For scope `org`: every namespace of the org that holds a policy of its own, by name, including a deleted namespace's, which still counts toward LOOM_EXTRACTION_POLICY_MAX_NAMESPACES until it is cleared. |

## `extraction_policy.set`

Set the scope's policy, replacing the one it held.

`POST /v1/extraction_policy.set` · MCP `loom_extraction_policy_set` · role `org_admin` · idempotent · audited · not listed under the MCP `all` toolset

| Input field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `org` | `str` | required | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | required | `org` sets the org's own policy, which every namespace follows (`namespace` ignored); `namespace` sets the rules that namespace adds to it. |
| `namespace` | `str` | `''` | The namespace a `namespace`-scoped policy is for; ignored for scope `org`. |
| `policy` | `str` | required | The rules in plain language, at most 4,096 characters; replaces the scope's policy. |

| Output field | Type | Meaning |
| --- | --- | --- |
| `org` | `str` | The tenant (first element of the identity tuple). |
| `scope` | `Literal['org', 'namespace']` | `org` or `namespace`, as asked. |
| `namespace` | `str` | The namespace for scope `namespace`; "" for scope `org`. |
| `policy` | `str` | This scope's policy; "" when none is set. |
| `updated_by` | `str` | Who set it; "" when none is set. |
| `updated_at` | `datetime \| None` | When it was set (UTC); None when none is set. |
| `effective` | `str` | What extractions in this scope run under: the org's policy, then the namespace's; "" when neither is set. |
| `namespace_policies` | `list[NamespacePolicy]` | For scope `org`: every namespace of the org that holds a policy of its own, by name, including a deleted namespace's, which still counts toward LOOM_EXTRACTION_POLICY_MAX_NAMESPACES until it is cleared. |

<!-- prettier-ignore-end -->
