Developer utilities

Distance

Calculates distance between two points.

MCP tool: calculate_distance

GET /v1/distance

Parameters:

ParameterTypeRequiredDescription
p1stringPoint 1 lat,lon (e.g. 35.681236,139.767125)
p2stringPoint 2 lat,lon (e.g. 34.702485,135.495951)

Request example:

curl "https://api.thousand-api.com/v1/distance?p1=35.681236,139.767125&p2=34.702485,135.495951" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "p1": { "lat": 35.681236, "lon": 139.767125 },
  "p2": { "lat": 34.702485, "lon": 135.495951 },
  "distance_km": 402.3
}

Coordinate conversion

Convert coordinates between WGS84 (GPS), Tokyo Datum (legacy Japanese geodetic system), JGD2011, and GSI/OSM/Google XYZ map tile coordinates. No external libraries; uses Molodensky approximation parameters.

MCP tool: utility.convert_coordinates

WGS84 is the standard GPS coordinate system. Tokyo Datum (tokyo) was used on legacy GSI maps and government systems and can differ from WGS84 by up to about 450 m. JGD2011 (jgd2011) is practically identical to WGS84 but is accepted as a separate datum for future parameter updates. For tile conversion (to=tile), coordinates are normalized to WGS84 before Web Mercator XYZ tile calculation.

GET /v1/geo/convert

Parameters:

ParameterTypeRequiredDescription
latnumberLatitude (-90 to 90)
lngnumberLongitude (-180 to 180)
fromstringSource datum: wgs84 / tokyo / jgd2011
tostringTarget datum: wgs84 / tokyo / jgd2011 / tile
zoominteger-Required when to=tile. Zoom level (integer 0–25)

Response fields:

When converting between datums (to is wgs84 / tokyo / jgd2011), output contains:

ParameterDescription
latConverted latitude (rounded to 8 decimal places)
lngConverted longitude (rounded to 8 decimal places)

When to is tile, output contains:

ParameterDescription
zoomZoom level from the request
xTile X index (longitude axis, zero-based)
yTile Y index (latitude axis; smaller values are farther north)

Request example:

Example 1: WGS84 → Tokyo Datum (convert GPS to legacy Japanese datum)

curl "https://api.thousand-api.com/v1/geo/convert?lat=35.6812&lng=139.7671&from=wgs84&to=tokyo" \
  -H "x-api-key: YOUR_API_KEY"
{
  "from": "wgs84",
  "to": "tokyo",
  "input": { "lat": 35.6812, "lng": 139.7671 },
  "output": { "lat": 35.68109304, "lng": 139.76727453 }
}

Example 2: Tokyo Datum → WGS84 (legacy data to GPS coordinates)

curl "https://api.thousand-api.com/v1/geo/convert?lat=35.68109304&lng=139.76727453&from=tokyo&to=wgs84" \
  -H "x-api-key: YOUR_API_KEY"
{
  "from": "tokyo",
  "to": "wgs84",
  "input": { "lat": 35.68109304, "lng": 139.76727453 },
  "output": { "lat": 35.6812, "lng": 139.7671 }
}

Example 3: WGS84 → tile coordinates (zoom=15, GSI-style XYZ)

curl "https://api.thousand-api.com/v1/geo/convert?lat=35.6812&lng=139.7671&from=wgs84&to=tile&zoom=15" \
  -H "x-api-key: YOUR_API_KEY"
{
  "from": "wgs84",
  "to": "tile",
  "input": { "lat": 35.6812, "lng": 139.7671 },
  "output": { "zoom": 15, "x": 29105, "y": 12903 }
}

Color Palette

Generates color palettes (complementary, analogous, triadic, tetradic, shades) from a base hex color. No external dependencies; uses HSL color space for mathematically accurate results.

MCP tool: utility.generate_color_palette

GET /v1/color/palette

Parameters:

ParameterTypeRequiredDescription
colorstringBase color in #RRGGBB format
typestring-complementary / analogous / triadic / tetradic / shades

Request example:

