Introduction
Welcome to the Duden Correction Api Docs
We are currently providing two versions of our correction service.
| Version | Description |
|---|---|
v1 |
As used at mentor.duden.de |
v2 |
AI-based correction and paraphrasing with asynchronous delivery of the result to your callback URL |
Contact us if you want to know more about the service, its components and/or our roadmap in general.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
-H "x-api-key: cR4zy5EcUR34p1k3y"
url = "api_endpoint_here"
headers = {
"x-api-key" : "cR4zy5EcUR34p1k3y"
}
Make sure to replace
cR4zy5EcUR34p1k3ywith your API key.
Duden Correction Api uses API keys to allow access to the API. You can apply for an api key by sending an email to florian.puehs@duden.de
We expect the API key to be included in all API requests to the server in a header that looks like the following:
x-api-key: cR4zy5EcUR34p1k3y
v1
/spellcheck
curl -X POST 'https://api.duden.de/v1/spellcheck' \
-H 'x-api-key: cR4zy5EcUR34p1k3y' \
-H 'Content-Type: application/json' \
-d '{
"text":"Ein Schif, in einer kleineren Form auch Boot genannt ist ein Wasserfahrzeuk, das nach dem archimedischen Prinzip schwimmt.",
"dictionary":[
"Wäl"
],
"grantPermissions":[
"access filler words",
"access overlong sentences",
"access synonyms",
"access unfavorable phrases",
"access word frequency",
"access punctuation correction"
]
}'
import requests
import json
url = "https://api.duden.de/v1/spellcheck"
headers = {
"x-api-key" : "cR4zy5EcUR34p1k3y",
"Content-Type" : "application/json"
}
permissions = [
"access filler words",
"access synonyms",
"access punctuation correction"
]
dictionary = [
"Delphin"
]
text = "Ein Schif, in einer kleineren Form auch Boot genannt ist ein Wasserfahrzeuk, das nach dem archimedischen Prinzip schwimmt."
r = requests.post(url=url, headers=headers, json={
'text': text,
'dictionary': dictionary,
'grantPermissions': permissions
})
print(json.dumps(r.json(), indent=2))
Make sure to replace
cR4zy5EcUR34p1k3ywith your API key.Response
{
"data": {
"spellAdvices": [
{
"errorCode": "21",
"errorMessage": "Diese Schreibweise ist unbekannt. Bitte überprüfen Sie die Rechtschreibung dieses Wortes.",
"shortMessage": "Dieses Wort korrigieren?",
"label": "",
"labelInline": "",
"length": 5,
"offset": 4,
"originalError": "Schif",
"proposals": [
"Schi",
"Schaf",
"Schia",
"Schief",
"Schiff",
"Schilf",
"Schof"
],
"synonyms": [],
"occurrences": [
{
"offset": 4,
"text": "Schif",
"synonyms": []
}
],
"occurrenceIndex": 0,
"type": "orth"
},
{
"errorCode": "901",
"errorMessage": "Bitte prüfen Sie, ob ein Komma eingefügt werden muss.",
"shortMessage": "Hier ein Komma einfügen?",
"label": "Komma einfügen?",
"labelInline": "Komma einfügen?",
"length": 11,
"offset": 45,
"originalError": "genannt ist",
"proposals": [
"genannt, ist"
],
"synonyms": [],
"occurrences": [],
"occurrenceIndex": 0,
"type": "comma insertion KI with >=0.8 and KI output"
},
{
"errorCode": "21",
"errorMessage": "Diese Schreibweise ist unbekannt. Bitte überprüfen Sie die Rechtschreibung dieses Wortes.",
"shortMessage": "Dieses Wort korrigieren?",
"label": "",
"labelInline": "",
"length": 14,
"offset": 61,
"originalError": "Wasserfahrzeuk",
"proposals": [
"Wasserfahrzeug"
],
"synonyms": [
{
"synonyms": [
"Fahrzeug"
],
"description": "Fahrzeug",
"originalWord": "Wasserfahrzeug",
"id": 20144
}
],
"occurrences": [
{
"offset": 61,
"text": "Wasserfahrzeuk",
"synonyms": [
{
"synonyms": [
"Fahrzeug"
],
"description": "Fahrzeug",
"originalWord": "Wasserfahrzeug",
"id": 20144
}
]
}
],
"occurrenceIndex": 0,
"type": "orth"
}
],
"styleAdvices": []
}
}
Runs a given text through multiple spellcheck processors
HTTP Request
POST https://api.duden.de/v1/spellcheck
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| text | string | Spellcheck payload |
| language | string | Spellcheck language (default de) |
| dictionary | array | List of words that should be whitelisted |
| grantPermissions | array | [ access filler words, access overlong sentences, access synonyms, access unfavorable phrases, access word frequency, access punctuation correction ] |
| maxProposals | number | Number of proposals to return (default 7) |
/synonyms
curl -X POST 'https://api.duden.de/v1/synonyms' \
-H 'x-api-key: cR4zy5EcUR34p1k3y' \
-H 'Content-Type: application/json' \
-d '{
"word":"Gelegenheit"
}'
import requests
url = "https://api.duden.de/v1/synonyms"
headers = {
"x-api-key" : "cR4zy5EcUR34p1k3y",
"Content-Type" : "application/json"
}
response = requests.request("POST", url, headers=headers, json={
"word": "Gelegenheit"
})
print(response.text)
Make sure to replace
cR4zy5EcUR34p1k3ywith your API key.Response
[
{
"id": 20216,
"synonyms": [
"Anlass",
"Augenblick",
"Chance",
"Kairos",
"Möglichkeit",
"Okkasion",
"Umstand",
"günstiger Augenblick",
"günstiger Moment",
"günstiger Umstand",
"günstiger Zeitpunkt"
],
"description": "[günstiger] Moment",
"originalWord": "Gelegenheit"
},
{
"id": 68441,
"synonyms": [
"Angebot",
"Ausverkauf",
"Okkasion",
"Rabattaktion",
"Räumungsverkauf",
"Schnäppchen",
"Sonderaktion",
"Sonderangebot",
"Sonderposten",
"reduzierte Ware"
],
"description": "Sonderangebot",
"originalWord": "Gelegenheit"
},
{
"id": 79234,
"synonyms": [
"Anlass",
"Ereignis",
"Lage",
"Sachverhalt",
"Situation"
],
"description": "Ereignis",
"originalWord": "Gelegenheit"
},
{
"id": 111211,
"synonyms": [
"Raum"
],
"description": "Raum",
"originalWord": "Gelegenheit"
},
{
"id": 111216,
"synonyms": [
"Chance"
],
"description": "Chance",
"originalWord": "Gelegenheit"
}
]
Receive a list of synonyms to a given word.
HTTP Request
POST https://api.duden.de/v1/synonyms
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| word | string | |
| numberOfMeanings | number | The amount of synonyms to return |
v2
Version 2 provides AI-based correction. Requests are processed asynchronously:
- You send a text together with your
promptIdand acallbackUrl. - The API immediately answers with a
correlationId. - As soon as the text has been processed, the result is sent via HTTP
POSTto yourcallbackUrl.
The prompt is configured by Duden for your promptId. Contact us to get a promptId for your use case.
/correction
curl -X POST 'https://api.duden.de/v2/correction' \
-H 'x-api-key: cR4zy5EcUR34p1k3y' \
-H 'Content-Type: application/json' \
-d '{
"promptId": "3f1c2a9e-0000-0000-0000-000000000000",
"text": "Mein Test mid shreibfehler",
"language": "german_DE",
"outputType": "full",
"callbackUrl": "https://example.com/callback"
}'
import requests
url = "https://api.duden.de/v2/correction"
headers = {
"x-api-key" : "cR4zy5EcUR34p1k3y",
"Content-Type" : "application/json"
}
r = requests.post(url=url, headers=headers, json={
"promptId": "3f1c2a9e-0000-0000-0000-000000000000",
"text": "Mein Test mid shreibfehler",
"language": "german_DE",
"outputType": "full",
"callbackUrl": "https://example.com/callback"
})
print(r.json()["correlationId"])
Make sure to replace
cR4zy5EcUR34p1k3ywith your API key and thepromptIdwith the one you received from us.Response
{
"correlationId": "0b7c6a52-4f3e-4d1a-9c55-2a8e1f0d7b3e"
}
Submits a text for asynchronous processing. The result is not part of the response, it is delivered to your callbackUrl (see Callback).
HTTP Request
POST https://api.duden.de/v2/correction
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| promptId | string | yes | Your prompt configuration (UUID) as provided by Duden |
| text | string | yes | Text to be processed |
| callbackUrl | string | yes | URL the result is sent to. Must be a publicly reachable https URL |
| language | string | no | Language variant: german_DE (default), german_AT, german_CH. With german_CH the result uses "ss" instead of "ß" |
| outputType | string | no | full (default): one callback with the complete result. segment: one callback per sentence |
Response
| Status | Meaning |
|---|---|
| 200 | The request has been accepted. The body contains the correlationId |
| 403 | Your API key is missing or invalid |
| 422 | The promptId is unknown or not configured correctly |
| 429 | Too many requests. The rate limit or your daily quota has been exceeded |
Callback
Callback with outputType
full
{
"requestType": "api",
"correlationId": "0b7c6a52-4f3e-4d1a-9c55-2a8e1f0d7b3e",
"feature": "correction",
"language": "german_DE",
"outputType": "full",
"callbackUrl": "https://example.com/callback",
"originalText": "Mein Test mid shreibfehler",
"text": "Mein Test mit Schreibfehler",
"diff": "@@ -11,7 +11,8 @@\n m\n i\n-d\n+t\n \n-s\n+S\n+c\n h\n r",
"isFinal": true
}
Callbacks with outputType
segment
{
"requestType": "api",
"correlationId": "0b7c6a52-4f3e-4d1a-9c55-2a8e1f0d7b3e",
"feature": "correction",
"language": "german_DE",
"outputType": "segment",
"callbackUrl": "https://example.com/callback",
"originalText": "Ein Schif ist ein Wasserfahrzeuk.",
"text": "Ein Schiff ist ein Wasserfahrzeug.",
"diff": "@@ -7,4 +7,5 @@\n h\n i\n+f\n f\n \n@@ -30,4 +31,4 @@\n e\n u\n-k\n+g\n .",
"isFinal": false,
"segmentId": 0
}
{
"requestType": "api",
"correlationId": "0b7c6a52-4f3e-4d1a-9c55-2a8e1f0d7b3e",
"feature": "correction",
"language": "german_DE",
"outputType": "segment",
"callbackUrl": "https://example.com/callback",
"originalText": "Es schwimmt nach dem archimedischen Prinzip.",
"text": "Es schwimmt nach dem archimedischen Prinzip.",
"diff": "",
"isFinal": true,
"segmentId": 1
}
When processing is finished, the result is sent as JSON via HTTP POST to the callbackUrl of your request.
outputTypefull: you receive exactly one callback containing the complete text.outputTypesegment: the text is split into sentences and you receive one callback per sentence. Each callback carries asegmentId(starting at 0), the last one hasisFinalset totrue. Use thesegmentIdto put the sentences in order.
Callback Parameters
| Parameter | Type | Description |
|---|---|---|
| correlationId | string | The correlationId returned by your request |
| feature | string | Type of processing: correction |
| language | string | Language variant of the request |
| outputType | string | full or segment |
| callbackUrl | string | The callbackUrl of your request |
| originalText | string | The original text (or sentence, for segment) |
| text | string | The corrected text (or sentence, for segment) |
| diff | string | Character-based unified diff between originalText and text. Empty if nothing was changed |
| isFinal | boolean | true for the last callback of a request |
| segmentId | number | Index of the sentence, only present for outputType segment |
| requestType | string | Always api |
Diff Format
The diff follows the unified diff format without file headers, compared character by character. Each line holds exactly one character:
@@ -a,b +c,d @@starts a section:bcharacters from positionaof the original text (1-based) correspond todcharacters from positioncof the new text- a line starting with a space is unchanged context
- a line starting with
-is a character that has been removed - a line starting with
+is a character that has been added
Requirements for your callback endpoint
- The
callbackUrlmust usehttpswith a valid certificate and must be publicly reachable. Other URLs are rejected. - Answer with a status code
2xx. Redirects (3xx) are not followed. - On server errors (
5xx), timeouts or connection errors the callback is retried up to 3 times. Responses with4xxare not retried.
Codes (Only applies to v1)
List of error codes returned by spellcheck.
Example response
{
"code": 157,
"hits": [
{
"begin_char": 25,
"end_char": 52,
"proposals": [
"Meer, um einen Wäl zu retten"
],
"snippet": "Meer um einen Wäl zu retten"
}
],
"info": "comma insertion DPF with output",
"type": "gram",
"attributes": {
"errorCode": "157",
}
}
| Code | Type | Group | Category |
|---|---|---|---|
| 139 | gram | Sonstiges | Grammatik |
| 135 | gram | Falsche Kleinschreibung | Grammatik |
| 113 | gram | Falsche Kleinschreibung | Grammatik |
| 115 | orth | Falsche Kleinschreibung | Grammatik |
| 116 | gram | Falsche Kleinschreibung | Grammatik |
| 118 | gram | Falsche Kleinschreibung | Grammatik |
| 122 | gram | Falsche Kleinschreibung | Grammatik |
| 124 | orth | Falsche Kleinschreibung | Grammatik |
| 126 | orth | Falsche Kleinschreibung | Grammatik |
| 131 | gram | Falsche Großschreibung | Grammatik |
| 132 | orth | Falsche Großschreibung | Grammatik |
| 133 | orth | Falsche Großschreibung | Grammatik |
| 134 | gram | Falsche Großschreibung | Grammatik |
| 204 | gram | Falsche Getrenntschreibung | Grammatik |
| 210 | gram | Falsche Getrenntschreibung | Grammatik |
| 107 | gram | Falsche Getrenntschreibung | Grammatik |
| 108 | orth | Falsche Getrenntschreibung | Grammatik |
| 106 | gram | Falsche Getrenntschreibung | Grammatik |
| 112 | gram | Falsche Getrenntschreibung | Grammatik |
| 205 | gram | Falsche Getrenntschreibung | Grammatik |
| 178 | gram | Falsche Getrenntschreibung | Grammatik |
| 224 | orth | Falsche Getrenntschreibung | Grammatik |
| 103 | orth | Falsche Getrenntschreibung | Grammatik |
| 180 | orth | Falsche Getrenntschreibung | Grammatik |
| 23 | orth | Falschschreibungen | Rechtschreibung |
| 140 | gram | Übereinstimmung | Grammatik |
| 141 | gram | Übereinstimmung | Grammatik |
| 142 | gram | Übereinstimmung | Grammatik |
| 144 | gram | dass/das | Grammatik |
| 145 | gram | dass/das | Grammatik |
| 149 | gram | Übereinstimmung | Grammatik |
| 160 | gram | Kommasetzung | Zeichensetzung |
| 150 | gram | Kommasetzung | Zeichensetzung |
| 151 | gram | Kommasetzung | Zeichensetzung |
| 155 | gram | Kommasetzung | Zeichensetzung |
| 157 | gram | Kommasetzung | Zeichensetzung |
| 225 | gram | Kommasetzung | Zeichensetzung |
| 158 | gram | Kommasetzung | Zeichensetzung |
| 159 | gram | Kommasetzung | Zeichensetzung |
| 153 | gram | Kommasetzung | Zeichensetzung |
| 166 | orth | Satzzeichen | Zeichensetzung |
| 161 | gram | Kommasetzung | Zeichensetzung |
| 26 | orth | Leerzeichen | Zeichensetzung |
| 170 | orth | Leerzeichen | Zeichensetzung |
| 171 | orth | Leerzeichen | Zeichensetzung |
| 173 | orth | Leerzeichen | Zeichensetzung |
| 227 | orth | Leerzeichen | Zeichensetzung |
| 228 | orth | Leerzeichen | Zeichensetzung |
| 162 | orth | Satzzeichen | Zeichensetzung |
| 165 | orth | Satzzeichen | Zeichensetzung |
| 146 | gram | dass/das | Grammatik |
| 111 | orth | Falsche Kleinschreibung | Grammatik |
| 130 | orth | Falsche Großschreibung | Rechtschreibung |
| 2 | orth | Falsche Kleinschreibung | Rechtschreibung |
| 192 | gram | Falsche Kleinschreibung | Grammatik |
| 1 | orth | Falschschreibungen | Rechtschreibung |
| 7 | gram | Falsche Kleinschreibung | Grammatik |
| 5 | orth | Alte Rechtschreibung | Rechtschreibung |
| 6 | orth | Alte Rechtschreibung | Rechtschreibung |
| 13 | orth | Falschschreibungen | Rechtschreibung |
| 28 | orth | Schreibvarianten | Rechtschreibung |
| 30 | orth | Schreibvarianten | Rechtschreibung |
| 187 | orth | Schreibvarianten | Rechtschreibung |
| 1881 | gram | Schreibvarianten | Grammatik |
| 1882 | gram | Schreibvarianten | Grammatik |
| 1883 | gram | Schreibvarianten | Grammatik |
| 1884 | gram | Schreibvarianten | Grammatik |
| 32 | orth | Schreibvarianten | Rechtschreibung |
| 19 | orth | Leerzeichen | Zeichensetzung |
| 219 | term | Falschschreibungen | Rechtschreibung |
| len | style | Satzlänge | Stil |
| 216 | style | Fremdwort oder Fachausdruck | Stil |
| 215 | style | Veralteter Ausdruck | Stil |
| 217 | style | Umgangssprache | Stil |
| 218 | style | Dialekt | Stil |
| 21 | orth | Falschschreibungen | Rechtschreibung |
| 22 | orth | Falschschreibungen | Rechtschreibung |
| 43 | orth | Falschschreibungen | Rechtschreibung |
| 27 | orth | Falschschreibungen | Rechtschreibung |
| 148 | gram | Sonstiges | Grammatik |
| 110 | gram | Falsche Getrenntschreibung | Grammatik |
| 2112 | gram | Schreibvarianten | Grammatik |
| 2111 | gram | Schreibvarianten | Grammatik |
| 2113 | gram | Schreibvarianten | Grammatik |
| 1092 | gram | Schreibvarianten | Grammatik |
| 1091 | gram | Schreibvarianten | Grammatik |
| 1093 | gram | Schreibvarianten | Grammatik |
| 1771 | gram | Schreibvarianten | Grammatik |
| 1772 | gram | Schreibvarianten | Grammatik |
| 1773 | gram | Schreibvarianten | Grammatik |
| 1271 | gram | Schreibvarianten | Grammatik |
| 1274 | gram | Schreibvarianten | Grammatik |
| 1282 | gram | Schreibvarianten | Grammatik |
| 1281 | gram | Schreibvarianten | Grammatik |
| 1284 | gram | Schreibvarianten | Grammatik |
| 1252 | orth | Schreibvarianten | Rechtschreibung |
| 1251 | orth | Schreibvarianten | Rechtschreibung |
| 1253 | orth | Schreibvarianten | Rechtschreibung |
| 1992 | gram | Schreibvarianten | Grammatik |
| 1991 | gram | Schreibvarianten | Grammatik |
| 1993 | gram | Schreibvarianten | Grammatik |
| 1374 | gram | Schreibvarianten | Grammatik |
| 1372 | gram | Schreibvarianten | Grammatik |
| 1371 | gram | Schreibvarianten | Grammatik |
| 1373 | gram | Schreibvarianten | Grammatik |
| 1842 | gram | Schreibvarianten | Grammatik |
| 1841 | gram | Schreibvarianten | Grammatik |
| 1843 | gram | Schreibvarianten | Grammatik |
| 1844 | gram | Schreibvarianten | Grammatik |
| 1052 | gram | Schreibvarianten | Grammatik |
| 1051 | gram | Schreibvarianten | Grammatik |
| 1053 | gram | Schreibvarianten | Grammatik |
| 1912 | gram | Schreibvarianten | Grammatik |
| 1911 | gram | Schreibvarianten | Grammatik |
| 1913 | gram | Schreibvarianten | Grammatik |
| 34 | orth | Schreibvarianten | Rechtschreibung |
| 163 | gram | Kommasetzung | Zeichensetzung |
| 182 | gram | Falsche Getrenntschreibung | Grammatik |
| 212 | gram | Schreibvarianten | Grammatik |
| 202 | orth | Bindestriche | Zeichensetzung |
| 100 | orth | Leerzeichen | Zeichensetzung |
| 208 | gram | Falsche Getrenntschreibung | Grammatik |
| 2131 | gram | Schreibvarianten | Grammatik |
| 2132 | gram | Schreibvarianten | Grammatik |
| 2133 | gram | Schreibvarianten | Grammatik |
| 2134 | gram | Schreibvarianten | Grammatik |
| 2141 | gram | Schreibvarianten | Grammatik |
| 2142 | gram | Schreibvarianten | Grammatik |
| 2143 | gram | Schreibvarianten | Grammatik |
| 2201 | gram | Schreibvarianten | Grammatik |
| 2202 | gram | Schreibvarianten | Grammatik |
| 2203 | gram | Schreibvarianten | Grammatik |
| 221 | gram | Rechtschreibung im Kontext | Grammatik |
| 222 | orth | Rechtschreibung im Kontext | Grammatik |
| 223 | orth | Falsche Getrenntschreibung | Grammatik |
| 229 | orth | Schweizerischer Ausdruck | Stil |
| 230 | orth | Österreichischer Ausdruck | Stil |
| 117 | gram | Falsche Getrenntschreibung | Grammatik |
| 226 | gram | Rechtschreibung im Kontext | Grammatik |
| 87 | gram | Verbformen und Satzbau | Grammatik |
| 231 | gram | Verbformen und Satzbau | Grammatik |
| 102 | orth | Bindestriche | Zeichensetzung |
| 232 | gram | Bindestriche | Zeichensetzung |
| 233 | orth | Falsche Zusammenschreibung | Grammatik |
| 234 | orth | Schreibvarianten | Grammatik |
| 235 | orth | Falschschreibungen | Rechtschreibung |
| 44 | gram | Rechtschreibung im Kontext | Grammatik |
| 1981 | orth | Schreibvarianten | Grammatik |
| 15 | gram | Sonstiges | Grammatik |
| 16 | orth | Falschschreibungen | Rechtschreibung |
| 143 | gram | Übereinstimmung | Grammatik |
| 147 | gram | Übereinstimmung | Grammatik |
| 201 | orth | Bindestriche | Zeichensetzung |
| 114 | orth | Falsche Getrenntschreibung | Grammatik |
| 236 | orth | Falsche Getrenntschreibung | Grammatik |
| 2371 | gram | Schreibvarianten | Grammatik |
| 2372 | gram | Schreibvarianten | Grammatik |
| 2374 | gram | Schreibvarianten | Grammatik |
| 238 | orth | Falschschreibungen | Rechtschreibung |
| 240 | style | Füllwörter | Stil |
| 241 | style | Füllwörter | Stil |
| 242 | style | Füllwörter | Stil |
| 239 | gram | Kommasetzung | Zeichensetzung |
| 136 | gram | Falsche Großschreibung | Grammatik |
| 59 | orth | Grundform verwenden | Rechtschreibung |
| 164 | gram | Kommasetzung | Zeichensetzung |
| 2451 | gram | Schreibvarianten | Grammatik |
| 2452 | gram | Schreibvarianten | Grammatik |
| 2453 | gram | Schreibvarianten | Grammatik |
| 2461 | gram | Schreibvarianten | Grammatik |
| 2462 | gram | Schreibvarianten | Grammatik |
| 2463 | gram | Schreibvarianten | Grammatik |
| 2464 | gram | Schreibvarianten | Grammatik |
| 2481 | gram | Schreibvarianten | Grammatik |
| 2484 | gram | Schreibvarianten | Grammatik |
| 249 | gram | Kommasetzung | Zeichensetzung |
| 2501 | gram | Kommasetzung | Zeichensetzung |
| 101 | gram | Falsche Getrenntschreibung | Grammatik |
| 251 | orth | Falsche Zusammenschreibung | Grammatik |
| 252 | gram | Rechtschreibung im Kontext | Grammatik |
| 253 | gram | Rechtschreibung im Kontext | Grammatik |
| 9 | orth | Apostrophe | Zeichensetzung |
| 99 | orth | Apostrophe | Zeichensetzung |
| 9001 | orth | Apostrophe | Zeichensetzung |
| 9002 | orth | Apostrophe | Zeichensetzung |
| 9091 | orth | Apostrophe | Zeichensetzung |