Chinese Text Project API

⭐ Beginner's Pick Dictionaries / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

Chinese Text Project offers a free API to access a massive digital library of pre-modern Chinese texts, including classics like the Analects and Tao Te Ching. You can retrieve chapter content, search for passages, and look up textual metadata without any API key. It is a great starting point for digital humanities projects or anyone studying classical Chinese literature.

💡

Beginner Tip

Use the gettext operation to fetch the content of a specific text section by its CTP identifier (e.g., analects/1). Response data is returned as JSON with nested chapter and passage objects.

Available Data

repository name and description
star and fork counts
contributor data
issues and pull requests
commit history

Example Response

JSON Response
{
  "title": "The Great Gatsby",
  "authors": [
    "F. Scott Fitzgerald"
  ],
  "publishedDate": "1925-04-10",
  "pageCount": 218,
  "categories": [
    "Fiction"
  ],
  "imageLinks": {
    "thumbnail": "https://books.google.com/..."
  },
  "averageRating": 4
}

Field Reference

result Indicates success or failure of the API operation.
urn Unique resource name identifying the text in the CTP database.
title Title of the retrieved text or chapter.
text Array of passage objects each containing line number and Chinese text content.
en English translation of the passage, if available.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://ctext.org/tools/api";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

error: invalid request A required parameter such as op or urn is missing or misspelled.
Double-check that op is set to a valid operation (e.g., gettext, gettextinfo) and that urn follows the ctext URN format.
Returned HTML instead of JSON The format=json parameter was omitted from the request.
Always append &format=json to receive machine-readable JSON output.
Empty result for a known text The text identifier or URN does not exactly match the CTP database entry.
Browse https://ctext.org to find the exact URN for the text you want before querying.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 1218ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Dictionaries
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →