canonical: https://jentic.com/apis/ctext.org/ctext

# Ctext Chinese Text Project API

The Chinese Text Project API provides programmatic access to the Chinese Text Project (CTP) digital library of pre-modern Chinese texts, including classical works such as the Analects, the Daodejing, and historical chronicles. Agents can fetch text passages by CTP URN, resolve URNs to canonical web links, look up the URN of a known ctext.org URL, and check the authentication status of an API key. The API uses an apikey query parameter for authentication and returns structured JSON containing text content, citations, and bibliographic context for use in research, translation tooling, and educational applications. ctext.org publishes its own machine-readable function listing at the getcapabilities endpoint on api.ctext.org, in a custom JSON format rather than OpenAPI, so the specification served here is a Jentic-built OpenAPI document covering four of the twelve functions that listing declares.

## For AI agents

Retrieve passages from classical Chinese texts and resolve CTP URNs into citable links via the Chinese Text Project. Useful for AI agents that translate, summarise, or annotate pre-modern Chinese literature.

## Scope

Does not handle modern Chinese news, machine translation, or full-text search across the corpus - use for URN-addressed retrieval of pre-modern Chinese passages only.

## Capabilities

- Retrieve a passage of pre-modern Chinese text by CTP URN via /gettext
- Resolve a CTP URN to a direct ctext.org link via /getlink for citation in research output
- Look up the CTP URN for a given ctext.org page URL via /readlink
- Verify the current authentication status of an API key via /getstatus
- Build agent workflows that quote and cite specific passages from the Analects, Mencius, or other classical texts
- Fetch source material for retrieval-augmented generation over the Chinese classical canon

## Use cases

### Classical Chinese Translation Assistant

An agent that helps users translate or interpret pre-modern Chinese passages can pull authoritative source text from ctext.org by CTP URN. The /gettext endpoint returns the canonical Chinese characters along with bibliographic metadata, so the agent can ground its translation in a verified edition rather than free-form web copies. Useful for translation tooling, comparative reading, and academic research workflows where citation accuracy matters.

Example prompt: Call GET /gettext with the URN ctp:analects/xue-er/1 and return the Chinese text alongside the canonical citation.

### Citation Resolution for Research Papers

Researchers and writing assistants need stable links to primary sources. The /getlink endpoint converts a CTP URN into a direct ctext.org URL, and /readlink reverses the operation. Together they let an agent normalise mixed citations, verify that URLs still resolve, and produce consistent bibliographies for academic submissions on Chinese philosophy, history, or literature.

Example prompt: Given a ctext.org URL pasted by the user, call GET /readlink to obtain the URN and then GET /getlink to confirm the canonical link before adding it to a citation list.

### RAG Over the Chinese Classical Canon

A retrieval-augmented generation pipeline can use the API as a fetch layer for verified passages of classical Chinese texts. By indexing URNs and pulling content on demand via /gettext, the system avoids storing large unlicensed corpora while still giving the language model exact source quotations to ground its answers. Ideal for educational chatbots covering Confucian, Daoist, and Buddhist literature.

Example prompt: For a user question about Mencius 1A.1, fetch the matching passage via GET /gettext and quote it verbatim in the answer with the CTP URN as a citation.

### AI Agent Integration via Jentic

AI agents discover the Chinese Text Project API through Jentic's intent-based search rather than scraping documentation. An agent searches for an intent like 'fetch a classical Chinese passage', loads the operation schema for /gettext, and executes the call with credentials managed by your Jentic One instance, removing the need to bake API keys into prompts or code.

Example prompt: Use Jentic search for 'fetch a classical Chinese text passage', load the ctext.org /gettext schema, and execute it with a CTP URN supplied by the user.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /gettext | Retrieve textual data by CTP URN |
| GET | /getlink | Convert a CTP URN to a direct ctext.org link |
| GET | /readlink | Obtain the CTP URN for a given ctext.org URL |
| GET | /getstatus | Check API key authentication status |