curl "https://api.thousand-api.com/v1/color/palette?color=%231976D2&type=complementary" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "base": "#1976D2",
  "type": "complementary",
  "palette": [
    {
      "hex": "#1976D2",
      "rgb": "rgb(25, 118, 210)",
      "hsl": "hsl(211, 79%, 46%)",
      "name": "base"
    },
    {
      "hex": "#D27619",
      "rgb": "rgb(210, 118, 25)",
      "hsl": "hsl(31, 79%, 46%)",
      "name": "complement"
    }
  ]
}

Color Space Conversion

Converts colors between HEX, RGB, HSL, HSV, and CMYK. All conversions use RGB as an intermediate for consistent results. No external dependencies; pure conversion formulas only.

MCP tool: convert.color

Pass the returned hex values to utility.calc_color_contrast as foreground/background to verify accessibility of colors obtained from HSL or CMYK. Combine with utility.generate_color_palette for palette generation → format conversion → contrast checking workflows.

GET /v1/color/convert

Parameters:

ParameterTypeRequiredDescription
colorstringSource color value (format depends on from)
fromstringSource format: hex / rgb / hsl / hsv / cmyk
color (hex)string-#1976D2 / 1976D2 / #FFF / FFF (3-digit shorthand)
color (rgb)string-25,118,210 / 25, 118, 210 / rgb(25, 118, 210) / {"r":25,"g":118,"b":210}
color (hsl)string-210,79,46 / 210, 79, 46 / hsl(210, 79%, 46%)
color (hsv)string-210,88,82 / 210, 88, 82
color (cmyk)string-88,44,0,18 / 88, 44, 0, 18

Response fields:

ParameterDescription
input.formatInput format (hex / rgb / hsl / hsv / cmyk)
input.valueOriginal input color string (echoed back)
hexNormalized HEX (uppercase #RRGGBB)
rgb.r / g / bRGB components (0–255)
hsl.hHue (0–360)
hsl.s / lSaturation and lightness (0–100)
hsv.hHue (0–360)
hsv.s / vSaturation and value (0–100)
cmyk.c / m / y / kInk components (0–100)

Request example:

Example 1: Convert HEX to all formats (#1976D2)

curl "https://api.thousand-api.com/v1/color/convert?color=%231976D2&from=hex" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "input": { "format": "hex", "value": "#1976D2" },
  "hex": "#1976D2",
  "rgb": { "r": 25, "g": 118, "b": 210 },
  "hsl": { "h": 210, "s": 79, "l": 46 },
  "hsv": { "h": 210, "s": 88, "v": 82 },
  "cmyk": { "c": 88, "m": 44, "y": 0, "k": 18 }
}

Example 2: Convert HSL to RGB and HEX (CSS variable use case)

curl "https://api.thousand-api.com/v1/color/convert?color=hsl(210%2C%2079%25%2C%2046%25)&from=hsl" \
  -H "x-api-key: YOUR_API_KEY"
{
  "input": { "format": "hsl", "value": "hsl(210, 79%, 46%)" },
  "hex": "#1975D2",
  "rgb": { "r": 25, "g": 117, "b": 210 },
  "hsl": { "h": 210, "s": 79, "l": 46 },
  "hsv": { "h": 210, "s": 88, "v": 82 },
  "cmyk": { "c": 88, "m": 44, "y": 0, "k": 18 }
}

Example 3: Convert CMYK to web color (print data)

curl "https://api.thousand-api.com/v1/color/convert?color=88%2C44%2C0%2C18&from=cmyk" \
  -H "x-api-key: YOUR_API_KEY"
{
  "input": { "format": "cmyk", "value": "88,44,0,18" },
  "hex": "#1975D1",
  "rgb": { "r": 25, "g": 117, "b": 209 },
  "hsl": { "h": 210, "s": 79, "l": 46 },
  "hsv": { "h": 210, "s": 88, "v": 82 },
  "cmyk": { "c": 88, "m": 44, "y": 0, "k": 18 }
}

WCAG Color Contrast

Calculates the WCAG 2.1 contrast ratio between a foreground and background color and returns AA/AAA compliance flags plus a recommendation string. No external dependencies; uses the official relative luminance algorithm.

MCP tool: utility.calc_color_contrast

WCAG 2.1 thresholds: AA normal text 4.5:1, AA large text / UI 3:1, AAA normal text 7:1, AAA large text 4.5:1. Large text means 18pt+ or 14pt+ bold.

Pair palette hex values from utility.generate_color_palette as foreground/background and call this API to filter down to accessible combinations in agent workflows.

GET /v1/color/contrast

Parameters:

ParameterTypeRequiredDescription
foregroundstringForeground HEX (#RRGGBB, RRGGBB, or 3-digit shorthand)
backgroundstringBackground HEX (#RRGGBB, RRGGBB, or 3-digit shorthand)

Request example:

curl "https://api.thousand-api.com/v1/color/contrast?foreground=%23FFFFFF&background=%231976D2" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

Example 1: Sufficient contrast (#FFFFFF / #1976D2)

{
  "foreground": "#FFFFFF",
  "background": "#1976D2",
  "contrast_ratio": 4.6,
  "wcag_aa_normal": true,
  "wcag_aa_large": true,
  "wcag_aaa_normal": false,
  "wcag_aaa_large": true,
  "recommendation": "AA normal + AAA large: good for most use cases (ratio: 4.6:1)"
}

Example 2: Insufficient contrast (Fail)

{
  "foreground": "#777777",
  "background": "#888888",
  "contrast_ratio": 1.26,
  "wcag_aa_normal": false,
  "wcag_aa_large": false,
  "wcag_aaa_normal": false,
  "wcag_aaa_large": false,
  "recommendation": "Fail: insufficient contrast for any WCAG level (ratio: 1.26:1)"
}

Response fields:

ParameterDescription
foregroundNormalized foreground color (uppercase #RRGGBB)
backgroundNormalized background color (uppercase #RRGGBB)
contrast_ratioWCAG contrast ratio (2 decimal places)
wcag_aa_normalPasses AA for normal text (>= 4.5:1)
wcag_aa_largePasses AA for large text / UI (>= 3:1)
wcag_aaa_normalPasses AAA for normal text (>= 7:1)
wcag_aaa_largePasses AAA for large text (>= 4.5:1)
recommendationHighest compliance level summary (English)

Math Expression Eval

Safely evaluate mathematical expressions. Supports arithmetic, trigonometry, statistics, unit conversion, and variable bindings. Does not use JavaScript eval — runs in a mathjs sandbox with dangerous functions (import, parse, etc.) disabled. A 100ms timeout blocks oversized computations.

MCP tool: utility.calc_expression

POST /v1/math/eval

Parameters:

ParameterTypeRequiredDescription
expressionstringrequiredExpression to evaluate (max 500 characters)
variablesobject-Variable bindings (values must be number / string / boolean)
precisioninteger-Decimal places for numeric results (0–15, omit for no limit)

Response fields:

ParameterDescription
expressionEcho of the input expression
variablesVariables used (null when omitted)
resultEvaluation result (number / string / boolean)
result_strString form of result
precisionPrecision applied (null when omitted)

Tax-inclusive calculation example:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/eval" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expression": "(100000 + 50000) * 1.1"
  }'

Response example:

{
  "expression": "(100000 + 50000) * 1.1",
  "variables": null,
  "result": 165000,
  "result_str": "165000",
  "precision": null
}

Compound interest with variable bindings:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/eval" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expression": "principal * (1 + rate)^years",
    "variables": {
      "principal": 1000000,
      "rate": 0.05,
      "years": 10
    },
    "precision": 0
  }'

Response example:

{
  "expression": "principal * (1 + rate)^years",
  "variables": {
    "principal": 1000000,
    "rate": 0.05,
    "years": 10
  },
  "result": 1628895,
  "result_str": "1628895",
  "precision": 0
}

Math function (Pythagorean theorem) example:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/eval" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expression": "sqrt(x^2 + y^2)",
    "variables": {
      "x": 3,
      "y": 4
    }
  }'

Response example:

{
  "expression": "sqrt(x^2 + y^2)",
  "variables": {
    "x": 3,
    "y": 4
  },
  "result": 5,
  "result_str": "5",
  "precision": null
}

Consumption Tax Calc

Calculates Japanese consumption tax (standard 10%, reduced 8%, or any custom rate). Supports exclusive↔inclusive conversion, rounding modes (floor / ceil / round), and multi-item totals. Uses integer yen arithmetic to avoid floating-point errors.

MCP tool: utility.calc_tax

POST /v1/math/tax

Parameters:

ParameterTypeRequiredDescription
amountnumber-Single amount in yen (mutually exclusive with items; one required)
ratenumber-Tax rate in percent (default: 10, range 0–100)
roundingstring-Rounding: floor / ceil / round (default: floor)
directionstring-exclusive_to_inclusive (net→gross, default) or inclusive_to_exclusive (gross→net)
itemsarray-Line items; when set, top-level amount/rate ignored. item.rate falls back to top-level rate (then 10)

Response fields:

ParameterDescription
directionConversion direction
netTax-exclusive amount (single mode)
taxTax amount (single mode)
grossTax-inclusive amount (single mode)
rateApplied tax rate (single mode)
itemsPer-line net / tax / gross / rate (multi-item mode)
total_netTotal tax-exclusive (multi-item mode)
total_taxTotal tax (multi-item mode)
total_grossTotal tax-inclusive (multi-item mode)
roundingRounding mode used

Single amount (exclusive → inclusive):

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/tax" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "rate": 10,
    "rounding": "floor"
  }'

Response example:

{
  "direction": "exclusive_to_inclusive",
  "net": 1000,
  "tax": 100,
  "gross": 1100,
  "rate": 10,
  "rounding": "floor"
}

Multiple items (10% + 8% mixed rates):

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/tax" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "amount": 1000, "rate": 10 },
      { "amount": 500, "rate": 8 }
    ],
    "rounding": "floor"
  }'

Response example:

{
  "direction": "exclusive_to_inclusive",
  "items": [
    { "net": 1000, "tax": 100, "gross": 1100, "rate": 10 },
    { "net": 500, "tax": 40, "gross": 540, "rate": 8 }
  ],
  "total_net": 1500,
  "total_tax": 140,
  "total_gross": 1640,
  "rounding": "floor"
}

Inclusive → exclusive reverse calculation:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/tax" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1100,
    "rate": 10,
    "rounding": "floor",
    "direction": "inclusive_to_exclusive"
  }'

Response example:

{
  "direction": "inclusive_to_exclusive",
  "net": 1000,
  "tax": 100,
  "gross": 1100,
  "rate": 10,
  "rounding": "floor"
}

Loan / Interest Calc

Calculates equal-payment (fixed installment) and equal-principal loan repayments: monthly payment, total payment, and total interest. Compound interest and yen rounding are common LLM failure modes — this API rounds each month with Math.round and forces a final-month clearance so the schedule totals match the principal.

MCP tool: utility.calc_loan

POST /v1/math/loan

Parameters:

ParameterTypeRequiredDescription
principalnumberrequiredLoan principal in yen (must be positive)
annual_ratenumberrequiredAnnual interest rate in percent (e.g. 3.5 means 3.5% per year, not 0.035)
term_monthsintegerrequiredRepayment term in months (1–600; 50 years max)
methodstring-equal_payment (default) or equal_principal
include_scheduleboolean-When true, include the amortization schedule (default: false)

Response fields:

ParameterDescription
methodRepayment method applied
monthly_paymentFixed monthly payment for equal_payment; null for equal_principal (varies by month)
total_paymentSum of all payments (yen)
total_interestTotal interest (total_payment − principal)
scheduleAmortization rows when include_schedule is true: month / payment / principal / interest / balance

Equal payment (equal_payment) — fixed monthly installment:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/loan" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "principal": 1000000,
    "annual_rate": 3,
    "term_months": 12,
    "method": "equal_payment"
  }'

Response example:

{
  "method": "equal_payment",
  "monthly_payment": 84694,
  "total_payment": 1016325,
  "total_interest": 16325
}

Equal principal (equal_principal) — compare total cost under the same terms:

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/loan" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "principal": 1200000,
    "annual_rate": 3,
    "term_months": 12,
    "method": "equal_principal"
  }'

Response example:

{
  "method": "equal_principal",
  "monthly_payment": null,
  "total_payment": 1219500,
  "total_interest": 19500
}

Amortization schedule (include_schedule: true):

Request example:

curl -X POST "https://api.thousand-api.com/v1/math/loan" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "principal": 1000000,
    "annual_rate": 3,
    "term_months": 12,
    "method": "equal_payment",
    "include_schedule": true
  }'

