The Style Rules API is currently available only to Pro API subscribers.
Overview
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 glossaries and style rules are unique to each of DeepL’s global data centers and are not shared between them. Clients using theapi-us.deepl.com endpoint will not be able to access glossaries or style rules created in the UI at this time.
A style rule list contains two types of rules:
- Configured rules: Predefined rules for formatting conventions (e.g., time format, number formatting, style and tone)
- Custom instructions: User-defined instructions for specific styling requirements
Limits
- There is no limit to how many predefined rules can be selected per style rule list
- A maximum of 200 custom instructions can be enabled per style rule list (although this may be adjusted based on plan tiers in the future)
- Each custom instruction is at most 300 characters
Creating style rules
Create a style rule list
POST /v3/style_rules
Create a new style rule list with configured rules and optional custom instructions.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: create a style rule list
Example response
Request body parameters
string
required
The name of the style rule list. Maximum length: 1024 characters.
string
required
The target language for the style rules. Supported values:
ar, bg, cs, da, de, el, en, es, et, fi, fr, he, hu, id, it, ja, ko, lt, lv, nb, nl, pl, pt, ro, ru, sk, sl, sv, tr, uk, vi, zh.object
An object containing predefined rules to enable for the style rule list. Rules are organized by category (e.g.,
dates_and_times, punctuation). Each category can contain multiple rule options.array
An array of custom instruction objects. Each custom instruction must include
label, prompt, and optionally source_language. Maximum 200 custom instructions per style rule list. Each prompt is limited to 300 characters.The
version field in the response increments each time the style rule list is modified (e.g., when rules are updated or custom instructions are added/removed). You can use this field to track changes to your style rules.Retrieving style rules
List all style rule lists
GET /v3/style_rules
Get all style rule lists and their meta-information.
- cURL
- HTTP Request
The example below uses our API Pro endpoint You can also optionally pass in a
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: get all style rule lists
Example response
detailed query parameter to retrieve all configured rules and custom instructions per rule list.Example request: get all style rule lists with details
Example response
Query parameters
boolean
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.integer
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.integer
The maximum number of style rule lists to return. Default: 10. Minimum: 1. Maximum: 25.
Get a style rule list
GET /v3/style_rules/{style_id}
Get detailed information for a single style rule list, including all configured rules and custom instructions.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: retrieve style rule list
Example response
Updating style rules
UsePATCH /v3/style_rules/{style_id} to update the name of a style rule list, or use PUT /v3/style_rules/{style_id}/configured_rules to replace all configured rules.
Update a style rule list’s name
PATCH /v3/style_rules/{style_id}
Update the name of a style rule list.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: update a style rule list's name
Example response
Request body parameters
string
The new name for the style rule list. Maximum length: 1024 characters.
Replace configured rules
PUT /v3/style_rules/{style_id}/configured_rules
Replace all configured rules for a style rule list. Custom instructions are not affected.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: replace configured rules
Example response
Request body parameters
object
required
A
ConfiguredRules object containing the complete set of predefined rules. This replaces all existing configured rules for the style rule list. Rules are organized by category (e.g., dates_and_times, punctuation).This endpoint replaces the entire configured rules object. Use
PATCH /v3/style_rules/{style_id} instead if you only want to update the style rule list name.Deleting style rules
Delete a style rule list
DELETE /v3/style_rules/{style_id}
Delete a style rule list. This operation cannot be undone.
- cURL
- HTTP Request
The example below uses our API Pro endpoint Returns a
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: delete style rule list
204 No Content status code on successful deletion. The response body will be empty. If the style rule list is not found, a 404 error will be returned.Managing custom instructions
Create a custom instruction
POST /v3/style_rules/{style_id}/custom_instructions
Add a new custom instruction to an existing style rule list. The response returns the complete updated style rule list, including the new custom instruction with its generated ID.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: create custom instruction
Example response
Request body parameters
string
required
A short descriptive label for the custom instruction. Maximum length: 100 characters.
string
required
The instruction text that defines the style requirement. Maximum length: 300 characters.
string
Optional source language code for the custom instruction (e.g.,
en, de, fr).Get a custom instruction
GET /v3/style_rules/{style_id}/custom_instructions/{instruction_id}
Get details for a specific custom instruction within a style rule list.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: retrieve custom instruction
Example response
Replace a custom instruction
PUT /v3/style_rules/{style_id}/custom_instructions/{instruction_id}
Replace an existing custom instruction within a style rule list. All fields must be provided.
- cURL
- HTTP Request
The example below uses our API Pro endpoint
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: replace custom instruction
Example response
Request body parameters
string
required
The updated label for the custom instruction. Maximum length: 100 characters.
string
required
The updated instruction text. Maximum length: 300 characters.
string
Optional source language code for the custom instruction (e.g.,
en, de, fr).Delete a custom instruction
DELETE /v3/style_rules/{style_id}/custom_instructions/{instruction_id}
Delete a specific custom instruction from a style rule list. This operation cannot be undone.
- cURL
- HTTP Request
The example below uses our API Pro endpoint Returns a
https://api.deepl.com. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com instead.Example request: delete custom instruction
204 No Content status code on successful deletion. The response body will be empty. If the custom instruction is not found, a 404 error will be returned.Using style rules
In translation requests
To use a style rule list in a translation request, include itsstyle_id parameter in your translation call. For more information on using style rules in translations, see the translation documentation.
Example: translate with style rules
All
model_type values are supported with style rules.