## Key resources

- **Texts** — Retrieve passages of classical Chinese texts by CTP URN.
- **Links** — Convert between CTP URNs and ctext.org URLs.
- **Status** — Check API key authentication state.

## Why Jentic

- **Setup:** Wiring the Chinese Text Project API by hand means appending the apikey query parameter to every request, targeting the api.ctext.org host, and handling retries and URN formatting yourself. Through Jentic you install once, import the Chinese Text Project API from the API Directory, store the API key once, and your agent calls it.
- **Permission scoping:** This surface is read-only, with the passage selected by URN in the query rather than an id in the URL path, so limit the agent to the operations it needs, such as fetching text or resolving a link. You choose which of those retrieval operations are in scope.
- **Credential handling:** Your ctext.org API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'fetch a classical Chinese text passage', and Jentic returns the matching ctext.org operation with its input schema so the agent calls the right endpoint without browsing the reference docs or guessing URN formats.

## Related APIs

- **Internet Archive Search API** — Internet Archive search complements ctext.org by providing scanned editions and broader historical materials.
- **Wayback Machine API** — Wayback Machine retrieves archived snapshots of ctext.org pages when stable URLs are needed.
- **Wikimedia API** — Wikimedia exposes Wikisource and related projects, an alternative source of classical Chinese texts.

## FAQ

### What authentication does the Chinese Text Project API use?

The API requires an API key passed as the apikey query parameter on every request. Through Jentic, the key is stored in your encrypted Jentic One instance and never enters the agent's prompt context, so it cannot leak through model outputs or logs.

### Can I fetch the full text of the Analects with the Chinese Text Project API?

Yes. The GET /gettext endpoint accepts a CTP URN such as ctp:analects/xue-er/1 and returns the canonical Chinese text along with metadata. You request individual passages by URN rather than dumping the full work in one call.

### What are the rate limits for the Chinese Text Project API?

No numeric rate limit is published in the OpenAPI spec. The vendor states that the frequency of API requests for textual data is limited according to user group, naming unauthenticated users, CTP account users and institutional subscribers, and documents the getstatus function as the way to determine a user's current status. An agent can call GET /getstatus before running a large batch.

### How do I retrieve a classical Chinese passage with the Chinese Text Project API through Jentic?

Install self-hosted Jentic One, import the Chinese Text Project API from the API Directory, and store your ctext.org key once. Your agent then searches by intent, such as 'fetch a classical Chinese text passage', loads the schema for GET /gettext, and executes it with the CTP URN you want. Jentic returns the JSON response and supplies the apikey query parameter at call time, so you never manage it in agent code.

### How do I convert between a CTP URN and a ctext.org URL?

Use GET /getlink to turn a URN into a direct ctext.org link, and GET /readlink to recover the URN from a ctext.org page URL. This pair is useful for normalising citations in research outputs.

### Is the Chinese Text Project API free?

The vendor states that all users are welcome to make use of the API, and that the frequency of requests for textual data is limited according to user group: unauthenticated users can access a limited amount of data, CTP account users a larger amount, and institutional subscribers get access as provided by their institutional agreement. Call GET /getstatus to see which applies to the current key or session.

### Is there a Chinese Text Project MCP server?

You don't need an MCP server to give your agent the Chinese Text Project API. Jentic connects it directly from the API Directory: import it, store your ctext.org key once, and your agent can fetch passages by CTP URN and convert between URNs and ctext.org links, with no extra tool definitions loaded into its context.

### Can I limit what my agent is allowed to do with the Chinese Text Project API?

Yes. Because you run your own self-hosted Jentic One instance, your rules decide which of this read-only API's operations the agent may call and which credentials it may use. You can grant only what a task needs, such as fetching a passage with GET /gettext, while withholding link resolution via GET /getlink and GET /readlink or the key check via GET /getstatus. Since passages are selected by URN in the query rather than an id in the URL path, scoping stays at the operation level and the agent cannot reach anything you have not put in scope.
