# DeepL — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Professional translation and text improvement — translate text between 30+ languages with industry-leading quality, or improve and rephrase text with DeepL Write.

**Category:** AI / Translation | **Website:** [www.deepl.com](https://www.deepl.com) | **Docs:** [developers.deepl.com](https://developers.deepl.com)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/deepl/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

> Also available via public x402 on Base (no account needed): [x402/deepl.md](https://beta.paywithlocus.com/x402/deepl.md)

> Also available via MPP (no account needed): [mpp/deepl.md](https://beta.paywithlocus.com/mpp/deepl.md)

## Endpoints

### Translate

Translate text between 30+ languages with DeepL's industry-leading neural machine translation. Supports formality control, context, and model selection.

**Estimated cost:** $0.025+ (scales with text length)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `text` | array[string] | Yes | Text(s) to translate (up to 50 items) |
| `target_lang` | string | Yes | Target language code (e.g. "DE", "FR", "ES", "JA", "ZH") |
| `source_lang` | string | No | Source language code (auto-detected if omitted) |
| `formality` | string | No | "default", "more", "less", "prefer_more", "prefer_less" |
| `context` | string | No | Additional context to improve translation quality (not translated) |
| `model_type` | string | No | "quality_optimized", "latency_optimized", or "prefer_quality_optimized" |
| `split_sentences` | string | No | "0" (none), "1" (default), or "nonewlines" |
| `preserve_formatting` | boolean | No | Preserve original formatting (punctuation, case) |
| `tag_handling` | string | No | "xml" or "html" for markup-aware translation |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/deepl/translate \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"<array[string]>","target_lang":"<string>","source_lang":"<string>","formality":"<string>","context":"<string>","model_type":"<string>","split_sentences":"<string>","preserve_formatting":"<boolean>","tag_handling":"<string>"}'
```

### Rephrase (Write)

Improve and rephrase text with DeepL Write. Fix grammar, adjust tone, change writing style, and convert between language variants (e.g. US → British English).

**Estimated cost:** $0.025+ (scales with text length)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `text` | array[string] | Yes | Text(s) to improve |
| `target_lang` | string | Yes | Language: "de", "en-US", "en-GB", "es", "fr", "it", "pt-BR", "pt-PT" |
| `writing_style` | string | No | "simple", "business", "academic", "casual", or "default" |
| `tone` | string | No | "enthusiastic", "friendly", "confident", "diplomatic", or "default" |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/deepl/rephrase \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"<array[string]>","target_lang":"<string>","writing_style":"<string>","tone":"<string>"}'
```

### Languages

List all supported source and target languages with formality support info.

**Estimated cost:** $0.005 fee only

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `type` | string | No | "source" (default) or "target" |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/deepl/languages \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"<string>"}'
```
