QRCode
テキストやURLからQRコードを生成します。
MCPツール名: generate_qrcode_url
GET /v1/qrcode
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| data | string | ✓ | QRコードに埋め込むテキストまたはURL |
| size | integer | - | 画像サイズpx(75〜1000、デフォルト300) |
| format | string | - | 出力形式(png / svg、デフォルトpng) |
リクエスト例:
curl "https://api.thousand-api.com/v1/qrcode?data=https://example.com&size=300" \
-H "x-api-key: YOUR_API_KEY"レスポンス:
PNG画像またはSVGデータをバイナリで返します。
画像変換
HTTPS URL から画像を取得し、WebP / JPEG / PNG / AVIF への変換・リサイズ・圧縮を行います。結果は Base64 文字列で返します。プライベート IP へのリクエストは SSRF 対策のため拒否されます。
MCPツール名: transform_image
POST /v1/image/transform
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| url | string | ✓ | 変換元画像の HTTPS URL |
| format | string | - | 出力形式: webp / jpeg / png / avif(デフォルト: webp) |
| width | integer | - | リサイズ後の幅 px(1〜4000) |
| height | integer | - | リサイズ後の高さ px(1〜4000) |
| quality | integer | - | 圧縮品質 1〜100(webp/jpeg/avif、デフォルト: 80。png は無視) |
| fit | string | - | リサイズ方式: cover / contain / fill / inside / outside(デフォルト: inside) |
レスポンスフィールド
| パラメータ | 型 | 説明 |
|---|---|---|
| format | string | 変換後のフォーマット |
| width | number | 変換後の幅(px) |
| height | number | 変換後の高さ(px) |
| original_size | number | 変換前のバイト数 |
| converted_size | number | 変換後のバイト数 |
| reduction_rate | number | 削減率(0.6 = 60%削減) |
| data | string | Base64 エンコードされた画像データ |
| mime_type | string | MIME タイプ(例: image/webp) |
WebP 変換のみ
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/image/transform" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.png"
}'レスポンス例:
{
"format": "webp",
"width": 1200,
"height": 800,
"original_size": 245760,
"converted_size": 98304,
"reduction_rate": 0.6,
"data": "UklGRi4AAABXRUJQVlA4...",
"mime_type": "image/webp"
}リサイズ + JPEG + quality
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/image/transform" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.png",
"format": "jpeg",
"width": 800,
"height": 600,
"quality": 85,
"fit": "cover"
}'レスポンス例:
{
"format": "jpeg",
"width": 800,
"height": 600,
"original_size": 245760,
"converted_size": 112640,
"reduction_rate": 0.5417,
"data": "/9j/4AAQSkZJRg...",
"mime_type": "image/jpeg"
}fit パラメータ
| パラメータ | 説明 |
|---|---|
| cover | 指定サイズを覆うようにクロップ(アスペクト比維持) |
| contain | 指定サイズ内に全体が収まるよう縮小 |
| fill | 指定サイズに引き伸ばし(アスペクト比無視) |
| inside | 縦横比を維持しつつ、指定サイズ以内に収める(拡大しない) |
| outside | 縦横比を維持しつつ、指定サイズを覆う最小サイズ(拡大しない) |
HTML や CSS で使う場合は data:image/webp;base64,{data} の形式で埋め込めます。
Markdown→HTML変換
MarkdownテキストをHTMLに変換します。GitHub Flavored Markdown(GFM)対応・XSSサニタイズ対応。
MCPツール名: convert_markdown
POST /v1/convert/markdown
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| markdown | string | ✓ | 変換するMarkdownテキスト(最大100KB) |
| sanitize | boolean | - | HTMLをサニタイズ(デフォルトtrue) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/markdown" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"markdown": "# Hello\n\nThis is **bold** text.",
"sanitize": true
}'レスポンス例:
{
"html": "<h1>Hello</h1>\n<p>This is <strong>bold</strong> text.</p>"
}レスポンスフィールド:
| パラメータ | 説明 |
|---|---|
| html | 変換後のHTML文字列 |
レスポンス:
GFM(テーブル・タスクリスト・取り消し線・コードブロック)に対応。sanitize: false はサーバー側で信頼済みのMarkdownのみに使用してください。ユーザー入力には sanitize: true(デフォルト)を推奨します。
単位変換
長さ・重さ・温度・面積・体積・速度・データ量の単位変換を行います。外部APIへの依存なし・mathjsによる正確な計算。
MCPツール名: convert_unit
対応カテゴリ: 長さ(m, km, mile, foot, inch 等)、重さ(kg, g, lb, oz 等)、温度(celsius, fahrenheit, kelvin)、面積(m2, ha, acre, sqft 等)、体積(l, ml, gallon, cup 等)、速度(m/s, km/h, mph, knot 等)、データ量(byte, KB, MB, GB, TB, KiB, MiB 等)
GET /v1/unit/convert
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| value | number | ✓ | 変換する数値 |
| from | string | ✓ | 変換元単位 |
| to | string | ✓ | 変換先単位 |
リクエスト例:
curl "https://api.thousand-api.com/v1/unit/convert?value=1&from=km&to=mile" \
-H "x-api-key: YOUR_API_KEY"レスポンス例:
{
"value": 1,
"from": "km",
"to": "mile",
"result": 0.621371,
"formula": "1 km = 0.621371 mile"
}Base64エンコード/デコード
文字列のBase64エンコード/デコードを行います。URL-safe形式・UTF-8/hex/base64入力エンコーディングに対応。Node.js標準Bufferのみ使用・外部依存なし。
MCPツール名: convert_base64
url_safe: true の場合、encode時は + → -、/ → _ に変換し末尾の = パディングを除去します。decode時は - → +、_ → / に変換してからパディングを補完してデコードします。JWTペイロードなどURL-safe Base64の解析に使えます。
POST /v1/encode/base64
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| data | string | ✓ | エンコード/デコード対象の文字列(最大512KB) |
| direction | string | ✓ | encode / decode |
| url_safe | boolean | - | URL-safe Base64を使用するか(デフォルト: false) |
| input_encoding | string | - | encode時のdataの文字エンコーディング: utf8 / hex / base64(デフォルト: utf8) |
レスポンスフィールド:
| パラメータ | 型 | 説明 |
|---|---|---|
| direction | string | 処理方向(encode / decode) |
| input | string | リクエストの data をそのまま返す |
| output | string | エンコード/デコード結果 |
| url_safe | boolean | 使用した url_safe の値 |
| byte_length | number | input のバイト数(Buffer.byteLength) |
エンコード例:
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/encode/base64" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "こんにちは",
"direction": "encode"
}'レスポンス例:
{
"direction": "encode",
"input": "こんにちは",
"output": "44GT44KT44Gr44Gh",
"url_safe": false,
"byte_length": 15
}デコード例:
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/encode/base64" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "44GT44KT44Gr44Gh",
"direction": "decode"
}'レスポンス例:
{
"direction": "decode",
"input": "44GT44KT44Gr44Gh",
"output": "こんにちは",
"url_safe": false,
"byte_length": 16
}CSV↔JSON変換
CSVとJSONを相互変換します。ヘッダー有無・区切り文字のカスタマイズに対応。
MCPツール名: convert_csv
タブ区切り(TSV)にも対応します。delimiter に "\t" を指定してください。
POST /v1/convert/csv
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換するデータ(最大1MB) |
| from | string | ✓ | csv / json |
| to | string | ✓ | csv / json |
| has_header | boolean | - | CSVのヘッダー行の有無(デフォルト: true) |
| delimiter | string | - | CSVの区切り文字(デフォルト: ,) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/csv" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "name,age\nAlice,30\nBob,25",
"from": "csv",
"to": "json"
}'レスポンス例:
{
"from": "csv",
"to": "json",
"result": [
{ "name": "Alice", "age": "30" },
{ "name": "Bob", "age": "25" }
],
"rows": 2,
"columns": 2
}YAML↔JSON変換
YAMLとJSONを相互変換します。JSON出力時はインデント幅を指定できます。
MCPツール名: convert_yaml
POST /v1/convert/yaml
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換するデータ(最大1MB) |
| from | string | ✓ | yaml / json |
| to | string | ✓ | yaml / json |
| indent | integer | - | JSON出力時のインデント数(0〜10・デフォルト: 2) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/yaml" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "name: Alice\nage: 30",
"from": "yaml",
"to": "json",
"indent": 2
}'レスポンス例:
{
"from": "yaml",
"to": "json",
"result": "{\n \"name\": \"Alice\",\n \"age\": 30\n}",
"indent": 2
}TOML↔JSON変換
TOMLとJSONを相互変換します。pyproject.toml・Cargo.toml などの設定ファイルの読み書きに使えます。テーブル配列([[...]])やネストテーブル([section])に対応します。
MCPツール名: convert_toml
POST /v1/convert/toml — direction: to_json
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換する TOML 文字列(最大1MB) |
| direction | string | ✓ | to_json |
| indent | integer | - | JSON 出力時のインデント幅(0〜8・デフォルト: 2) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/toml" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "[package]\nname = \"my-crate\"\nversion = \"0.1.0\"\n\n[dependencies]\nserde = \"1.0\"",
"direction": "to_json",
"indent": 2
}'レスポンス例:
{
"direction": "to_json",
"output": {
"package": { "name": "my-crate", "version": "0.1.0" },
"dependencies": { "serde": "1.0" }
},
"output_str": "{\n \"package\": { \"name\": \"my-crate\", \"version\": \"0.1.0\" },\n \"dependencies\": { \"serde\": \"1.0\" }\n}",
"byte_length": 98
}POST /v1/convert/toml — direction: to_toml
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換する JSON 文字列(最大1MB) |
| direction | string | ✓ | to_toml |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/toml" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "{\"title\":\"Thousand API\",\"version\":\"1.0.0\"}",
"direction": "to_toml"
}'レスポンス例:
{
"direction": "to_toml",
"output": "title = \"Thousand API\"\nversion = \"1.0.0\"",
"output_str": "title = \"Thousand API\"\nversion = \"1.0.0\"",
"byte_length": 42
}レスポンスフィールド
| パラメータ | 型 | 説明 |
|---|---|---|
| direction | string | 使用した変換方向(to_json / to_toml) |
| output | any | to_json 時はパース済み JSON オブジェクト、to_toml 時は TOML 文字列 |
| output_str | string | to_json 時は JSON.stringify 済み文字列、to_toml 時は TOML 文字列(output と同値) |
| byte_length | number | output_str の UTF-8 バイト数 |
XML↔JSON変換
XMLとJSONを相互変換します。レガシーAPIレスポンス、AWS/GCP設定、SOAP、RSSなどのXMLデータの読み書きに使えます。属性はプレフィックス付きキー(デフォルト @)で表現します。
MCPツール名: convert_xml
XMLの属性は JSON では attribute_prefix(デフォルト @)付きのキーになります。例: <user id="1"> → { "user": { "@id": 1 } }。to_xml では JSON 側でも同じプレフィックス(例: "@id")を使うと属性として出力されます。
POST /v1/convert/xml — direction: to_json
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換する XML 文字列(最大1MB) |
| direction | string | ✓ | to_json |
| indent | integer | - | JSON 出力時のインデント幅(0〜8・デフォルト: 2) |
| attribute_prefix | string | - | 属性キーのプレフィックス(デフォルト: @) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/xml" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "<user id=\"1\"><name>Alice</name></user>",
"direction": "to_json",
"indent": 2
}'レスポンス例:
{
"direction": "to_json",
"output": {
"user": { "@id": 1, "name": "Alice" }
},
"output_str": "{\n \"user\": {\n \"@id\": 1,\n \"name\": \"Alice\"\n }\n}",
"byte_length": 52
}POST /v1/convert/xml — direction: to_xml
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| input | string | ✓ | 変換する JSON 文字列(最大1MB) |
| direction | string | ✓ | to_xml |
| indent | integer | - | XML 出力時のインデント幅(0〜8・デフォルト: 2) |
| attribute_prefix | string | - | 属性キーのプレフィックス(デフォルト: @) |
リクエスト例:
curl -X POST "https://api.thousand-api.com/v1/convert/xml" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "{\"user\":{\"@id\":1,\"name\":\"Alice\"}}",
"direction": "to_xml",
"indent": 2
}'レスポンス例:
{
"direction": "to_xml",
"output": "<user id=\"1\">\n <name>Alice</name>\n</user>",
"output_str": "<user id=\"1\">\n <name>Alice</name>\n</user>",
"byte_length": 42
}レスポンスフィールド
| パラメータ | 型 | 説明 |
|---|---|---|
| direction | string | 使用した変換方向(to_json / to_xml) |
| output | any | to_json 時はパース済み JSON オブジェクト、to_xml 時は XML 文字列 |
| output_str | string | to_json 時は JSON.stringify 済み文字列、to_xml 時は XML 文字列(output と同値) |
| byte_length | number | output_str の UTF-8 バイト数 |
数値・通貨フォーマット
数値をロケールに合わせてフォーマットします。通貨・パーセント・単位付き表示に対応。Node.js標準のIntl.NumberFormatを使用。
MCPツール名: format_number
GET /v1/format/number
パラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| value | number | ✓ | フォーマットする数値 |
| locale | string | - | ロケール(デフォルト: en-US) |
| style | string | - | decimal / currency / percent / unit |
| currency | string | - | 通貨コード(style=currency時必須) |
| unit | string | - | 単位(style=unit時必須) |
| minimum_fraction_digits | integer | - | 小数点以下の最小桁数(0〜20) |
| maximum_fraction_digits | integer | - | 小数点以下の最大桁数(0〜20) |
リクエスト例:
curl "https://api.thousand-api.com/v1/format/number?value=1234567.89&locale=ja-JP&style=currency¤cy=JPY" \
-H "x-api-key: YOUR_API_KEY"レスポンス例:
{
"value": 1234567.89,
"locale": "ja-JP",
"style": "currency",
"currency": "JPY",
"formatted": "¥1,234,568"
}