---
title: "Close (remove) a document from a multi-document session."
method: DELETE
path: "/v1/sessions/{session_id}/documents/{document_id}"
tags: ["v1", "mcp", "sessions"]
---

# Close (remove) a document from a multi-document session.

`DELETE /v1/sessions/{session_id}/documents/{document_id}`

## Request

- Base URL: `https://api.superdocs.app`
- URL: `https://api.superdocs.app/v1/sessions/{session_id}/documents/{document_id}`
- Auth: HTTP bearer

Remove document_id from the session's open documents (the tab close button). If it's the
focused document, focus another open document — `next_focus` if it's still open (so the client
can pick the adjacent tab), else the next remaining one; closing the last document leaves the
session empty. Returns the updated document roster + the now-focused document's HTML.

The close takes effect immediately and is persisted, so a later reconnect or session restore
won't bring the closed document back. Persistence is best-effort — a failure is logged, not
fatal (the close still holds for the active session).

## Path parameters

- `session_id` string, required
- `document_id` string, required

## Query parameters

- `next_focus` string, nullable
- `include_html` boolean: Include each document's full reassembled HTML body. Default false (token-light — recommended for AI agents enumerating or switching tabs): returns only ids, title, section count, focused flag, and page setup, omitting the body which can be hundreds of KB per document. The web app passes true to render document content.

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/superdocs/apis/universal-document-ai-api.md) · [All operations](https://skmtc.dev/superdocs/apis/universal-document-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/superdocs/apis/universal-document-ai-api/revisions/37d03122940b?raw)
