Skip to content
← Back to release · 2.1.274
Improvements / v2.1.274

Link raw API bodies to requests

CHANGELOG · original

Improved OTEL_LOG_RAW_API_BODIES=file:<dir> output: a new index.jsonl and request_body_id / message.id event attributes link each response to its request file and transcript message
Open official changelog ↗

Documentation

Documentation excerpt

API response body event

Logged for each successful API response when OTEL_LOG_RAW_API_BODIES is set.

In file mode (OTEL_LOG_RAW_API_BODIES=file:<dir>), Claude Code also appends one JSON line to <dir>/index.jsonl for each successful response, with the fields timestamp, session_id, query_source, model, request_id, message_id, message_uuid, request_file, and response_file. Read it to find the request and response files behind a given transcript message without querying your telemetry backend. The index file requires Claude Code v2.1.274 or later.

Event Name: claude_code.api_response_body

Attributes:

  • All standard attributes
  • event.name: "api_response_body"
  • event.timestamp: ISO 8601 timestamp
  • event.sequence: per-process counter for ordering events, described under Event correlation attributes
  • body: JSON-serialized Messages API response, including the id, content blocks, usage, and stop reason, truncated at the content limit (60 KB by default). Extended-thinking content is redacted. Emitted only in inline mode (OTEL_LOG_RAW_API_BODIES=1).
  • body_ref: Absolute path to a <dir>/<request_id>.response.json file containing the untruncated body. Emitted only in file mode (OTEL_LOG_RAW_API_BODIES=file:<dir>).
  • body_length: Untruncated body length. UTF-8 bytes when OTEL_LOG_RAW_API_BODIES=file:<dir>, or UTF-16 code units when =1
  • body_truncated: "true" when inline truncation occurred. Absent in file mode and when no truncation occurred.
  • model: Model identifier
  • query_source: Subsystem that issued the request
  • request_id: Anthropic API request ID from the response's request-id header, such as "req_011...". Present only when the API returns one.
  • request_body_id: The request_body_id of the api_request_body event that this response answers. Requires Claude Code v2.1.274 or later
  • message.id: Message ID the API assigned to the response, the id field of the response body. Requires Claude Code v2.1.274 or later
  • message.uuid: UUID of the response's final transcript entry. Together with request_body_id, it links a transcript message to the request and response bodies behind it. Requires Claude Code v2.1.274 or later

Documentation snapshot · 2026-09-23

Change details