---
title: "Compress Session"
method: GET
path: "/v1/messages/sessions/{session_id}/compress"
tags: ["v1", "Messages"]
---

# Compress Session

`GET /v1/messages/sessions/{session_id}/compress`

Get compressed conversation context for a session.
    
    Compress your conversation into hierarchical summaries with rich metadata,
    perfect for reducing token usage in LLM context windows.
    
    **Authentication Required**: Bearer token, API key, or session token
    
    **What it returns**:
    - **short_term**: Last 15 messages compressed
    - **medium_term**: Last ~100 messages compressed  
    - **long_term**: Full session compressed
    - **topics**: Key topics discussed
    - **session_intent / current_state / next_steps**: Structured session context for agents
    - **project_context / files_accessed / technical_details**: Project and file operation metadata
    
    **Perfect for**:
    - Reducing token usage in LLM prompts (96% savings)
    - Providing conversation context without full history
    - Quick conversation overview for AI agents
    - Project documentation and status snapshots
    
    **Input**: Just the session ID - all context is extracted automatically

## Path parameters

- `session_id` string, required

## Response `200`

Session summary (compressed context)

- SessionSummaryResponse — Response model for session summarization endpoint
  - `session_id` string, required — Session ID of the conversation
  - `summaries` ConversationSummaryResponse, required — Hierarchical conversation summaries for context window compression
    - `short_term` string, nullable — Summary of last 15 messages
    - `medium_term` string, nullable — Summary of last ~100 messages
    - `long_term` string, nullable — Full session summary
    - `topics` string[] — Key topics discussed
    - `last_updated` string, date-time, nullable — When summaries were last updated
    - `session_intent` string, nullable — What the user is trying to accomplish in this session
    - `key_decisions` string[] — Important decisions made and their reasoning
    - `current_state` string, nullable — Current progress: what is working, not working, blocked, or unverified
    - `next_steps` string[] — Specific actionable next steps
    - `technical_details` string[] — Technical details to remember (URLs, errors, config values, function names)
    - `files_accessed` object, nullable — Files read, modified, created, or deleted during the session
    - `project_context` object, nullable — Detected project context (name, path, tech stack, current task)
  - `ai_agent_note` string, required — Instructions for AI agents on how to search for more details about this conversation
  - `from_cache` boolean, required — Whether summaries were retrieved from cache (true) or just generated (false)
  - `message_count` integer, nullable — Number of messages summarized (only present if just generated)

## Other responses

- `401` — Unauthorized
- `404` — Session not found or no summary exists
- `422` — Validation Error
- `500` — Internal server error

---

[API](https://skmtc.net/papr-ai/apis/papr-memory-api.md) · [All operations](https://skmtc.net/papr-ai/apis/papr-memory-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/papr-ai/papr-memory-api/revisions/b553be9aad37/schema)
