Sapling Logo
AI detector quickstart

HTML AI Detector

Analyze text from a HTML application and receive document- and sentence-level AI detection scores.

  • HTTPS POST
  • SDK + HTTP
  • API key required
POST HTML logo HTML /api/v1/aidetect

HTML AI detector quickstart

Send at least 150 characters for a more reliable signal. The response score ranges from 0 (more likely human-written) to 1 (more likely AI-generated); use it as evidence, not proof.

Sapling provides an SDK for this stack. The direct HTTP example below remains useful for server-side integrations; see the SDK overview for the higher-level client.
HTML /api/v1/aidetect

Keep the Sapling API key in your backend. This browser example calls an application-owned /api/ai-detect route that proxies the request to Sapling.

<form id="detector-form">
  <label for="content-editor">Text to analyze</label>
  <textarea id="content-editor" sapling-ignore="true">
I am an artificial intelligence system designed to help people solve complex problems.
My capabilities include natural language processing, machine learning, and predictive analytics.
  </textarea>
  <button type="submit">Check text</button>
</form>

<pre id="results" aria-live="polite"></pre>

<script>
const form = document.getElementById('detector-form');

form.addEventListener('submit', async (event) => {
  event.preventDefault();
  const text = document.getElementById('content-editor').value;
  const response = await fetch('/api/ai-detect', {
    method: 'POST',
    headers: {'Content-Type': 'application/json'},
    body: JSON.stringify({text}),
  });

  if (!response.ok) {
    throw new Error(`Detector request failed: ${response.status}`);
  }

  const data = await response.json();
  document.getElementById('results').textContent = JSON.stringify(data, null, 2);
});
</script>
Example response application/json
{
  "score": 0.9989,
  "sentence_scores": [
    {
      "score": 0.9764,
      "sentence": "I am an artificial intelligence system designed to help people solve complex problems."
    },
    {
      "score": 0.9812,
      "sentence": "My capabilities include natural language processing, machine learning, and predictive analytics."
    }
  ],
  "text": "I am an artificial intelligence system designed to help people solve complex problems. My capabilities include natural language processing, machine learning, and predictive analytics."
}

The overall score and sentence scores use different methods and may not match exactly. Choose thresholds based on the false-positive and false-negative costs of your use case.

About HTML

HTML, the HyperText Markup Language is used to design web pages to be rendered in browsers. Typically it is combined with CSS for styling and presentation and JavaScript for dynamic functionality.