# DeepL API Authentication with Example Code

DevFeed: [DeepL API Authentication with Example Code](<https://devfeed.tech/articles/deepl-api-authentication-with-example-code-97558.md>)

Original publisher: [Read original article](<https://www.swytchcode.com/content/deepl-api-authentication>)

Author: Chaitrali Kakde

Published: 2026-10-23T09:00:00Z

Content type: tutorial

Language: en

Sources: [Swytchcode](<https://devfeed.tech/sources/swytchcode.md>)

Topics: [deepl](<https://devfeed.tech/topics/deepl.md>), [Secure token management](<https://devfeed.tech/topics/secure-token-management.md>), [OpenAPI Specification](<https://devfeed.tech/topics/openapi.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [api-authentication](<https://devfeed.tech/tags/api-authentication.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [bearer](<https://devfeed.tech/tags/bearer.md>), [bearer-token](<https://devfeed.tech/tags/bearer-token.md>), [deepl](<https://devfeed.tech/tags/deepl.md>), [example](<https://devfeed.tech/tags/example.md>), [free](<https://devfeed.tech/tags/free.md>), [integrations](<https://devfeed.tech/tags/integrations.md>)

## AI overview

DeepL authentication failures can come from using the wrong auth scheme or host: requests use `Authorization: DeepL-Auth-Key`, with free keys sent to `api-free.deepl.com` and paid keys to `api.deepl.com`. The document gives a translation request example and notes that `text` is an array with a 128 KiB request cap. It explains that `prefer_more` and `prefer_less` avoid errors for unsupported formality settings; glossaries require an explicit `source_lang` and a matching language pair; and context can improve short translations. For agents, it describes storing keys outside project code and applying allowlists and policies. Retries with backoff suit 429/529 rate limits, but 456 quota errors need a billing decision, and retries can incur another character charge. It recommends caching repeated translations and keeping source text authoritative because round-trip translation can drift.

## Source excerpt

DeepL does not use a Bearer token, and the free and pro plans live on different hosts. Working auth code, plus glossaries, formality and the round-trip problem.