> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.loreos.app/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.loreos.app/_mcp/server.

# Patch Character Localization

PATCH https://api.loreos.app/v1/characters/{slug}/localizations/{locale}
Content-Type: application/json

Create or update one locale pack on a canonical character.

Reference: https://docs.loreos.app/api-reference/characters/patch-character-localization

## Authentication

- `Authorization` header (bearer token, required) — LoreOS runtime API key (`ck_...`), sent as `Authorization: Bearer <key>`.

## Servers

- `https://api.loreos.app` (Production, default)
- `http://127.0.0.1:8000` (Local development)

## Request

### Path parameters

- `slug` (string, required)
- `locale` (string, required)

### Body (application/json)

This endpoint expects a V1CharacterLocalizationPatchRequest.

- `reply_language` (enum, optional)
  - Allowed values: `en-US`, `ja-JP`, `ko-KR`, `zh-CN`, `zh-TW`
- `display_name` (string, optional, nullable)
- `profile` (map from string to any, optional, nullable)
- `greeting` (Greeting, optional, nullable)
- `voice_samples` (list of VoiceSample, optional, nullable)
- `example_dialogues` (list of ExampleDialogue, optional, nullable)
- `onboarding` (list of OnboardingEntry, optional, nullable)
- `style_notes` (list of any, optional, nullable)
- `honorifics` (map from string to any, optional, nullable)
- `do_not_translate_terms` (list of string, optional, nullable)
- `status` (enum, optional, nullable)
  - Allowed values: `draft`, `published`, `archived`
- `is_default` (boolean, optional, nullable)

## Response

### 200

Successful Response

- `map from string to any`

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### Greeting

- `bubbles` (list of string, required) — Authored first character message bubbles emitted as-is.

### VoiceSample

- `text` (string, required) — A short example line in the character's voice. Required.
- `scenario_tag` (string, optional, nullable) — Situation label such as 'opener', 'teasing', or 'boundary'.
- `sample_role` (enum, optional, default: candidate) — anchor = strong style guide; candidate = softer example.
  - Allowed values: `anchor`, `candidate`
- `anchor_tier` (enum, optional, default: T2) — T1 strongest style anchor; T3 weakest/experimental.
  - Allowed values: `T1`, `T2`, `T3`

### ExampleDialogue

Few-shot user↔character interaction pattern. Unlike ``voice_samples`` (single-line voice anchors), this teaches pacing, boundary handling, question/answer shape, and how the character responds to user pressure. It is developer-authored guidance, not a committed memory.

- `scenario_tag` (string, required) — Situation label such as 'first_question', 'soft_boundary', or 'daily_share'.
- `turns` (list of ExampleDialogueTurn, required) — A compact user↔character exchange. Must include both roles.
- `usage` (enum, optional, default: interaction_pattern) — What the runtime should learn from this example.
  - Allowed values: `interaction_pattern`, `boundary_handling`, `topic_handling`, `voice_and_pacing`
- `teaching_goal` (string, optional, nullable) — Short note for coding agents: what this example should teach.

### OnboardingEntry

- `question` (string, required)
- `answer` (string, required)
- `privacy_tier` (string, optional, default: private_knowledge) — How this self-knowledge may be used.
- `allowed_uses` (list of string, optional) — Examples: character_self_knowledge, planning_only.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ExampleDialogueTurn

- `role` (enum, required) — Speaker role in this authored interaction example.
  - Allowed values: `user`, `character`
- `text` (string, required) — One chat bubble or short turn. Keep examples natural and compact.

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Request**

```json
{}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.loreos.app/v1/characters/slug/localizations/locale"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.loreos.app/v1/characters/slug/localizations/locale';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.loreos.app/v1/characters/slug/localizations/locale"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.loreos.app/v1/characters/slug/localizations/locale")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.loreos.app/v1/characters/slug/localizations/locale")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.loreos.app/v1/characters/slug/localizations/locale', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.loreos.app/v1/characters/slug/localizations/locale");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.loreos.app/v1/characters/slug/localizations/locale")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```