# OTEL_LOG_RAW_API_BODIES

> It logs the full JSON of each model request and answer.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** OTEL_LOG_RAW_API_BODIES=1, CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH

## Think of it like

It is like you keep a copy of each whole letter. Not just the front.

## Definition

OTEL_LOG_RAW_API_BODIES logs the full JSON of each model request and answer. Set it to 1 to put the bodies in the log, cut at 60 KB by default. Set it to file: and a folder to save whole bodies to disk instead. Each body holds the whole chat so far, so it is off by default.

## Example

Lucy's gateway rejects one request, and she cannot see why. She saves the raw bodies to a folder and finds the bad field.

## Example code

```bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOG_RAW_API_BODIES=file:/tmp/claude-bodies
claude
```

Save whole request bodies to a folder.

## Why it matters

When a request fails in a strange way, the raw body shows exactly what was sent.

## Common mistake

Leaving it on. The bodies hold your whole chat, code included, and grow fast.

## Three principles

- **Full JSON.** Request and answer.
- **1 or file:.** Inline or to disk.
- **Off by default.** Holds the whole chat.

## Related terms

- [OTEL_LOG_USER_PROMPTS](https://learn.benibix.com/term/ai/otel-log-user-prompts-variable)
- [CLAUDE_CODE_ENABLE_TELEMETRY](https://learn.benibix.com/term/ai/claude-code-enable-telemetry-variable)
- [DEBUG Variable](https://learn.benibix.com/term/ai/debug-variable)

---

Source: https://learn.benibix.com/term/ai/otel-log-raw-api-bodies-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
