Skip to main content
In this tutorial, you’ll improve text with DeepL API for Write: rephrase a text for clarity, run a corrections-only pass that keeps the author’s voice intact, and change the writing style. By the end, you’ll have used both Write endpoints and know when to pick which. Unlike translation, Write improves text within a language: the source text and target_lang must be the same language (improving and translating in one request is not yet supported).

Prerequisites

Building with an AI coding agent?

Wire it up to the DeepL Docs MCP Server so it can search and read this documentation while it writes code. In Claude Code:
claude mcp add --transport http deepl-docs https://developers.deepl.com/mcp
Then describe what you want to build. To get the same result as this tutorial, paste:
Using the DeepL Write API, write a script that rephrases an English text, then runs the same text through corrections-only mode, and prints both results.
Setup instructions for Claude Desktop, Cursor, VS Code, and other MCP clients are on the Docs MCP Server page.

Step 1: Rephrase a text

The /v2/write/rephrase endpoint is Write’s broad improvement mode: it fixes spelling and grammar, and may also rewrite sentences for clarity, style, or tone.
Sample request
export API_KEY={YOUR_API_KEY}

curl -X POST https://api.deepl.com/v2/write/rephrase \
  --header "Authorization: DeepL-Auth-Key $API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "text": [
      "I could relly use sum help with edits on thiss text !"
    ],
    "target_lang": "en-US"
}'
Sample response
{
  "improvements": [
    {
      "text": "I could really use some help editing this text!",
      "detected_source_language": "en",
      "target_language": "en-US"
    }
  ]
}
The text parameter is an array, so you can improve multiple texts in one request; improvements come back in the same order. The total request body is limited to 10 KiB, so split larger workloads across multiple calls. target_lang currently supports de, en-GB, en-US, es, fr, it, ja, ko, pt-BR, pt-PT, and zh/zh-Hans. To check programmatically, call GET /v3/languages?resource=write.
You can convert between variants of the same language: sending American English text with target_lang set to en-GB improves the text and converts it to British English.

Step 2: Fix errors only, keeping the author’s voice

When you want corrections without rewrites, use the /v2/write/correct endpoint instead. It fixes spelling and grammar with minimal changes to wording, matching the “Corrections Only” mode in the DeepL Translator UI.
Sample request
curl -X POST https://api.deepl.com/v2/write/correct \
  --header "Authorization: DeepL-Auth-Key $API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "text": [
      "I could relly use sum help with edits on thiss text !"
    ],
    "target_lang": "en-US"
}'
Sample response
{
  "improvements": [
    {
      "text": "I could really use some help with edits on this text!",
      "detected_source_language": "en",
      "target_language": "en-US"
    }
  ]
}
Compare the two results: /write/correct fixed the errors but kept the original phrasing (“edits on this text”), while /write/rephrase also reworded the sentence.

Step 3: Change the writing style

On /write/rephrase, the writing_style parameter steers how the text is rewritten:
Sample request
curl -X POST https://api.deepl.com/v2/write/rephrase \
  --header "Authorization: DeepL-Auth-Key $API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "text": [
      "I could relly use sum help with edits on thiss text !"
    ],
    "target_lang": "en-US",
    "writing_style": "business"
}'
Sample response
{
  "improvements": [
    {
      "text": "I would appreciate some assistance with editing this text.",
      "detected_source_language": "en",
      "target_language": "en-US"
    }
  ]
}
Alternatively, the tone parameter adjusts how the text sounds (friendly, confident, diplomatic, and more). A request can include writing_style or tone, but not both. For all available values, per-language support, and the prefer_ fallback behavior, see Controlling Writing Style and Tone.

Next steps

You’ve now used both Write endpoints and steered the output style. To keep going: