Conversion & formatting

QRCode

Generates QR codes from text or URLs.

MCP tool: generate_qrcode_url

GET /v1/qrcode

Parameters:

ParameterTypeRequiredDescription
datastringText or URL to encode
sizeinteger-Image size in px (75–1000, default 300)
formatstring-Output format (png / svg, default png)

Request example:

curl "https://api.thousand-api.com/v1/qrcode?data=https://example.com&size=300" \
  -H "x-api-key: YOUR_API_KEY"

Response:

Returns PNG image or SVG data as binary.

Image Transform

Fetches an image from an HTTPS URL and converts, resizes, and/or compresses it to WebP, JPEG, PNG, or AVIF. Returns Base64-encoded data. Requests to private IP addresses are blocked (SSRF protection).

MCP tool: transform_image

POST /v1/image/transform

Parameters:

ParameterTypeRequiredDescription
urlstringHTTPS URL of the source image
formatstring-Output format: webp / jpeg / png / avif (default: webp)
widthinteger-Target width in px (1–4000)
heightinteger-Target height in px (1–4000)
qualityinteger-Compression quality 1–100 (webp/jpeg/avif, default 80; ignored for png)
fitstring-Resize fit: cover / contain / fill / inside / outside (default: inside)

Response fields

ParameterTypeDescription
formatstringOutput format
widthnumberOutput width (px)
heightnumberOutput height (px)
original_sizenumberSource size in bytes
converted_sizenumberOutput size in bytes
reduction_ratenumberSize reduction ratio (0.6 = 60% smaller)
datastringBase64-encoded image data
mime_typestringMIME type (e.g. image/webp)

WebP conversion only

Request example:

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"
  }'

Response example:

{
  "format": "webp",
  "width": 1200,
  "height": 800,
  "original_size": 245760,
  "converted_size": 98304,
  "reduction_rate": 0.6,
  "data": "UklGRi4AAABXRUJQVlA4...",
  "mime_type": "image/webp"
}

Resize + JPEG + quality

Request example:

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"
  }'

Response example:

{
  "format": "jpeg",
  "width": 800,
  "height": 600,
  "original_size": 245760,
  "converted_size": 112640,
  "reduction_rate": 0.5417,
  "data": "/9j/4AAQSkZJRg...",
  "mime_type": "image/jpeg"
}

fit parameter

ParameterDescription
coverCrop to cover the target box (preserve aspect ratio)
containFit entirely inside the target box
fillStretch to exact width and height (ignore aspect ratio)
insideFit inside the box without enlarging (default)
outsideMinimum size that covers the box without enlarging

Embed in HTML/CSS as data:image/webp;base64,{data}.

Markdown Convert

Converts Markdown text to HTML. GitHub Flavored Markdown (GFM) supported with optional XSS sanitization.

MCP tool: convert_markdown

POST /v1/convert/markdown

Parameters:

ParameterTypeRequiredDescription
markdownstringMarkdown text to convert (max 100KB)
sanitizeboolean-Sanitize HTML output (default true)

Request example:

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
  }'

Response example:

{
  "html": "<h1>Hello</h1>\n<p>This is <strong>bold</strong> text.</p>"
}

Response fields:

ParameterDescription
htmlConverted HTML string

Response:

Supports GFM (tables, task lists, strikethrough, fenced code blocks). Use sanitize: false only for trusted Markdown on the server side; for user input, keep sanitize: true (default).

Unit Conversion

Converts values between units for length, mass, temperature, area, volume, speed, and data sizes. No external APIs; accurate math via mathjs.

MCP tool: convert_unit

Categories: length (m, km, mile, foot, inch, etc.), mass (kg, g, lb, oz, etc.), temperature (celsius, fahrenheit, kelvin), area (m2, ha, acre, sqft, etc.), volume (l, ml, gallon, cup, etc.), speed (m/s, km/h, mph, knot, etc.), data (byte, KB, MB, GB, TB, KiB, MiB, etc.)

GET /v1/unit/convert

Parameters:

ParameterTypeRequiredDescription
valuenumberValue to convert
fromstringSource unit
tostringTarget unit

Request example:

curl "https://api.thousand-api.com/v1/unit/convert?value=1&from=km&to=mile" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "value": 1,
  "from": "km",
  "to": "mile",
  "result": 0.621371,
  "formula": "1 km = 0.621371 mile"
}

Base64 Encode/Decode

Encode or decode Base64 strings. Supports URL-safe variant and utf8/hex/base64 input encodings on encode. Uses Node.js Buffer only with no external dependencies.

MCP tool: convert_base64

When url_safe is true, encode replaces + with - and / with _ and strips trailing = padding. Decode reverses those substitutions and restores padding before decoding. Useful for JWT payload segments and other URL-safe Base64 data.

POST /v1/encode/base64

Parameters:

ParameterTypeRequiredDescription
datastringString to encode or decode (max 512KB)
directionstringencode / decode
url_safeboolean-Use URL-safe Base64 (default: false)
input_encodingstring-Input encoding when direction is encode: utf8 / hex / base64 (default: utf8)

Response fields:

ParameterTypeDescription
directionstringProcessing direction (encode / decode)
inputstringOriginal request data value
outputstringEncoded or decoded result
url_safebooleanWhether URL-safe Base64 was used
byte_lengthnumberByte length of input (Buffer.byteLength)

Encode example:

