Dragon Mandarin API

Access Dragon Mandarin programmatically with our public API.

Getting started

1. Create an account

To use the API, you need a Dragon Mandarin account. Create an account or log in to get started.

2. Generate an API key

Go to your Account → API page to create an API key.

3. Start making requests

Include your API key in the Authorization header of your requests.

Authentication

All API requests must be authenticated using an API key. Include your key in the Authorization header as a Bearer token:

Authorization: Bearer dm_your_api_key_here

Important: Keep your API keys secure. Never share them publicly or commit them to version control.

Base URL

All API endpoints are relative to:

https://dragonmandarin.com/api/public/v1/

Endpoints

POST /articles

Create a new interactive article from arbitrary Chinese text.

Request body

Name Type Description
content string The article content (required, max 30,000 characters, HTML formatting allowed)
title string Title for the article (optional, max 200 characters)
is_public boolean Whether the article is publicly accessible (optional, default: false)

Response

Name Type Description
success boolean Whether the request was successful
article object The created article
uuid string Unique identifier for the article
url string Full URL to read the article
is_public boolean Whether the article is publicly accessible
character_count integer Number of Chinese characters in the article
page_count integer Number of pages in the article

Limits

  • Maximum 30,000 Chinese characters per article
  • Content must contain at least one Chinese character

Example request

curl -X POST "https://dragonmandarin.com/api/public/v1/articles" \
  -H "Authorization: Bearer dm_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"content": "<p>今天天气很好,我想去公园散步。</p>", "title": "A walk in the park"}'

Example response

{
  "success": true,
  "article": {
    "uuid": "aB3dE5fG7hJ9",
    "url": "https://dragonmandarin.com/articles/aB3dE5fG7hJ9/page-1",
    "is_public": false,
    "character_count": 13,
    "page_count": 1
  }
}
POST /tokenize

Tokenize Chinese text into words.

Request body

Name Type Description
text string The Chinese text to tokenize (required, max 3000 Chinese characters)

Response

Name Type Description
success boolean Whether the request was successful
tokens array Array of Chinese words

Limits

  • Maximum 3000 Chinese characters per request
  • Text must contain at least one Chinese character

Example request

curl -X POST "https://dragonmandarin.com/api/public/v1/tokenize" \
  -H "Authorization: Bearer dm_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text": "今天天气很好,我想去公园散步。"}'

Example response

{
  "success": true,
  "tokens": ["今天", "天气", "很", "好", ",", "我", "想", "去", "公园", "散步", "。"]
}

More endpoints coming soon.

Error responses

The API returns standard HTTP status codes to indicate success or failure.

Code Description
200 Success
201 Created - Resource was successfully created
400 Bad request - Invalid parameters (e.g., text too long, no Chinese characters)
401 Unauthorized - Invalid or missing API key
403 Forbidden - API key does not have permission
404 Not found - The requested resource doesn't exist
429 Too many requests - Rate limit exceeded
500 Server error - Something went wrong on our end

Rate limiting

API requests are rate limited to ensure fair usage. If you need higher limits, please contact us.

Support

If you have questions or need help with the API, please contact us.