---
title: "Perform word frequency analysis."
method: POST
path: "/word_frequency/analysis"
tags: ["word_frequency"]
---

# Perform word frequency analysis.

`POST /word_frequency/analysis`

## Query parameters

- `project_id` integer, required
- `page` integer, required
- `page_size` integer, required

## Request body

- BodyWordFrequencyWordFrequencyAnalysis
  - `filter` FilterWordFrequencyColumns, required
    - `id` string, required — Unique id of this node within the filter tree
    - `items` union[], required — Child expressions and/or nested filter nodes
      - union
        - FilterExpressionWordFrequencyColumns
          - `id` string, required — Unique id of this expression within the filter tree
          - `column` union, required — The column to filter on: an enum member, or an int id referring to a project-metadata column
            - 'WF_WORD' | 'WF_WORD_FREQUENCY' | 'WF_WORD_PERCENT' | 'WF_SOURCE_DOCUMENT_FREQUENCY' | 'WF_SOURCE_DOCUMENT_PERCENT' | 'WF_SOURCE_DOCUMENT_NAME' | 'WF_TAG_ID_LIST_RECURSIVE' | 'WF_CODE_ID_LIST_RECURSIVE' | 'WF_FOLDER_ID_LIST_RECURSIVE' | 'WF_USER_ID_LIST' | 'WF_SPAN_ANNOTATIONS'
            - integer
          - `operator` union, required — The comparison operator applied to the column
            - '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'
            - 'IDLR_CONTAINS' | 'IDLR_NOT_CONTAINS' | 'IDLR_CONTAINS_RECURSIVE'
            - 'LIST_CONTAINS' | 'LIST_NOT_CONTAINS'
            - 'DATE_EQUALS' | 'DATE_GT' | 'DATE_LT' | 'DATE_GTE' | 'DATE_LTE'
            - 'BOOLEAN_EQUALS' | 'BOOLEAN_NOT_EQUALS'
            - 'ATTACHED_OBJECT_TYPE_EQUALS' | 'ATTACHED_OBJECT_TYPE_NOT_EQUALS' — Filters on the attached object's type (a single AttachedObjectType value).
            - 'ATTACHED_OBJECT_EQUALS' | 'ATTACHED_OBJECT_NOT_EQUALS' — Compares an attached object as a (type, id) pair. The column is a tuple ``(type_expr, id_expr)`` and the value is a two-element list ``[type, id]`` (e.g. ``["tag", "5"]``). Filtering by the raw id alone is meaningless because ids collide across entity types (tag 5, code 5, sdoc 5 are different objects), so the type is always part of the comparison.
            - 'SPAN_ANNOTATION_CONTAINS' | 'SPAN_ANNOTATION_NOT_CONTAINS' — Filters by a single span annotation, given as a [code_id, span_text] pair. The column is an aggregated 2-D array of ``[code_id, span_text]`` string pairs (e.g. ``subquery_dict.SPAN_ANNOTATIONS``), so membership is tested by checking whether the pair is an element of that array.
          - `value` union, required — The value the column is compared against
            - boolean
            - string
            - integer
            - string[]
            - array[]
              - …
        - FilterWordFrequencyColumns — recursive
    - `logic_operator` 'or' | 'and', required — This tells our filter how to combine multiple column expressions.
  - `sorts` SortWordFrequencyColumns[], required
    - `column` union, required — The column to sort by: an enum member, or an int id referring to a project-metadata column
      - 'WF_WORD' | 'WF_WORD_FREQUENCY' | 'WF_WORD_PERCENT' | 'WF_SOURCE_DOCUMENT_FREQUENCY' | 'WF_SOURCE_DOCUMENT_PERCENT' | 'WF_SOURCE_DOCUMENT_NAME' | 'WF_TAG_ID_LIST_RECURSIVE' | 'WF_CODE_ID_LIST_RECURSIVE' | 'WF_FOLDER_ID_LIST_RECURSIVE' | 'WF_USER_ID_LIST' | 'WF_SPAN_ANNOTATIONS'
      - integer
    - `direction` 'asc' | 'desc', required — Sort direction. `apply` appends `.nulls_last()` so rows missing a value sink to the bottom regardless of direction.

## Response `200`

Successful Response

- WordFrequencyResult
  - `total_results` integer, required — The total number of word_frequencies. Used for pagination.
  - `sdocs_total` integer, required — The total number of SourceDocuments.
  - `words_total` integer, required — The total number of words.
  - `word_frequencies` WordFrequencyStat[], required — The WordFrequencies.
    - `word` string, required — The word.
    - `word_percent` number, required — The percentage of the word.
    - `count` integer, required — The SourceDoument IDs.
    - `sdocs` integer, required — The number of SourceDocuments.
    - `sdocs_percent` number, required — The percentage of SourceDocuments.

## Other responses

- `422` — Validation Error

## Changes

- **2026-08-20** `28b2f0e8bc01` — 1 info
  - added `#/components/schemas/AttachedObjectTypeOperator, #/components/schemas/AttachedObjectOperator, #/components/schemas/SpanAnnotationOperator` to the `filter/items/items/anyOf[subschema #1: FilterExpression[WordFrequencyColumns]]/operator` request property `anyOf` list
- **2026-07-21** `ebfa22e4da0a` — 2 info
  - added the new `WF_FOLDER_ID_LIST_RECURSIVE` enum value to the request property `filter/items/items/anyOf[subschema #1: FilterExpression[WordFrequencyColumns]]/column/anyOf[subschema #1: WordFrequencyColumns]/`
  - added the new `WF_FOLDER_ID_LIST_RECURSIVE` enum value to the request property `sorts/items/column/anyOf[subschema #1: WordFrequencyColumns]/`
- **2026-07-20** `01c6f5cdc4f3` — 4 breaking, 5 info
  - removed the enum value `WF_CODE_ID_LIST` of the request property `filter/items/items/anyOf[subschema #1: FilterExpression[WordFrequencyColumns]]/column/anyOf[subschema #1: WordFrequencyColumns]/`
  - removed the enum value `WF_CODE_ID_LIST` of the request property `sorts/items/column/anyOf[subschema #1: WordFrequencyColumns]/`
  - removed the enum value `WF_TAG_ID_LIST` of the request property `filter/items/items/anyOf[subschema #1: FilterExpression[WordFrequencyColumns]]/column/anyOf[subschema #1: WordFrequencyColumns]/`
  - removed the enum value `WF_TAG_ID_LIST` of the request property `sorts/items/column/anyOf[subschema #1: WordFrequencyColumns]/`
  - …5 more
- …earlier changes not shown

[Full history](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api/changes/word_frequency/analysis/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/a84d27ef7a0d/schema)
