---
title: "Returns data for visualizing the documents of the given aspect."
method: POST
path: "/perspectives/visualize_documents/{aspect_id}"
tags: ["perspectives"]
---

# Returns data for visualizing the documents of the given aspect.

`POST /perspectives/visualize_documents/{aspect_id}`

## Path parameters

- `aspect_id` integer, required

## Query parameters

- `search_query` string, required

## Request body

- BodyPerspectivesVisualizeDocuments
  - `filter` FilterSdocColumnsInput, required
    - `id` string, required
    - `items` union[], required
      - union
        - FilterExpressionSdocColumns
          - `id` string, required
          - `column` union, required
            - 'SD_SOURCE_DOCUMENT_TYPE' | 'SD_SOURCE_DOCUMENT_NAME' | 'SD_TAG_ID_LIST' | 'SD_CODE_ID_LIST' | 'SD_USER_ID_LIST' | 'SD_SPAN_ANNOTATIONS'
            - integer
          - `operator` union, required
            - 'ID_EQUALS' | 'ID_NOT_EQUALS'
            - 'NUMBER_EQUALS' | 'NUMBER_NOT_EQUALS' | 'NUMBER_GT' | 'NUMBER_LT' | 'NUMBER_GTE' | 'NUMBER_LTE'
            - 'STRING_CONTAINS' | 'STRING_EQUALS' | 'STRING_NOT_EQUALS' | 'STRING_STARTS_WITH' | 'STRING_ENDS_WITH'
            - 'ID_LIST_CONTAINS' | 'ID_LIST_NOT_CONTAINS'
            - 'LIST_CONTAINS' | 'LIST_NOT_CONTAINS'
            - 'DATE_EQUALS' | 'DATE_GT' | 'DATE_LT' | 'DATE_GTE' | 'DATE_LTE'
            - 'BOOLEAN_EQUALS' | 'BOOLEAN_NOT_EQUALS'
          - `value` union, required
            - boolean
            - string
            - integer
            - string[]
            - array[]
              - …
        - FilterSdocColumnsInput — recursive
    - `logic_operator` 'or' | 'and', required — This tells our filter how to combine multiple column expressions.
  - `sorts` SortSdocColumns[], required
    - `column` union, required
      - 'SD_SOURCE_DOCUMENT_TYPE' | 'SD_SOURCE_DOCUMENT_NAME' | 'SD_TAG_ID_LIST' | 'SD_CODE_ID_LIST' | 'SD_USER_ID_LIST' | 'SD_SPAN_ANNOTATIONS'
      - integer
    - `direction` 'asc' | 'desc', required

## Response `200`

Successful Response

- PerspectivesVisualization
  - `aspect_id` integer, required — ID of the aspect this visualization belongs to
  - `clusters` ClusterRead[], required — List of clusters in the visualization
    - `id` integer, required — ID of the cluster
    - `aspect_id` integer, required — ID of the aspect this cluster belongs to
    - `parent_cluster_id` integer, nullable, required — ID of the parent cluster, if any
    - `is_outlier` boolean, required — Whether the cluster is an outlier
    - `name` string, required — Name of the cluster
    - `description` string, required — Description of the cluster
    - `level` integer, required — Hierarchical level of the cluster
    - `x` number, required — X coordinate for visualization
    - `y` number, required — Y coordinate for visualization
    - `top_words` string[], nullable, required — Top words associated with the cluster
    - `top_word_scores` number[], nullable, required — Scores of the top words
    - `top_docs` integer[], nullable, required — IDs of top documents for the cluster
  - `docs` PerspectivesDoc[], required — List of documents in the visualization
    - `sdoc_id` integer, required — ID of the source document
    - `cluster_id` integer, required — ID of the cluster this document belongs to
    - `x` number, required — X coordinate of the document in the visualization
    - `y` number, required — Y coordinate of the document in the visualization
    - `is_accepted` boolean, required — Indicates whether the document<->cluster assignment is accepted by a user
    - `in_searchresult` boolean, required — Indicates whether the document is part of the search result
    - `is_outlier` boolean, required — Indicates whether the document is an outlier

## Other responses

- `422` — Validation Error

## Changes

- **2025-09-18** `c5b78916c4e5` — 2 breaking, 2 info
  - removed the enum value `SD_SOURCE_DOCUMENT_FILENAME` of the request property `filter/items/items/anyOf[subschema #1: FilterExpression[SdocColumns]]/column/anyOf[subschema #1: SdocColumns]/`
  - removed the enum value `SD_SOURCE_DOCUMENT_FILENAME` of the request property `sorts/items/column/anyOf[subschema #1: SdocColumns]/`
  - added the new `SD_SOURCE_DOCUMENT_NAME` enum value to the request property `filter/items/items/anyOf[subschema #1: FilterExpression[SdocColumns]]/column/anyOf[subschema #1: SdocColumns]/`
  - added the new `SD_SOURCE_DOCUMENT_NAME` enum value to the request property `sorts/items/column/anyOf[subschema #1: SdocColumns]/`
- **2025-08-22** `53e769440a25` — 2 breaking, 2 warning, 2 info
  - removed the enum value `SD_SOURCE_DOCUMENT_NAME` of the request property `filter/items/items/anyOf[subschema #1: FilterExpression[SdocColumns]]/column/anyOf[subschema #1: SdocColumns]/`
  - removed the enum value `SD_SOURCE_DOCUMENT_NAME` of the request property `sorts/items/column/anyOf[subschema #1: SdocColumns]/`
  - removed the optional property `detail/items/ctx` from the response with the `422` status
  - removed the optional property `detail/items/input` from the response with the `422` status
  - …2 more

[Change history](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api/changes/perspectives/visualize_documents/:aspect_id/post.md)

---

[API](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api.md) · [All operations](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/uhh-lt/discourse-analysis-tool-suite-api/revisions/bf20656dfc4d/schema)
