---
title: "Get Work By Text"
method: GET
path: "/api/works/by-text/{text_id}"
tags: ["works"]
---

# Get Work By Text

`GET /api/works/by-text/{text_id}`

## Request

- Base URL: `https://fojin.app` (the document declares no server; this is the origin it was published from)
- URL: `https://fojin.app/api/works/by-text/{text_id}`
- Auth: none declared

Given a text id, return the Work it belongs to + all its witnesses.

Powers the reader's "其他版本 / 对照本" panel. 404 if the text is not yet
assigned to any work (e.g. imported after the last build_works run).

## Path parameters

- `text_id` integer, required

## Response `200`

Successful Response

- WorkByTextResponse: 给定一条经文，返回它所属作品 + 全部见证本（含自身，前端按需排除自身）。
  - `slug` string, required
  - `title_primary` string, required
  - `title_sa` string, nullable
  - `witness_count` integer
  - `witnesses` WorkWitnessResponse[]
    - `text_id` integer, required
    - `cbeta_id` string, nullable
    - `title` string, nullable
    - `lang` string, required
    - `canon` string, nullable
    - `role` string, required
    - `confidence` string, required
    - `has_content` boolean

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/fojin/apis/fojin-api-buddhist-digital-text-platform.md) · [All operations](https://skmtc.dev/fojin/apis/fojin-api-buddhist-digital-text-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/fojin/apis/fojin-api-buddhist-digital-text-platform/revisions/969714238c61?raw)
