---
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

---

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