Skip to content

Latest commit

 

History

History
166 lines (145 loc) · 5.78 KB

File metadata and controls

166 lines (145 loc) · 5.78 KB
title Style rules
sidebarTitle Overview
description Manage a shared list of rules for style, formatting, and more
The Style Rules API is currently available only to Pro API subscribers.

The style rules feature allows you to select a set of rules to apply when translating text. These rules make changes to your text according to the selected formatting and spelling conventions.

You can create style rules in the UI at https://deepl.com/custom-rules.

Both style rules and glossaries are unique to each of DeepL's global data centers and are not shared between them. Clients using the api-us.deepl.com endpoint will not be able to access glossaries or style rules created in the UI at this time.

Get all style rule lists

Get all style rules lists and their meta-information.

curl -X GET 'https://api.deepl.com/v3/style_rules' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' 
{
  "style_rules": [
    {
      "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994",
      "name": "Technical Documentation Rules",
      "creation_time": "2024-10-01T12:34:56Z",
      "updated_time": "2024-10-03T12:34:56Z",
      "language": "EN",
      "version": 8
    }
  ]
}

You can also optionally pass in a detailed query parameter, to retrieve all configured rules and custom instructions per rule list.

curl -X GET 'https://api.deepl.com/v3/style_rules?detailed=true' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' 
{
  "style_rules": [
    {
      "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994",
      "name": "Technical Documentation Rules",
      "creation_time": "2024-10-01T12:34:56Z",
      "updated_time": "2024-10-03T12:34:56Z",
      "language": "EN",
      "version": 8,
      "configured_rules": {
        "numbers": {
            "time_format": "always-use-24-hour-clock"
        },
        "style_and_tone": {
            "instructions_style": "use-imperative",
            "redundant_introductory_words": "avoid-redundant-introductory-words-that-relate-to-current-text"
        }
      },
      "custom_instructions": {
        "label": "My Custom instruction",
        "prompt": "Use a friendly, diplomatic tone"
      }
    }
  ]
}
GET https://api.deepl.com/v3/style_rules HTTP/2
Host: api.deepl.com
Authorization: DeepL-Auth-Key [yourAuthKey] 
User-Agent: YourApp/1.2.3
{
  "style_rules": [
    {
      "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994",
      "name": "Technical Documentation Rules",
      "creation_time": "2024-10-01T12:34:56Z",
      "updated_time": "2024-10-03T12:34:56Z",
      "language": "EN",
      "version": 8
    }
  ]
}

You can also optionally pass in a detailed query parameter, to retrieve all configured rules and custom instructions per rule list.

GET https://api.deepl.com/v3/style_rules?detailed=true HTTP/2
Host: api.deepl.com
Authorization: DeepL-Auth-Key [yourAuthKey] 
User-Agent: YourApp/1.2.3
{
  "style_rules": [
    {
      "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994",
      "name": "Technical Documentation Rules",
      "creation_time": "2024-10-01T12:34:56Z",
      "updated_time": "2024-10-03T12:34:56Z",
      "language": "EN",
      "version": 8,
      "configured_rules": {
        "numbers": {
            "time_format": "always-use-24-hour-clock"
        },
        "style_and_tone": {
            "instructions_style": "use-imperative",
            "redundant_introductory_words": "avoid-redundant-introductory-words-that-relate-to-current-text"
        }
      },
      "custom_instructions": {
        "label": "My Custom instruction",
        "prompt": "Use a friendly, diplomatic tone"
      }
    }
  ]
}

Query parameters

Determines if the rule list's `configured_rules` and `custom_instructions` should be included in the response body. If `detailed` parameter is not included, defaults to `false`. The index of the first page to return. Default: 0 (the first page). Use with `page_size` to get the next page of rule lists. The maximum number of style rule lists to return. Default: 10. Minimum: 1. Maximum: 25.

Real-world Use Case Examples

To maximize the impact of Style Rules, consider the following specific applications:

  1. Corporate Brand Alignment: Ensure translations match your company's unique "voice."

    • Example: A lifestyle brand might use a rule to avoid "formal" terms and prefer "vibrant, youth-oriented" synonyms.
  2. Technical Support Automation: Maintain consistency in documentation.

    • Example: Set instructions_style to use-imperative to ensure all troubleshooting steps (e.g., "Press the button") are clear and direct.
  3. Global E-commerce Compliance: Handle regional nuances in numbers and formats.

    • Example: Use numbers.time_format set to always-use-24-hour-clock for logistics apps operating in Europe.
  4. Inclusive Communication: Adapt content for diverse audiences.

    • Example: Apply custom instructions to "ensure gender-neutral pronouns are used wherever possible" to align with modern HR policies.
  5. Legal and Contractual Precision: Preserve the exact meaning of sensitive terms.

    • Example: Use custom prompts to "maintain the specific legal distinction between 'shall' and 'may' in contractual clauses."