Template
Renders a template string with {{variable}} placeholders using a variables object. Supports dot notation for nested objects (e.g. {{user.name}}). Undefined variables remain as placeholders and are listed in `variables_missing`.
MCP tool: render_template
POST /v1/template/render
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| template | string | ✓ | Template string to render (max 100KB) |
| variables | object | - | Variables object for substitution (defaults to empty object) |
Request example:
curl -X POST "https://api.thousand-api.com/v1/template/render" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "Hello, {{name}}.",
"variables": {"name": "Alice"}
}'Response example:
{
"rendered": "Hello, Alice.",
"variables_missing": []
}Response:
When variables are undefined, placeholders remain in rendered and paths are listed in variables_missing. Numbers and booleans are converted to strings.
String Case
Convert between camel, snake, kebab, pascal, constant, title, and related cases. Input case is auto-detected. Use to=all to fetch all variants at once.
MCP tool: convert_string_case
GET /v1/string/case
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | ✓ | String to convert |
| to | string | ✓ | camel / snake / kebab / pascal / constant / title / lower / upper / all |
Request example:
curl "https://api.thousand-api.com/v1/string/case?text=hello_world_foo&to=camel" \
-H "x-api-key: YOUR_API_KEY"Response example:
{
"text": "hello_world_foo",
"to": "camel",
"detected_case": "snake",
"result": "helloWorldFoo"
}Response:
When to=all, result is an object keyed by case name. For strings containing non-ASCII characters (e.g. Japanese), only lower and upper are transformed; other cases return the input unchanged.
Random String
Generates cryptographically secure random strings. Configurable charset, length, and count. Uses Node.js built-in crypto.
MCP tool: generate_random_string
GET /v1/random/string
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| length | integer | - | String length (default: 16, max: 128) |
| charset | string | - | alphanumeric / alphabetic / numeric / hex / urlsafe / uppercase |
| count | integer | - | Number of strings to generate (default: 1, max: 10) |
Request example:
curl "https://api.thousand-api.com/v1/random/string?length=8&charset=uppercase&count=3" \
-H "x-api-key: YOUR_API_KEY"Response example:
{
"length": 8,
"charset": "uppercase",
"count": 3,
"results": ["AB3K7MN2", "PQ9XL4WZ", "R7MN2PQ9"]
}Response:
Generated strings are suitable for session tokens, temporary passwords, and invite codes. For production cryptographic keys, use purpose-appropriate key generation (e.g. crypto.generateKeyPair).
Text Stats
Extract plain text from HTML, return text statistics, compute line-based diffs, or generate URL-safe slugs from human-readable titles.
MCP tools: extract_text_from_html, get_text_stats, diff_text, generate_slug
POST /v1/text/html-to-text
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| html | string | ✓ | HTML text to extract (max 1MB) |
| max_length | integer | - | Optional maximum character count for output (positive integer) |
| preserve_links | boolean | - | When true, return a list of { text, href } links (default false) |
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/html-to-text" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Hello</h1><p>Visit <a href=\"https://example.com\">Example</a></p>",
"max_length": 500,
"preserve_links": true
}'Response example:
{
"text": "Hello\n\nVisit Example",
"char_count": 19,
"truncated": false,
"links": [
{
"text": "Example",
"href": "https://example.com"
}
]
}Response fields:
| Parameter | Description |
|---|---|
| text | Plain text with tags removed, entities decoded, and whitespace normalized |
| char_count | Character count of text |
| truncated | True when max_length truncated the output |
| links | Present only when preserve_links is true; array of { text, href } |
Response:
script and style tags (including their contents) are removed entirely. Block elements (p, div, h1–h6, li, etc.) become line breaks; three or more consecutive newlines are compressed to two. Useful for reducing tokens from HTML fetched via the Scraper tool.
POST /v1/text/stats
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | ✓ | Text to analyze (max 100KB) |
| lang | string | - | Language code (ja / en, default en) |
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/stats" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "AI agents need reliable MCP utilities.",
"lang": "en"
}'Response example:
{
"characters": 42,
"characters_no_spaces": 37,
"words": 7,
"sentences": 1,
"paragraphs": 1,
"reading_time_seconds": 2
}Response fields:
| Parameter | Description |
|---|---|
| characters | Total character count (includes spaces and newlines) |
| characters_no_spaces | Character count excluding spaces, tabs, and newlines |
| words | Word count (ja: non-whitespace characters; en: space-separated tokens) |
| sentences | Sentence count (ja: 。!?; en: .!?) |
| paragraphs | Paragraph count (split on blank lines) |
| reading_time_seconds | Estimated reading time in seconds (rounded up) |
Response:
Reading speed: ja uses 500 characters/min (characters_no_spaces); en uses 225 words/min (words). No external APIs required.
POST /v1/text/diff
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| original | string | ✓ | Original text to compare (max 256KB) |
| modified | string | ✓ | Modified text to compare against (max 256KB) |
| context_lines | integer | - | Context lines around changes (0–10, default 3) |
| format | string | - | Output format (unified / json, default unified) |
Example: format "unified" (unified diff string)
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/diff" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"original": "line1\nline2\nline3\n",
"modified": "line1\nline3\nline4\n",
"context_lines": 3,
"format": "unified"
}'Response example:
{
"diff": "===================================================================\n@@ -1,3 +1,3 @@\n line1\n-line2\n line3\n+line4\n",
"added_lines": 1,
"removed_lines": 1,
"has_changes": true
}Example: format "json" (structured chunks)
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/diff" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"original": "alpha\nbeta\n",
"modified": "alpha\ngamma\n",
"format": "json"
}'Response example:
{
"diff": [
{ "type": "unchanged", "lines": ["alpha"] },
{ "type": "removed", "lines": ["beta"] },
{ "type": "added", "lines": ["gamma"] }
],
"added_lines": 1,
"removed_lines": 1,
"has_changes": true
}Response fields:
| Parameter | Description |
|---|---|
| diff | Unified diff string when format is unified (--- / +++ header lines removed), or an array of { type, lines } when format is json |
| added_lines | Number of lines added |
| removed_lines | Number of lines removed |
| has_changes | True when any line was added or removed |
Response:
Line-based diff. Useful for code review, comparing AI-generated text to the original, and summarizing document revisions. MCP tool: diff_text
POST /v1/text/slugify
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | ✓ | Text to slugify (max 1000 characters) |
| locale | string | - | ja (default): romanize Japanese with Hepburn before slugify; en and others: skip romanization |
| separator | string | - | Word separator (- / _ / ., default -) |
| max_length | integer | - | Maximum slug length (1–200) |
| lowercase | boolean | - | Lowercase the slug (default true) |
convert_string_case (GET /v1/string/case) converts existing ASCII identifiers between camel, snake, kebab, and similar cases; Japanese only supports lower/upper. This API targets URL paths, document IDs, and navigation keys from human-readable titles, romanizing Japanese when locale is ja via kuromoji + kuroshiro before normalization.
MCP tool: generate_slug
Example 1: Japanese title (locale: ja)
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/slugify" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Thousand API — 祝日カレンダー機能",
"locale": "ja"
}'Response example:
{
"input": "Thousand API — 祝日カレンダー機能",
"slug": "thousand-api-shukujitsu-karendaa-kinou",
"truncated": false,
"char_replaced": ["—"]
}Example 2: English text (locale: en)
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/slugify" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello World! This is a Test.",
"locale": "en"
}'Response example:
{
"input": "Hello World! This is a Test.",
"slug": "hello-world-this-is-a-test",
"truncated": false,
"char_replaced": ["!", "."]
}Example 3: separator and max_length
Request example:
curl -X POST "https://api.thousand-api.com/v1/text/slugify" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "My Long Document Title Here And More",
"locale": "en",
"separator": "_",
"max_length": 30
}'Response example:
{
"input": "My Long Document Title Here And More",
"slug": "my_long_document_title_here",
"truncated": true,
"char_replaced": []
}Response fields:
| Parameter | Description |
|---|---|
| input | The request text echoed back |
| slug | Generated URL-safe slug |
| truncated | True when max_length truncated the slug |
| char_replaced | Characters removed or replaced (unique, order of first appearance) |
Response:
Japanese processing uses the same Lambda as /v1/ja/convert (kuromoji dictionary). The first request after a cold start may take several seconds.
Japanese Text Conversion
Convert Japanese text to hiragana, katakana, or romaji. Uses kuromoji morphological analysis for accurate conversion of proper nouns.
MCP tool: convert_japanese
GET /v1/ja/convert
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | ✓ | Japanese text to convert (max 1000 characters) |
| to | string | ✓ | hiragana / katakana / romaji |
Request example:
curl "https://api.thousand-api.com/v1/ja/convert?text=%E6%9D%B1%E4%BA%AC%E9%83%BD%E6%B8%8B%E8%B0%B7%E5%8C%BA&to=hiragana" \
-H "x-api-key: YOUR_API_KEY"Response example:
{
"text": "東京都渋谷区",
"to": "hiragana",
"result": "とうきょうとしぶやく"
}Regular Expression Tester
Tests a regular expression pattern against text and returns match results. Supports named capture groups and common flags. ReDoS protection included.
MCP tool: test_regex
POST /v1/regex/test
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| pattern | string | ✓ | Regular expression pattern without delimiters |
| text | string | ✓ | Text to test (max 10,000 characters) |
| flags | string | - | Combination of g / i / m / s / u |
Request example:
curl -X POST "https://api.thousand-api.com/v1/regex/test" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pattern": "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})",
"text": "2026-05-29",
"flags": ""
}'Response example:
{
"pattern": "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})",
"flags": "",
"text": "2026-05-29",
"matched": true,
"match_count": 1,
"matches": [
{
"value": "2026-05-29",
"index": 0,
"groups": {
"year": "2026",
"month": "05",
"day": "29"
}
}
]
}