Response example:

{
  "method": "equal_payment",
  "monthly_payment": 84694,
  "total_payment": 1016325,
  "total_interest": 16325,
  "schedule": [
    { "month": 1, "payment": 84694, "principal": 82194, "interest": 2500, "balance": 917806 },
    { "month": 12, "payment": 84691, "principal": 84480, "interest": 211, "balance": 0 }
  ]
}

Pagination Calc

Calculate all pagination values from total_items, current page, and per_page in one call. Returns offset / limit (0-based, ready for SQL or API skip/take) and from / to (1-based for UI display), plus has_prev / has_next, prev_page / next_page, and page_range.

MCP tool: utility.calc_pagination (use current_page instead of page)

GET /v1/pagination/calc

Parameters:

ParameterTypeRequiredDescription
total_itemsintegerRequiredTotal item count (0 or greater)
pageintegerRequiredCurrent page number (1-based)
per_pageinteger-Items per page (default: 20, max: 1000)
window_sizeinteger-Number of pages in page_range (default: 5, max: 20)

Response fields:

ParameterDescription
total_itemsInput total item count
pageCurrent page number (1-based)
per_pageItems per page
total_pagesTotal page count (0 when total_items is 0)
offsetZero-based offset (equivalent to SQL OFFSET)
limitFetch size (same as per_page; equivalent to SQL LIMIT)
fromFirst displayed item number (1-based)
toLast displayed item number (1-based; equals total_items on the last page)
has_prevWhether a previous page exists
has_nextWhether a next page exists
prev_pagePrevious page number (null when has_prev is false)
next_pageNext page number (null when has_next is false)
page_rangeArray of page numbers for UI pagination controls

Basic (total_items=234, page=3):

Request example:

curl "https://api.thousand-api.com/v1/pagination/calc?total_items=234&page=3" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "total_items": 234,
  "page": 3,
  "per_page": 20,
  "total_pages": 12,
  "offset": 40,
  "limit": 20,
  "from": 41,
  "to": 60,
  "has_prev": true,
  "has_next": true,
  "prev_page": 2,
  "next_page": 4,
  "page_range": [1, 2, 3, 4, 5]
}

Last page (page=12, has_next: false):

Request example:

curl "https://api.thousand-api.com/v1/pagination/calc?total_items=234&page=12" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "total_items": 234,
  "page": 12,
  "per_page": 20,
  "total_pages": 12,
  "offset": 220,
  "limit": 20,
  "from": 221,
  "to": 234,
  "has_prev": true,
  "has_next": false,
  "prev_page": 11,
  "next_page": null,
  "page_range": [8, 9, 10, 11, 12]
}

Semver Version Compare

Compare, sort, and validate semantic version strings (semver). Correctly handles cases like 1.10.0 > 1.9.0 that string comparison gets wrong. Supports prerelease versions and range satisfaction checks (e.g. ^1.0.0, >=2.0.0-beta).

MCP tool: utility.compare_versions

POST /v1/version/compare

Parameters:

ParameterTypeRequiredDescription
versionsstring[]-List of versions to sort and find latest from (max 100 items)
comparestring-Source version for comparison (must be paired with against)
againststring-Target version for comparison (must be paired with compare)
include_prereleaseboolean-Include prerelease versions in sorted/latest (default: false)
satisfiesobject-Map of range pattern to version to check (key=range, value=version)

Response fields:

ParameterTypeDescription
comparestringRequest compare value (when specified)
againststringRequest against value (when specified)
resultnumberComparison result: 1=compare is newer / 0=equal / -1=compare is older (when specified)
result_labelstringText form of result: greater / equal / less (when specified)
sortedstring[]Versions sorted ascending (when versions specified)
latest_stablestring | nullNewest stable version (when versions specified)
satisfiesobjectWhether each range is satisfied (when satisfies specified)

Compare two versions:

Request example:

curl -X POST "https://api.thousand-api.com/v1/version/compare" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "compare": "1.10.0",
    "against": "1.9.0"
  }'

Response example:

{
  "compare": "1.10.0",
  "against": "1.9.0",
  "result": 1,
  "result_label": "greater"
}

Combined sort, compare, and range check:

Request example:

