セキュリティ・認証

JWT解析

JWTトークンをデコードしてヘッダー・ペイロード・有効期限を返します。署名検証は行いません。デバッグ用途での中身確認・有効期限チェックに使えます。

MCPツール名: decode_jwt

GET /v1/jwt/decode

JWTはBase64URLでエンコードされ、`.`(ドット)で区切られた3パートです。クエリパラメータとしてそのまま渡せますが、トークンに `+` や `=` が含まれる場合はURLエンコードしてください。

パラメータ:

パラメータ必須説明
tokenstringデコードするJWTトークン

リクエスト例:

curl "https://api.thousand-api.com/v1/jwt/decode?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwiZXhwIjoxNzE2MDAwMDAwfQ.signature" \
  -H "x-api-key: YOUR_API_KEY"

レスポンス例:

{
  "header": { "alg": "HS256", "typ": "JWT" },
  "payload": { "sub": "user123", "exp": 1716000000 },
  "is_expired": false,
  "expires_at": "2024-05-18T00:00:00.000Z",
  "issued_at": null
}

URLヘルスチェック

URLのステータスコード・レスポンスタイム・SSL証明書情報を確認します。resolve_urlと組み合わせることで短縮URLの最終リダイレクト先のヘルスも確認できます。

MCPツール名: inspect_url

GET /v1/url/inspect

パラメータ:

パラメータ必須説明
urlstring検査するURL(http/httpsのみ)

リクエスト例:

curl "https://api.thousand-api.com/v1/url/inspect?url=https%3A%2F%2Fwww.thousand-api.com" \
  -H "x-api-key: YOUR_API_KEY"

レスポンス例:

{
  "url": "https://www.thousand-api.com",
  "status_code": 200,
  "response_time_ms": 234,
  "reachable": true,
  "headers": {
    "content-type": "text/html",
    "x-frame-options": "DENY"
  },
  "ssl": {
    "valid": true,
    "expires_at": "2027-01-01T00:00:00.000Z",
    "days_remaining": 220,
    "issuer": "Amazon"
  }
}

単位変換

長さ・重さ・温度・面積・体積・速度・データ量の単位変換を行います。外部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

パラメータ:

パラメータ必須説明
valuenumber変換する数値
fromstring変換元単位
tostring変換先単位

リクエスト例:

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

ハッシュ生成

テキストからMD5・SHA-1・SHA-256・SHA-512のハッシュ値を生成します。Node.js標準のcryptoモジュールを使用・外部依存なし。

MCPツール名: generate_hash

textパラメータにスペースや特殊文字が含まれる場合はURLエンコードが必要です(例: hello world → hello+world または hello%20world)。

GET /v1/hash/generate

パラメータ:

パラメータ必須説明
textstringハッシュ化するテキスト(最大100KB)
algorithmstring-md5 / sha1 / sha256 / sha512(デフォルト: sha256)

リクエスト例:

curl "https://api.thousand-api.com/v1/hash/generate?text=hello+world&algorithm=sha256" \
  -H "x-api-key: YOUR_API_KEY"

レスポンス例:

{
  "text": "hello world",
  "algorithm": "sha256",
  "hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
  "length": 64
}

HMAC署名生成・検証

HMAC署名の生成・検証を行います。SHA-256・SHA-512・SHA-1・MD5に対応。Node.js標準のcryptoモジュールを使用・外部依存なし。GitHub・Stripe・SlackなどのWebhook署名検証に利用できます。

MCPツール名: generate_hmac

POST /v1/crypto/hmac

パラメータ:

パラメータ必須説明
modestringsign(署名生成)/ verify(署名検証)
algorithmstringsha256 / sha512 / sha1 / md5
secretstring署名シークレットキー(最大64KB)
messagestring署名対象のメッセージ(最大64KB)
encodingstring-hex / base64(デフォルト: hex)
signaturestring-検証対象の署名文字列(mode: verify 時必須)

mode: sign のレスポンスフィールド:

パラメータ説明
modestringsign
algorithmstring使用したHMACアルゴリズム
encodingstring出力エンコーディング(hex / base64)
signaturestring生成されたHMAC署名

mode: verify のレスポンスフィールド:

パラメータ説明
modestringverify
algorithmstring使用したHMACアルゴリズム
encodingstring出力エンコーディング(hex / base64)
verifiedboolean署名が一致したか(timing-safe compare)

署名生成例(GitHub Webhooks風):

リクエスト例:

curl -X POST "https://api.thousand-api.com/v1/crypto/hmac" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "sign",
    "algorithm": "sha256",
    "secret": "your-webhook-secret",
    "message": "{\"action\":\"opened\",\"number\":1}"
  }'

レスポンス例:

{
  "mode": "sign",
  "algorithm": "sha256",
  "encoding": "hex",
  "signature": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"
}

署名検証例(受信Webhookの検証):

リクエスト例:

curl -X POST "https://api.thousand-api.com/v1/crypto/hmac" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "verify",
    "algorithm": "sha256",
    "secret": "your-webhook-secret",
    "message": "{\"action\":\"opened\",\"number\":1}",
    "signature": "sha256=abc123..."
  }'

レスポンス例:

{
  "mode": "verify",
  "algorithm": "sha256",
  "encoding": "hex",
  "verified": true
}

base64エンコード出力の例:

リクエスト例:

curl -X POST "https://api.thousand-api.com/v1/crypto/hmac" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "sign",
    "algorithm": "sha256",
    "secret": "my-secret",
    "message": "hello world",
    "encoding": "base64"
  }'

レスポンス例:

{
  "mode": "sign",
  "algorithm": "sha256",
  "encoding": "base64",
  "signature": "K8D9a2..."
}

UUID生成・検証

暗号学的に安全な UUID v4 の生成と、UUID 文字列の形式検証(v1〜v5)を行います。Node.js 標準の crypto.randomUUID() のみ使用・外部依存なし。

MCPツール名: generate_uuid, validate_uuid

GET /v1/uuid/generate

パラメータ:

パラメータ必須説明
countinteger-生成数(1〜100・デフォルト: 1)
versionstring-UUIDバージョン(v4 のみ・デフォルト: v4)

レスポンスフィールド:

パラメータ説明
versionstring生成した UUID のバージョン(v4)
countinteger生成件数
uuidsstring[]生成された UUID の配列

複数生成の例(count: 3):

リクエスト例:

curl "https://api.thousand-api.com/v1/uuid/generate?count=3&version=v4" \
  -H "x-api-key: YOUR_API_KEY"

レスポンス例:

{
  "version": "v4",
  "count": 3,
  "uuids": [
    "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "6ecc5f60-7e11-4f4a-9b2c-1a2b3c4d5e6f",
    "a1b2c3d4-e5f6-4789-ab01-234567890abc"
  ]
}

POST /v1/uuid/validate

パラメータ:

パラメータ必須説明
valuesstring[]検証対象の文字列一覧(1〜100件)

レスポンスフィールド:

パラメータ説明
resultsobject[]各入力値の検証結果
results[].valuestring入力値(そのまま返却)
results[].validbooleanUUID形式として有効か
results[].versioninteger | null有効時はバージョン(1〜5)
results[].variantstring | null有効時は RFC 4122 等
all_validboolean全件が valid: true か

有効・無効が混在する検証例:

リクエスト例:

curl -X POST "https://api.thousand-api.com/v1/uuid/validate" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "values": [
      "550e8400-e29b-41d4-a716-446655440000",
      "not-a-uuid",
      "12345"
    ]
  }'

レスポンス例:

{
  "results": [
    {
      "value": "550e8400-e29b-41d4-a716-446655440000",
      "valid": true,
      "version": 4,
      "variant": "RFC 4122"
    },
    {
      "value": "not-a-uuid",
      "valid": false,
      "version": null,
      "variant": null
    },
    {
      "value": "12345",
      "valid": false,
      "version": null,
      "variant": null
    }
  ],
  "all_valid": false
}

MCPツールの使用例(generate → validate):

1. generate_uuid で ID を生成:
   { "count": 2 }

2. 返却された uuids を validate_uuid で検証:
   { "values": ["<uuid-1>", "<uuid-2>"] }

→ all_valid: true なら RFC 4122 形式として利用可能です。