---
title: "Get Document Session"
method: GET
path: "/api/documents/{document_id}/session"
tags: ["documents"]
---

# Get Document Session

`GET /api/documents/{document_id}/session`

## Request

- Base URL: `https://zsign.io` (the document declares no server; this is the origin it was published from)
- URL: `https://zsign.io/api/documents/{document_id}/session`
- Auth: HTTP bearer

Resolve a document to its signing session.

Exists for the pre-details-page email links: owner-facing viewed/
declined/completion emails sent before the dashboard_url fix deep-linked
to /documents/{document_id}/view -- a frontend route keyed on the
DOCUMENT id. The live envelope page is keyed on the SIGNING SESSION id
(/documents/:sessionId/details), so the /documents/:documentId/view shim
needs this lookup to redirect the old links. An id baked into an already
sent email can never be edited; only the route can change.

A document can back more than one session (a re-sent voided envelope
creates a new session on the same document row -- see
send_response_for_document). The NEWEST session answers "how is my
send doing": viewed/declined emails are status notifications, and the
only safe answer is the attempt currently in flight. When an earlier
session already completed, its id rides along as completed_session_id
so the details page can link to the signed copy -- the route this
replaces served the completed PDF itself (the old DocumentView fetched
GET /{document_id}/download), so a completion email must stay one
click away from its signed document rather than landing on it
silently.

Ownership rides on SigningSession.org_id directly, not _owned_document:
a session can outlive its Document row (the ledger outerjoins Document
for exactly that case, see _base_query), and gating on the document row
would 404 an envelope the caller still owns and can see listed. The
org filter spans every org the caller can switch to, not just the
active one -- a sender who changed teams since sending still owns the
envelope; the response carries the session's org_id so the shim can
run the same switch-team flow as the team menu before landing.

## Path parameters

- `document_id` string, uuid, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/zsign/apis/zsign-api.md) · [All operations](https://skmtc.dev/zsign/apis/zsign-api/llms.txt) · [OpenAPI document](https://skmtc.dev/zsign/apis/zsign-api/revisions/a674ac4137ba?raw)