curl -X POST "https://api.thousand-api.com/v1/version/compare" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "versions": ["1.9.0", "1.10.0", "2.0.0-beta.1", "2.0.0"],
    "compare": "2.0.0",
    "against": "1.10.0",
    "include_prerelease": false,
    "satisfies": {
      "^1.9.0": "1.10.0",
      ">=2.0.0": "2.0.0-beta.1"
    }
  }'

Response example:

{
  "compare": "2.0.0",
  "against": "1.10.0",
  "result": 1,
  "result_label": "greater",
  "sorted": ["1.9.0", "1.10.0", "2.0.0"],
  "latest_stable": "2.0.0",
  "satisfies": {
    "^1.9.0": true,
    ">=2.0.0": false
  }
}

Batch Execute

Run multiple API calls in a single request sequentially. Before chaining multiple MCP tools, consider data.execute_batch first. Use tools:[{id,tool,args}] with MCP tool names and pass prior step results via {{stepId.field}} dot notation.

MCP tool name: data.execute_batch

MCP presets (pass directly to data.execute_batch)

The same JSON is available in the tool-catalog MCP Resource (thousand-api://catalog/tools) under execute_batch_presets.

Today → holiday check → exchange rate

Get current datetime, check if today is a holiday, then fetch USD/JPY exchange rate.

{
  "tools": [
    {
      "id": "now",
      "tool": "datetime.get_current_datetime",
      "args": {
        "timezone": "Asia/Tokyo"
      }
    },
    {
      "id": "holiday",
      "tool": "datetime.is_holiday",
      "args": {
        "country": "JP",
        "date": "{{now.date}}"
      }
    },
    {
      "id": "rate",
      "tool": "network.get_exchange_rate",
      "args": {
        "from": "USD",
        "to": "JPY",
        "amount": 100
      }
    }
  ]
}

JSON validate → merge → stats

Validate JSON, merge with defaults, then compute stats on numeric values in one round trip.

{
  "tools": [
    {
      "id": "validate",
      "tool": "data.validate_json",
      "args": {
        "json_str": "{\"scores\":[10,20,30,40]}"
      }
    },
    {
      "id": "merge",
      "tool": "data.merge_json",
      "args": {
        "mode": "merge",
        "base": "{{validate.json}}",
        "patch": {
          "meta": {
            "source": "batch"
          }
        }
      }
    },
    {
      "id": "stats",
      "tool": "data.calc_stats",
      "args": {
        "values": [
          10,
          20,
          30,
          40
        ]
      }
    }
  ]
}

Slug → Base64 → HMAC signature

Generate a slug, encode it as Base64, and create an HMAC signature sequentially.

{
  "tools": [
    {
      "id": "slug",
      "tool": "text.generate_slug",
      "args": {
        "text": "Hello World API"
      }
    },
    {
      "id": "b64",
      "tool": "convert.base64",
      "args": {
        "data": "{{slug.slug}}",
        "direction": "encode"
      }
    },
    {
      "id": "hmac",
      "tool": "security.generate_hmac",
      "args": {
        "mode": "sign",
        "algorithm": "sha256",
        "message": "{{b64.output}}",
        "secret": "my-secret-key"
      }
    }
  ]
}

POST /v1/batch/execute

Parameters:

ParameterTypeRequiredDescription
toolsobject[]-MCP tool-name based steps (max 10). Alternative to steps
tools[].idstringrequiredStep ID (alphanumeric, hyphens, underscores; max 32 chars)
tools[].toolstringrequiredMCP tool name (e.g. datetime.get_current_datetime)
tools[].argsobjectrequiredArguments matching the target tool inputSchema (supports {{}} refs)
stepsobject[]-HTTP path based steps (max 10). Alternative to tools
steps[].idstringrequiredStep ID (alphanumeric, hyphens, underscores; max 32 chars; reference key)
steps[].methodstringrequiredHTTP method: GET / POST / PUT / PATCH / DELETE
steps[].pathstringrequiredAPI path starting with /v1/ (max 200 chars)
steps[].queryobject-Query parameters (supports {{}} references)
steps[].bodyobject-Request body for POST etc. (supports {{}} references)
stop_on_errorboolean-true (default): skip remaining steps after first failure / false: continue

Response fields:

ParameterTypeDescription
resultsobject[]Per-step execution results
results[].idstringStep ID
results[].statusnumberHTTP status (0 when skipped)
results[].bodyunknownResponse body (JSON)
results[].skippedbooleanSkipped due to stop_on_error
results[].errorstringError message when status >= 400
total_stepsnumberTotal steps in the request
executed_stepsnumberSteps actually executed
failed_stepstring | nullFirst failed step ID
timed_outbooleanWhether the 28s batch timeout fired

Step references (dot notation)

Use {{stepId.path.to.field}} in string query/body fields. When the entire value is {{...}}, the original type (number, boolean, etc.) is preserved. Partial embedding converts to string.

Blocked endpoints in batch

Example 1: Chained steps (current time → holiday check → exchange rate)

Request example:

curl -X POST "https://api.thousand-api.com/v1/batch/execute" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "steps": [
      {
        "id": "now",
        "method": "GET",
        "path": "/v1/datetime/now",
        "query": { "timezone": "Asia/Tokyo" }
      },
      {
        "id": "holiday",
        "method": "GET",
        "path": "/v1/calendar/is-holiday",
        "query": { "country": "JP", "date": "{{now.date}}" }
      },
      {
        "id": "rate",
        "method": "GET",
        "path": "/v1/exchangerate",
        "query": { "from": "USD", "to": "JPY", "amount": "100" }
      }
    ]
  }'

