Plagiarism API
The Plagiarism endpoint automatically searches the public web for passages copied or lightly edited from online sources. It samples distinctive phrases across your text, searches the live web, fetches candidate pages safely, and verifies every reported match against the fetched page text (falling back to ellipsis-safe search snippets when a site blocks automated requests).
Each response returns an overall similarity score broken down into exact_similarity (verbatim runs of at
least min_words words, 8 by default) and minor_changes_similarity (lightly edited / patchwritten
passages), ranked web sources with URLs, character offsets and source excerpts, per-sentence match status,
and search_coverage reporting how many queries and candidate pages were checked.
To compare a text strictly against private documents or specific URLs you supply with no web search, use the Source Match API. To evaluate whether a text was written by AI, pair this endpoint with the AI Detector API.
Billed per submitted character starting at $0.02 per 1,000 input characters (volume tiers down to $0.01; see
API Pricing). Failed search requests (502/503) are not billed, and identical requests
within 24 hours are cached and not billed again unless zero_retention: true is set.
Sample Code
- cURL
- JavaScript
- Python
curl -X POST https://api.sapling.ai/api/v1/plagiarism \
-H "Content-Type: application/json" \
-d '{"key":"<api-key>", "text":"Photosynthesis is a system of biological processes by which photosynthetic organisms, such as most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism. In this field report we measured weekly algae growth across twelve coastal stations."}'
import axios from 'axios';
async function run(text) {
try {
const response = await axios.post(
'https://api.sapling.ai/api/v1/plagiarism',
{
key: '<api-key>',
text,
exclude_quotes: false,
include_minor_changes: true,
},
);
const { status, data } = response;
console.log({ status });
console.log(JSON.stringify(data, null, 2));
} catch (err) {
const msg = err.response?.data?.msg || err.message;
console.log({ err: msg });
}
}
run('Photosynthesis is a system of biological processes by which photosynthetic organisms, such as most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism. In this field report we measured weekly algae growth across twelve coastal stations.');
import requests
from pprint import pprint
text = (
"Photosynthesis is a system of biological processes by which photosynthetic "
"organisms, such as most plants, algae, and cyanobacteria, convert light energy, "
"typically from sunlight, into the chemical energy necessary to fuel their "
"metabolism. In this field report we measured weekly algae growth across twelve "
"coastal stations."
)
response = requests.post(
"https://api.sapling.ai/api/v1/plagiarism",
json={
"key": "<api-key>",
"text": text,
"exclude_quotes": False,
"include_minor_changes": True,
},
)
if 200 <= response.status_code < 300:
pprint(response.json())
else:
print("Error:", response.status_code, response.text)
Request Parameters
https://api.sapling.ai/api/v1/plagiarism
HTTP method: POST
key: String
32-character API key. Can also be supplied via the Authorization: Bearer <api-key> header; if both are provided,
the key parameter takes precedence.
text: String
The text to check for web plagiarism, as plain text. Up to 25,000 characters. Span offsets index this exact string
in Unicode code points.
min_words: Integer (optional, default 8)
Shortest verbatim run of words reported as an exact match, from 6 to 50.
include_minor_changes: Boolean (optional, default true)
When true, also detects lightly edited ("patchwritten") passages where words were swapped, inserted, deleted, or
inflected. Set to false for strictly verbatim runs only.
exclude_quotes: Boolean (optional, default false)
When true, words inside double quotation marks (straight or curly double quotes, guillemets, CJK corner brackets)
or on Markdown block-quote lines (> ...) are excluded from search sampling and matching.
exclude_bibliography: Boolean (optional, default false)
When true, a trailing References, Bibliography, Works Cited, or Sources section heading (in the latter half of
the document) and everything following it is excluded from search sampling and matching.
exclude_urls: Array of Strings (optional, up to 20)
Domains (e.g. "example.com", which also matches subdomains such as www.example.com) or http(s) URL prefixes
(e.g. "https://docs.example.org/drafts") to skip before fetching and matching. Useful when checking drafts of
content already published on your own site.
max_queries: Integer (optional, 1–20)
Caps the number of sampled web search queries. By default, Sapling scales queries with document length (roughly
one query per 90 words, up to 12).
zero_retention: Boolean (optional, default false)
When true, Sapling skips reading and writing the 24-hour result cache and disables billing deduplication for the
call. Note that short sampled phrases are still sent to the web search provider to discover candidate pages.
Sample Output
Captured from the live endpoint for the sample input above (live results can vary as indexed web pages change):
{
"plagiarism_detected": true,
"similarity": 0.674,
"exact_similarity": 0.674,
"minor_changes_similarity": 0.0,
"matched_words": 31,
"exact_matched_words": 31,
"minor_changes_matched_words": 0,
"text_words": 46,
"quoted_words": 0,
"bibliography_words": 0,
"sources": [
{
"index": 0,
"url": "https://en.wikipedia.org/wiki/Photosynthesis",
"title": "Photosynthesis - Wikipedia",
"domain": "en.wikipedia.org",
"verified": "page",
"matched_words": 31,
"exact_words": 31,
"minor_changes_words": 0,
"matched_fraction": 0.674,
"spans": [
{
"start": 15,
"end": 59,
"words": 8,
"text": "is a system of biological processes by which",
"match_type": "exact",
"similarity": 1.0,
"verified": "page",
"source_excerpt": "is a system of biological processes by which"
},
{
"start": 75,
"end": 239,
"words": 23,
"text": "organisms, such as most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism",
"match_type": "exact",
"similarity": 1.0,
"verified": "page",
"source_excerpt": "organisms, such as most plants, algae and cyanobacteria, convert light energy—typically from sunlight—into the chemical energy necessary to fuel their metabolism"
}
]
},
{
"index": 1,
"url": "https://ttsreader.com/wiki?article=Photosynthesis",
"title": "oxygenic photosynthesis",
"domain": "ttsreader.com",
"verified": "snippet",
"matched_words": 20,
"exact_words": 20,
"minor_changes_words": 0,
"matched_fraction": 0.435,
"spans": [
{
"start": 94,
"end": 239,
"words": 20,
"text": "most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism",
"match_type": "exact",
"similarity": 1.0,
"verified": "snippet",
"source_excerpt": "most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism"
}
]
},
{
"index": 2,
"url": "https://www.facebook.com/groups/224349174415428/posts/3316611758522472",
"title": "What is photosynthesis and how does it work?",
"domain": "facebook.com",
"verified": "snippet",
"matched_words": 19,
"exact_words": 19,
"minor_changes_words": 0,
"matched_fraction": 0.413,
"spans": [
{
"start": 94,
"end": 228,
"words": 19,
"text": "most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their",
"match_type": "exact",
"similarity": 1.0,
"verified": "snippet",
"source_excerpt": "most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their"
}
]
}
],
"sentences": [
{
"text": "Photosynthesis is a system of biological processes by which photosynthetic organisms, such as most plants, algae, and cyanobacteria, convert light energy, typically from sunlight, into the chemical energy necessary to fuel their metabolism.",
"start": 0,
"end": 240,
"matched": true,
"match_type": "exact",
"similarity": 0.867,
"source_indices": [0, 1, 2]
},
{
"text": "In this field report we measured weekly algae growth across twelve coastal stations.",
"start": 241,
"end": 325,
"matched": false,
"match_type": null,
"similarity": 0.0,
"source_indices": []
}
],
"search_coverage": {
"status": "partial",
"provider": "serper",
"queries_planned": 1,
"queries_run": 1,
"queries_failed": 0,
"fallback_queries_run": 0,
"candidate_urls": 5,
"pages_fetched": 1,
"pages_failed": 4,
"snippet_fallbacks": 3,
"sampled": false,
"elapsed_ms": 1665
},
"min_words": 8,
"exclude_quotes": false,
"exclude_bibliography": false,
"include_minor_changes": true,
"version": "1.0.0"
}
Response Fields
- plagiarism_detected:
truewhen at least one verified web span matches the submitted text. - similarity:
0.0to1.0— share of the text's words covered by any matched span (exactorminor_changes; overlapping spans across multiple sources count once). - exact_similarity / minor_changes_similarity: Breakdown of
similaritybetween verbatim runs and lightly edited passages not already covered by an exact match. - matched_words, exact_matched_words, minor_changes_matched_words, text_words: Word counts backing the similarity fractions.
- quoted_words / bibliography_words: Number of words excluded by
exclude_quotes/exclude_bibliography(still counted intext_words). - sources: Matched web pages ordered by
matched_wordsdescending. Each entry includes:index,url,title,domainverified:"page"when verified against the fetched page's full text, or"snippet"when the site blocked automated fetching and a contiguous verbatim run matched inside the search engine's snippet.matched_words,exact_words,minor_changes_words,matched_fractionspans: Matched passages with Unicode code-pointstart/endoffsets into the inputtext, along withwords, matchedtext,match_type("exact"or"minor_changes"),similarity,verified("page"or"snippet"), andsource_excerpt.
- sentences: Sentence-level breakdown of
textwithtext,start,end,matched,match_type,similarity, andsource_indices(positions insources). - search_coverage: Reports transparency into what ran:
status:"complete"(all planned queries succeeded),"partial"(some queries or candidate fetches could not complete),"skipped"(text too short or lacked distinctive phrases), or"failed"(returned on 502/503).queries_planned,queries_run,queries_failed,fallback_queries_run,provider,elapsed_mscandidate_urls,pages_fetched,pages_failed,snippet_fallbackssampled:truewhen a long document was sampled across sections rather than querying every paragraph.
Errors
| Status | Code | Cause |
|---|---|---|
400 | invalid_request / text_too_long | text is missing, empty, over 25,000 characters, or contains NUL; or an option (min_words, exclude_urls, max_queries, booleans) is invalid. |
401 | missing_api_key / invalid_api_key | The API key is missing or invalid. |
402 | payment_required | The account cannot make billed API calls (e.g., depleted credits or expired subscription). |
429 | rate_limited / anonymous_limit_exceeded / website_daily_limit | Rate limit or website free-tier cap reached. Honor Retry-After when present. |
502 | upstream_error | Every sampled web search query failed. Safe to retry later; not billed. |
503 | service_unavailable | Web search is not configured on this deployment (e.g. air-gapped on-prem) or the search circuit breaker is open. Honor Retry-After; not billed. |
Notes
- MCP server: Available on Sapling's hosted MCP server as
sapling_plagiarism. - Privacy & on-prem: Web plagiarism checking sends short sampled phrases to an external web search provider and fetches public candidate pages. For air-gapped or strictly private document comparison with zero egress, use Source Match.
- Unicode offsets: Span
start/endoffsets count Unicode code points. In JavaScript, slice withArray.from(text).slice(start, end).join('')when text may contain emoji or characters outside the BMP.