---
title: "Shortens each context to the parts relevant to its question, returning results in input order."
method: POST
path: "/datasets/shorten-context"
tags: ["ContextShortening"]
---

# Shortens each context to the parts relevant to its question, returning results in input order.

`POST /datasets/shorten-context`

Results are cached per (context, question, prompt version), so repeated requests do not re-call the model.

## Request body

- ShortenContextEndpointInput — The input for the shorten-context endpoint.
  - `items` ShortenContextEndpointInputItem[], required — The context/question pairs to shorten.
    - `context` string, required
    - `question` string, required

## Response `200`

OK

- ShortenContextEndpointOutput — The shortened contexts, in the same order as the input items.
  - `items` ShortenContextEndpointOutputItem[], required — The shortened contexts.
    - `shortenedContext` string, required

## Other responses

- `400` — Bad Request
- `401` — Unauthenticated
- `403` — Forbidden

---

[API](https://skmtc.net/rapidata/apis/rapidata-api.md) · [All operations](https://skmtc.net/rapidata/apis/rapidata-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/rapidata/rapidata-api/revisions/d779de93a5ee/schema)
