API docs

JSON response fields are currently French (langues, detecte, attendu, confiance, longueur, profondeur, vitesse, resume). English aliases are not available.

Every endpoint is pay-per-call over x402 (USDC on Solana mainnet, gas sponsored). No account, no API key: an unauthenticated call returns HTTP 402 with a PAYMENT-REQUIRED header; settle it via the facilitator https://x402.dexter.cash and retry with the payment proof. Base URL: https://linguadetective.com.

POST /detect — $0.002

Detect the language(s) of a text. Offline trigram model, top-5 with confidence, ISO 639-3.

Request

curl -X POST https://linguadetective.com/detect \
  -H 'Content-Type: application/json' \
  -d '{"text":"Bonjour tout le monde, ceci est une phrase en français."}'

Response 200

{
  "langues": [
    {"code":"fra","nom":"français","iso6391":"fr","confiance":0.99},
    {"code":"spa","nom":"espagnol","iso6391":"es","confiance":0.01}
  ],
  "langue": "français",
  "iso6393": "fra",
  "confiance": 0.99,
  "longueur": 52
}

Errors: 400 INVALID_INPUT (missing/empty text), 400 TEXT_TOO_SHORT (< 10 characters).

POST /verify — $0.004

Verify a text is written in the expected language (expected: ISO 639-1 or 639-3).

curl -X POST https://linguadetective.com/verify \
  -H 'Content-Type: application/json' \
  -d '{"text":"Bonjour tout le monde, ceci est une phrase en français.","expected":"fra"}'
{
  "ok": true,
  "detecte": "français",
  "attendu": "français",
  "confiance": 0.99
}

Errors: 400 INVALID_INPUT, 400 TEXT_TOO_SHORT, 400 INVALID_LANGUAGE (bad expected code).

POST /crawl — per page, progressive

Verify the language of whole pages. Three modes:

ModeBodyPrice per page
links — you provide the URLs (max 200){"links":["https://…"],"langue":"fra"}links: $0.015 / $0.010 / $0.006 for the 1–200 / 201–1000 / 1001+ brackets
crawl (spider): +$0.005/page → $0.020 / $0.015 / $0.011
minimum $0.01/run
crawl — spider a whole site{"url":"https://…","crawl":true,"langue":"fra","profondeur":2,"maxPages":100}
page — one page{"url":"https://…/page","langue":"fra"}

Options: profondeur 0–5 (default 2), maxPages 1–200 (default 100), langue optional (ISO 639-1 or 639-3), vitesse "lente"|"normale"|"rapide" or 1–20 (default "normale"). Each page gets a verdict: conforme, non_conforme, incertain, erreur or indetermine, plus a summary (resume).

POST /api/audit — per page, progressive

Full multilingual audit of a batch of URLs (max 500) or a site (with options.crawl:true):

curl -X POST https://linguadetective.com/api/audit \
  -H 'Content-Type: application/json' \
  -d '{"urls":["https://example.com/"],"options":{"langue":"fra","crawl":true,"profondeur":2,"maxPages":100,"vitesse":"normale"}}'

Returns a structured JSON audit — score, classification, confiance, evidence, next_steps — plus a copy-pasteable Markdown report.

Prepaid credit

Send the token on later calls: each call debits the credit without a new Solana transaction — ideal for high volume.

Payment reference (x402)

ChainSolana mainnet — CAIP-2 solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
AssetUSDC — mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Schemeexact — gas sponsored (payer needs USDC only, no SOL)
Facilitatorhttps://x402.dexter.cash
RecipientH3NuGHu9mpGgscj2DWtrs699PWdovPUicy2N9dDaYLTk

MCP server

Agent frameworks can call these endpoints through the MCP server lingua-x402-mcp (npx -y lingua-x402-mcp) — tools detect_langue, verifier_langue, bundle_check, credit_topup. Setup and payment modes: Lingua Detective for AI agents.