> For the complete documentation index, see [llms.txt](https://guardian.hedera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2.md).

# Policy Comments APIs (aka Complex Iterative Workflows)

These APIs enable collaborative document review within Guardian policies. Users can create discussion threads on policy documents, post messages, attach encrypted files, and inspect document relationships and schemas — all scoped to a specific policy and document.

**Authentication:** All endpoints require a Bearer token (`Authorization: Bearer <token>`). Obtain a token via `POST /api/v1/accounts/login`.

***

## Endpoint Index

### Policy Comments (`/api/v1/policy-comments`)

| Method     | Endpoint                                                                                  | Description                                        | Auth Required |
| ---------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------- | ------------- |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/users`                                          | Returns users with access to the document          | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/relationships`                                  | Returns documents linked to the target document    | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/schemas`                                        | Returns schemas applicable to the target document  | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/discussions`                                    | Returns discussion threads for the target document | Yes           |
| **`POST`** | `/policy-comments/{policyId}/{documentId}/discussions`                                    | Creates a new discussion thread                    | Yes           |
| **`POST`** | `/policy-comments/{policyId}/{documentId}/discussions/{discussionId}/comments`            | Creates a new message in a discussion              | Yes           |
| **`POST`** | `/policy-comments/{policyId}/{documentId}/discussions/{discussionId}/comments/search`     | Returns paginated messages for a discussion        | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/comments/count`                                 | Returns the total message count for a document     | Yes           |
| **`POST`** | `/policy-comments/{policyId}/{documentId}/discussions/{discussionId}/comments/file`       | Encrypts and uploads a file to IPFS                | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/discussions/{discussionId}/comments/file/{cid}` | Retrieves and decrypts a file from IPFS            | Yes           |
| **`GET`**  | `/policy-comments/{policyId}/{documentId}/keys`                                           | Returns private keys for the target document       | Yes           |

### Policy Repository (`/api/v1/policy-repository`)

| Method    | Endpoint                                  | Description                               | Auth Required |
| --------- | ----------------------------------------- | ----------------------------------------- | ------------- |
| **`GET`** | `/policy-repository/{policyId}/users`     | Returns user names present in the policy  | Yes           |
| **`GET`** | `/policy-repository/{policyId}/schemas`   | Returns schemas present in the policy     | Yes           |
| **`GET`** | `/policy-repository/{policyId}/documents` | Returns paginated documents in the policy | Yes           |

***

## Endpoints

### Policy Comments

* [Returns the List of Users with Access to a Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-user-names-which-are-present-in-the-target-policy-and-have-access-to-the-target.md)
* [Returns the List of Documents Linked with the Target Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-documents-linked-with-the-target-document.md)
* [Returns the List of Schemas for the Target Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-schemas-for-the-target-document.md)
* [Returns the List of Discussions for the Target Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-discussions-for-the-target-document.md)
* [Creates a New Discussion Linked to the Target Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/creates-a-new-discussion-linked-to-the-target-document.md)
* [Creates a New Message in the Target Discussion](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/creates-a-new-message-in-the-target-discussion.md)
* [Returns the List of Messages for the Target Discussion](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-messages-for-the-target-discussion.md)
* [Returns the Count of Messages in the Target Discussion](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-count-of-the-messages-in-the-target-discussion.md)
* [Encrypts and Loads the File into IPFS Linked to the Target Discussion](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/encrypts-and-loads-the-file-into-ipfs-linked-to-the-target-discussion.md)
* [Retrieves and Decrypts the File Associated with the Discussion from IPFS](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/retrieves-and-decrypts-the-file-associated-with-the-discussion-from-ipfs.md)
* [Returns the List of Private Keys for the Target Document](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-private-keys-for-the-target-document.md)

### Policy Repository

* [Returns the List of User Names Present in the Policy](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-user-names-which-are-present-in-the-policy.md)
* [Returns the List of Schemas Present in the Target Policy](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-schemas-present-in-the-target-policy.md)
* [Returns the List of Documents in the Target Policy](https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2/returns-the-list-of-documents-in-the-target-policy.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guardian.hedera.com/docs/3.7.0/developer-tools-and-resources/api-reference/apis-related-2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
