---
title: "Returns the character & token-level positions needed for creating SpanAnnotations."
method: POST
path: "/search_annotate/auto_annotate"
tags: ["search_annotate"]
---

# Returns the character & token-level positions needed for creating SpanAnnotations.

`POST /search_annotate/auto_annotate`

## Query parameters

- `project_id` integer, required
- `query` string, required

## Response `200`

Successful Response

- PaginatedSpanAnnotationHits
  - `total_results` integer, required — The total number of SpanAnnotation hits. Used for pagination.
  - `hits` SpanAnnotationHit[], required — The SpanAnnotation hits matching the search query.
    - `span_dto` SpanAnnotationCreate, required
      - `begin` integer, required — Begin of the SpanAnnotation in characters
      - `end` integer, required — End of the SpanAnnotation in characters
      - `begin_token` integer, required — Begin of the SpanAnnotation in tokens
      - `end_token` integer, required — End of the SpanAnnotation in tokens
      - `span_text` string, required — The SpanText the SpanAnnotation spans.
      - `code_id` integer, required — Code the SpanAnnotation refers to
      - `sdoc_id` integer, required — SourceDocument the SpanAnnotation refers to
    - `before_context` string, required — The context before the span.
    - `after_context` string, required — The context after the span.

## Other responses

- `422` — Validation Error

## Changes

- **2026-07-15** `1af5a8046f20` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2026-06-08** `da351e9a3d14` — 1 info
  - endpoint added
- **2025-08-22** `53e769440a25` — 1 breaking
  - api path removed without deprecation

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