Naar de hoofdinhoud

Tolkie Text Simplification API

Overview

The simplify text endpoint rewrites long-form content (for example news articles or policy pages) into A2-level Dutch aimed at low-literacy adult readers. The output is structured like a short news article: title, introduction, and up to several paragraphs with headings.

This endpoint lives on the v1 public API (not /api/v2/).

Method

POST

Path

/api/v1/tolkie/simplify_text

Full URL example

Authentication

Send your client API token on every request:

Authorization: Token <your_api_token>

Content-Type: application/json

Status

Meaning

401 Unauthorized

Missing or invalid token

404 Not Found

Token is valid but no Tolkie client is linked to that user

Unlike most /api/v2/ widget endpoints, this view does not apply CheckOriginPermission. You do not need an Origin header or url_field in the body for authorization. (Your integration may still send Origin for CORS in the browser; it is not part of the server-side permission check for this route.)

Request body

Field

Type

Required

Description

text

string

Yes

Full source text to simplify

Validation rules

  • Minimum length: 250 characters (shorter input returns 400).

  • The text must be non-empty after trimming (empty or whitespace-only input can yield 500 from the simplification step).

Correlation ID

Responses include X-Request-ID. You may send:

X-Request-ID: your-tracking-id-123

(1–64 characters: letters, digits, hyphen.) Validation error bodies may include "request_id" with the same value.

Example request

POST /api/v1/tolkie/simplify_text
Authorization: Token abc123...
Content-Type: application/json
{
"text": "Hier volgt een lang artikel of paginatekst met minstens 250 tekens. De inhoud beschrijft wat er is gebeurd, wie erbij betrokken was, en waarom het relevant is voor de lezer. ..."
}

Success response — 200 OK

The response is JSON produced from a structured news article model. Fields:

Field

Type

Description

title

string

Short, clear headline

intro

string

2–3 sentences summarizing the main news

paragraphs

array

Up to several sections (prompt targets max ~5)

paragraphs[].heading

string

Section heading (short, sentence-style)

paragraphs[].text

string

Section body (short sentences, A2 rules)

Example response

{
"title": "Grote brand in centrum",
"intro": "Er is gisteravond brand geweest in het centrum. Niemand raakte gewond. De politie onderzoekt de oorzaak.",
"paragraphs": [
{
"heading": "De brand begon in een winkel.",
"text": "Om 22:00 uur zagen mensen rook. De brandweer kwam snel. Na 1 uur was het vuur uit."
},
{
"heading": "De winkel blijft dicht.",
"text": "De eigenaar mag nog niet naar binnen. De schade is groot."
}
]
}

Exact wording and section count depend on the input and on your client’s configured prompts.

Simplification behaviour

  • Language level: Content is rewritten toward CEFR A2 (simple vocabulary, short sentences, active voice, no idioms).

  • Structure: Output follows title → intro → paragraphs (not a flat string list).

  • Faithfulness: Prompts instruct the model to keep facts, quotes, names, and numbers accurate; quotes should stay literal where applicable.

Error responses

400 Bad Request — validation

Missing text or text shorter than 250 characters:

{
"text": ["Text must be at least 250 characters long."]
}

DRF validation responses may also include request_id when correlation headers are used (see below).

404 Not Found — client missing

{
"error": "Client not found."
}
Was dit een antwoord op uw vraag?