Response example:

{
  "results": [
    { "id": "now", "status": 200, "body": { "date": "2026-06-09", "time": "12:00:00" }, "skipped": false },
    { "id": "holiday", "status": 200, "body": { "datetime.is_holiday": false }, "skipped": false },
    { "id": "rate", "status": 200, "body": { "rate": 156.2 }, "skipped": false }
  ],
  "total_steps": 3,
  "executed_steps": 3,
  "failed_step": null,
  "timed_out": false
}

Example 1b: tools format (MCP tool names)

Request example:

curl -X POST "https://api.thousand-api.com/v1/batch/execute" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tools": [
      {
        "id": "now",
        "tool": "datetime.get_current_datetime",
        "args": { "timezone": "Asia/Tokyo" }
      },
      {
        "id": "holiday",
        "tool": "datetime.is_holiday",
        "args": { "country": "JP", "date": "{{now.date}}" }
      },
      {
        "id": "rate",
        "tool": "network.get_exchange_rate",
        "args": { "from": "USD", "to": "JPY", "amount": 100 }
      }
    ]
  }'

Example 2: Independent steps with stop_on_error: false

Request example:

curl -X POST "https://api.thousand-api.com/v1/batch/execute" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stop_on_error": false,
    "steps": [
      { "id": "hash", "method": "GET", "path": "/v1/hash/generate", "query": { "text": "a", "algorithm": "sha256" } },
      { "id": "uuid", "method": "GET", "path": "/v1/uuid/generate" },
      { "id": "distance", "method": "GET", "path": "/v1/distance", "query": { "p1": "35.68,139.76", "p2": "35.65,139.74" } }
    ]
  }'

Response example:

{
  "results": [
    { "id": "hash", "status": 200, "body": { "hash": "..." }, "skipped": false },
    { "id": "uuid", "status": 200, "body": { "uuids": ["..."] }, "skipped": false },
    { "id": "distance", "status": 200, "body": { "distance_meters": 3500 }, "skipped": false }
  ],
  "total_steps": 3,
  "executed_steps": 3,
  "failed_step": null,
  "timed_out": false
}

Health

Lightweight health check for MCP self-diagnostics. No authentication and no quota consumption.

MCP tool: utility.diagnose_mcp (uses this internally)

GET /v1/health

Response example:

{
  "status": "ok",
  "timestamp": "2026-06-19T10:00:00.000Z"
}

Diagnose MCP

MCP self-diagnostics: API connectivity (/v1/health), API key validity, and disabled tool list in one call. None of these checks consume quota.

MCP tool name: utility.diagnose_mcp

Response example:

{
  "api_health": "ok",
  "api_key_valid": true,
  "disabled_tools_count": 2,
  "disabled_tools": ["network.dns_lookup", "utility.calc_expression"],
  "checked_at": "2026-06-19T10:00:00.000Z"
}