Security & auth

JWT Decode

Decodes a JWT and returns the header, payload, and expiration status. Does not verify signatures. Useful for debugging token contents and expiry.

MCP tool: security.decode_jwt

GET /v1/jwt/decode

JWTs use Base64URL with three dot-separated parts. You can pass the token as a query parameter as-is, but URL-encode it if the token contains `+` or `=`.

Parameters:

ParameterTypeRequiredDescription
tokenstringJWT token to decode

Request example:

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

Response example:

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

Checks a URL's HTTP status code, response time, and SSL certificate details. Combine with network.resolve_url to inspect the final destination of shortened URLs.

MCP tool: network.inspect_url

GET /v1/url/inspect

Parameters:

ParameterTypeRequiredDescription
urlstringURL to inspect (http/https only)

Request example:

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

Response example:

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

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

Hash Generation

Generate MD5, SHA-1, SHA-256, or SHA-512 hashes from text. Uses Node.js built-in crypto with no external dependencies.

MCP tool name: security.generate_hash

URL-encode the text query parameter when it contains spaces or special characters (e.g. hello world → hello+world or hello%20world).

GET /v1/hash/generate

Parameters:

ParameterTypeRequiredDescription
textstringText to hash (max 100KB)
algorithmstring-md5 / sha1 / sha256 / sha512 (default: sha256)

Request example:

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

Response example:

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

HMAC Sign & Verify

Generate or verify HMAC signatures. Supports SHA-256, SHA-512, SHA-1, and MD5. Uses Node.js built-in crypto with no external dependencies. Useful for validating GitHub, Stripe, and Slack webhook signatures.

MCP tool name: security.generate_hmac

POST /v1/crypto/hmac

Parameters:

ParameterTypeRequiredDescription
modestringsign (generate) / verify (compare)
algorithmstringsha256 / sha512 / sha1 / md5
secretstringHMAC secret key (max 64KB)
messagestringMessage to sign or verify (max 64KB)
encodingstring-hex / base64 (default: hex)
signaturestring-Signature to verify (required when mode is verify)

Response fields (mode: sign):

ParameterTypeDescription
modestringsign
algorithmstringHMAC algorithm used
encodingstringOutput encoding (hex / base64)
signaturestringGenerated HMAC signature

Response fields (mode: verify):

ParameterTypeDescription
modestringverify
algorithmstringHMAC algorithm used
encodingstringOutput encoding (hex / base64)
verifiedbooleanWhether the signature matched (timing-safe compare)

Sign example (GitHub Webhooks style):

Request example:

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

Response example:

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

Verify example (incoming webhook validation):

Request example:

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

Response example:

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

Base64-encoded output example:

Request example:

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

Response example:

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

TOTP Generate & Validate

Generates and validates RFC 6238 TOTP (time-based one-time password) codes using deterministic HMAC-SHA1 and time-step math. Compatible with Google Authenticator and similar apps. Optional timestamp (UNIX seconds) overrides the evaluation time for RFC 6238 test vectors. QR code / otpauth:// URI generation is out of scope — pair with convert.get_qrcode if needed.

MCP tool name: security.generate_totp

POST /v1/security/totp

Parameters:

ParameterTypeRequiredDescription
actionstringgenerate (create a code) / validate (verify a code)
secretstringBase32-encoded shared secret (A-Z2-7; lowercase, spaces, and padding allowed)
codestring-Code to verify (required when action is validate; length must match digits)
periodinteger-Time-step size in seconds (default: 30)
digitsinteger-Code length 6–8 (default: 6)
windowinteger-Allowed time-step skew (±). Validate only. Default 1, max 10
timestampnumber-UNIX seconds to evaluate (optional). Omit for current time; use for RFC 6238 vectors and deterministic replay

Response fields for action: generate:

ParameterTypeDescription
actionstringgenerate
codestringGenerated TOTP code (zero-padded)
expires_inintegerSeconds remaining in the current time step

Response fields for action: validate:

ParameterTypeDescription
actionstringvalidate
validbooleanWhether the code matched within the allowed window
matched_windowinteger | nullMatching offset (−window…+window), or null if no match

Generate example:

Request example:

curl -X POST "https://api.thousand-api.com/v1/security/totp" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "generate",
    "secret": "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
  }'

Response example:

{
  "action": "generate",
  "code": "483920",
  "expires_in": 18
}

Validate example:

Request example:

curl -X POST "https://api.thousand-api.com/v1/security/totp" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "validate",
    "secret": "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
    "code": "483920",
    "window": 1
  }'

Response example:

{
  "action": "validate",
  "valid": true,
  "matched_window": 0
}

UUID Generate & Validate

Generate cryptographically secure UUID v4 strings and validate UUID format (versions 1-5). Uses Node.js crypto.randomUUID() only; no external dependencies.

MCP tool names: security.generate_uuid, security.validate_uuid

GET /v1/uuid/generate

Parameters:

ParameterTypeRequiredDescription
countinteger-Number to generate (1-100, default 1)
versionstring-UUID version (v4 only, default v4)

Response fields:

ParameterTypeDescription
versionstringGenerated UUID version (v4)
countintegerNumber of UUIDs generated
uuidsstring[]Array of generated UUIDs

Generate multiple UUIDs (count: 3):

Request example:

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

Response example:

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

POST /v1/uuid/validate

Parameters:

ParameterTypeRequiredDescription
valuesstring[]Strings to validate (1-100 items)

Response fields:

ParameterTypeDescription
resultsobject[]Per-input validation results
results[].valuestringInput value echoed back
results[].validbooleanWhether the string is a valid UUID
results[].versioninteger | nullVersion 1-5 when valid
results[].variantstring | nulle.g. RFC 4122 when valid
all_validbooleanTrue when every result is valid

Validate a mix of valid and invalid strings:

Request example:

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

Response example:

{
  "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 workflow (generate → validate):

1. Generate IDs with security.generate_uuid:
   { "count": 2 }

2. Validate returned uuids with security.validate_uuid:
   { "values": ["<uuid-1>", "<uuid-2>"] }

→ When all_valid is true, the IDs are RFC 4122-compliant.

Barcode Validate & Convert

Validates ISBN-10, ISBN-13, JAN-13 (EAN-13), and UPC-A barcodes and converts between ISBN-10 and ISBN-13. Check digits use standard algorithms (ISBN-10: weighted sum mod 11; EAN-13: alternating 1/3 weights mod 10). No external dependencies.

MCP tool: security.validate_barcode

Supported barcode types

ParameterDescription
ISBN-1010-digit book code; check digit 0-9 or X (=10)
ISBN-1313-digit book code; EAN-13 starting with 978 or 979
JAN-1313-digit Japanese product code (EAN-13 not starting with 978/979)
UPC-A12-digit North American product code (validated as EAN-13 with leading 0)

GET /v1/validate/barcode

Parameters:

ParameterTypeRequiredDescription
codestringBarcode to validate (hyphens optional, max 100 chars)
typestring-Barcode type hint (auto-detected when omitted): ISBN-10, ISBN-13, JAN-13, EAN-13, UPC-A

Response fields:

ParameterTypeDescription
inputstringInput code as provided
typestringDetected type: ISBN-10, ISBN-13, JAN-13, or UPC-A
validbooleanWhether the check digit is correct
check_digitstringExpected check digit character
normalizedstringHyphen-stripped, uppercased code
conversionsobject | nullISBN conversions (null for non-ISBN types)
conversions.isbn10string | nullISBN-13→ISBN-10 (978 prefix only; 979 returns null)
conversions.isbn13string | nullISBN-10→ISBN-13 conversion result

ISBN-13 validation example:

Request example:

curl "https://api.thousand-api.com/v1/validate/barcode?code=978-4-06-519981-7" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "input": "978-4-06-519981-7",
  "type": "ISBN-13",
  "valid": true,
  "check_digit": "7",
  "normalized": "9784065199817",
  "conversions": {
    "isbn10": "4-06-519981-6",
    "isbn13": "978-4-06-519981-7"
  }
}

ISBN-10 validation example (check digit X):

Request example:

curl "https://api.thousand-api.com/v1/validate/barcode?code=0-8044-2957-X" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "input": "0-8044-2957-X",
  "type": "ISBN-10",
  "valid": true,
  "check_digit": "X",
  "normalized": "080442957X",
  "conversions": {
    "isbn10": "0-8044-2957-X",
    "isbn13": "978-0-80-442957-6"
  }
}

Auto-detection example (type omitted):

Request example:

curl "https://api.thousand-api.com/v1/validate/barcode?code=4901234567894" \
  -H "x-api-key: YOUR_API_KEY"

Response example:

{
  "input": "4901234567894",
  "type": "JAN-13",
  "valid": true,
  "check_digit": "4",
  "normalized": "4901234567894",
  "conversions": null
}

Validate Luhn Check Digit

Validates check digits using the Luhn algorithm (mod 10). Used for credit card numbers, IMEI numbers, and other identifiers. No external dependencies.

MCP tool: security.validate_luhn

format hints (digit-count rules)

ParameterDescription
credit_card13–19 digits (typical credit card numbers)
imeiExactly 15 digits (IMEI numbers)
generic1–99 digits (no digit-count check)

POST /v1/validate/luhn

Parameters:

ParameterTypeRequiredDescription
valuestringNumber to validate (hyphens/spaces optional, max 200 chars)
formatstring-Format hint (default: generic): credit_card, imei, or generic

Response fields:

ParameterTypeDescription
valuestringInput value as provided
normalizedstringHyphen/space-stripped digit string
validbooleanWhether the Luhn check digit is correct
check_digitstringActual trailing check digit
expected_check_digitstringPresent only when valid is false; expected check digit
formatstringRequest format (default: generic)
lengthnumberDigit count of normalized value
format_validbooleanWhether digit count matches the format hint (independent of Luhn validity)

Valid credit card number example:

Request example:

curl -X POST "https://api.thousand-api.com/v1/validate/luhn" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "4532015112830366",
    "format": "credit_card"
  }'

Response example:

{
  "value": "4532015112830366",
  "normalized": "4532015112830366",
  "valid": true,
  "check_digit": "6",
  "format": "credit_card",
  "length": 16,
  "format_valid": true
}

Invalid number example (returns expected_check_digit):

Request example:

curl -X POST "https://api.thousand-api.com/v1/validate/luhn" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "4532015112830367"
  }'

Response example:

{
  "value": "4532015112830367",
  "normalized": "4532015112830367",
  "valid": false,
  "check_digit": "7",
  "expected_check_digit": "6",
  "format": "generic",
  "length": 16,
  "format_valid": true
}