Request example:

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": "Hello, world!",
    "direction": "encode"
  }'

Response example:

{
  "direction": "encode",
  "input": "Hello, world!",
  "output": "SGVsbG8sIHdvcmxkIQ==",
  "url_safe": false,
  "byte_length": 13
}

Decode example:

Request example:

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": "SGVsbG8sIHdvcmxkIQ==",
    "direction": "decode"
  }'

Response example:

{
  "direction": "decode",
  "input": "SGVsbG8sIHdvcmxkIQ==",
  "output": "Hello, world!",
  "url_safe": false,
  "byte_length": 20
}

CSV ↔ JSON Conversion

Convert between CSV and JSON. Supports header rows and custom delimiters.

MCP tool: convert_csv

Tab-separated values (TSV) are supported by setting delimiter to "\t".

POST /v1/convert/csv

Parameters:

ParameterTypeRequiredDescription
inputstringData to convert (max 1MB)
fromstringcsv / json
tostringcsv / json
has_headerboolean-Whether the first CSV row is a header (default: true)
delimiterstring-CSV field delimiter (default: comma)

Request example:

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"
  }'

Response example:

{
  "from": "csv",
  "to": "json",
  "result": [
    { "name": "Alice", "age": "30" },
    { "name": "Bob",   "age": "25" }
  ],
  "rows": 2,
  "columns": 2
}

YAML ↔ JSON Conversion

Convert between YAML and JSON. Control JSON output indentation with the indent parameter.

MCP tool: convert_yaml

POST /v1/convert/yaml

Parameters:

ParameterTypeRequiredDescription
inputstringData to convert (max 1MB)
fromstringyaml / json
tostringyaml / json
indentinteger-JSON output indentation (0–10, default 2)

Request example:

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
  }'

Response example:

{
  "from": "yaml",
  "to": "json",
  "result": "{\n  \"name\": \"Alice\",\n  \"age\": 30\n}",
  "indent": 2
}

TOML ↔ JSON Conversion

Convert between TOML and JSON. Useful for pyproject.toml, Cargo.toml, and other config files. Supports nested tables ([section]) and table arrays ([[...]]).

MCP tool: convert_toml

POST /v1/convert/toml — direction: to_json

Parameters:

ParameterTypeRequiredDescription
inputstringTOML string to convert (max 1MB)
directionstringto_json
indentinteger-JSON indentation width (0–8, default 2)

Request example:

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
  }'

Response example:

{
  "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

Parameters:

ParameterTypeRequiredDescription
inputstringJSON string to convert (max 1MB)
directionstringto_toml

Request example:

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"
  }'

Response example:

{
  "direction": "to_toml",
  "output": "title = \"Thousand API\"\nversion = \"1.0.0\"",
  "output_str": "title = \"Thousand API\"\nversion = \"1.0.0\"",
  "byte_length": 42
}

Response fields

ParameterTypeDescription
directionstringConversion direction used (to_json / to_toml)
outputanyParsed JSON object when to_json; TOML string when to_toml
output_strstringJSON.stringify result when to_json; TOML text when to_toml (same as output for to_toml)
byte_lengthnumberUTF-8 byte length of output_str

XML ↔ JSON Conversion

Convert between XML and JSON. Useful for legacy API responses, AWS/GCP configs, SOAP payloads, RSS feeds, and other XML data. Attributes are represented with a configurable prefix (default @).

MCP tool: convert_xml

XML attributes become JSON keys with attribute_prefix (default @). Example: <user id="1"> → { "user": { "@id": 1 } }. For to_xml, use the same prefix in JSON (e.g. "@id") to emit XML attributes.

POST /v1/convert/xml — direction: to_json

Parameters:

ParameterTypeRequiredDescription
inputstringXML string to convert (max 1MB)
directionstringto_json
indentinteger-JSON output indentation (0–8, default 2)
attribute_prefixstring-Prefix for attribute keys (default @)

Request example:

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
  }'

Response example:

{
  "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

Parameters:

ParameterTypeRequiredDescription
inputstringJSON string to convert (max 1MB)
directionstringto_xml
indentinteger-XML output indentation (0–8, default 2)
attribute_prefixstring-Prefix for attribute keys (default @)

Request example:

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
  }'

Response example:

{
  "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
}

Response fields

ParameterTypeDescription
directionstringConversion direction used (to_json / to_xml)
outputanyParsed JSON object when to_json; XML string when to_xml
output_strstringFormatted JSON string when to_json; XML string when to_xml (same as output for to_xml)
byte_lengthnumberUTF-8 byte length of output_str

Number & Currency Formatting

Formats numbers for a locale. Supports currency, percent, and unit display using Node.js Intl.NumberFormat.

MCP tool: format_number

GET /v1/format/number

Parameters:

ParameterTypeRequiredDescription
valuenumberNumber to format
localestring-Locale (default: en-US)
stylestring-decimal / currency / percent / unit
currencystring-Currency code (required when style=currency)
unitstring-Unit (required when style=unit)
minimum_fraction_digitsinteger-Minimum fraction digits (0–20)
maximum_fraction_digitsinteger-Maximum fraction digits (0–20)

Request example:

curl "https://api.thousand-api.com/v1/format/number?value=1234567.89&locale=ja-JP&style=currency&currency=JPY" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "value": 1234567.89,
  "locale": "ja-JP",
  "style": "currency",
  "currency": "JPY",
  "formatted": "¥1,234,568"
}