Skip to content

Anti-plagiarism with the API

This guide shows how an anti-plagiarism tool, such as Chimpee, checks a new text against what is already published. The route reference is in Content search.

  1. Sample sentences from the text. Pick 3 to 6 sentences of 8 to 15 words, from spread-out points (opening, middle, end). Avoid sentences made only of commonplaces or numbers.

  2. Look each excerpt up with search. GET /v1/search with q in quotes ("whole sentence") or mode=phrase. A hit on a long sentence is already a strong sign. Use -term to drop a post you know to be the original.

  3. Compare the whole text with similarity. POST /v1/search/similar with the draft in text (50 to 50,000 characters) or, for a post of yours already published, with post_id (the post itself is left out). Use min_words 8, the default; lower it to 5 to catch copying with swapped words, raise it up to 30 to cut noise.

  4. Read the coverage, not just the presence of the item. similarity (and coverage.input_covered) is the fraction of your text that appears in the post. A high value, for example above 0.2, with a large longest_run_words points to relevant copying. A high coverage.post_covered with a low input_covered is usually just a long quote of the post inside your text, or your text being the source of the other. Set the thresholds in your tool and show passages to the reviewer: query_start/query_end mark the excerpt in your text, source_start/source_end in the post.

  5. Paginate search. Pass next_cursor back as cursor, keeping the same filters, until it is null. Do not build or interpret the cursor. A 400 INVALID_QUERY with invalid cursor means a tampered cursor, one from another query or past the depth limit: restart the query.

  6. Decide and record. Keep the post_id (or the url and domain, for items of other organizations), the similarity and the passages that justified the rejection, for the human reviewer.

Janela do terminal
curl https://api.canverly.com/v1/search/similar \
-H "Authorization: Bearer ck_live_xxx" \
-H "Content-Type: application/json" \
-d '{"post_id": "019f0a1c-7d2e-7a10-9c4b-2f6a1d0e5b11", "min_words": 8, "limit": 10}'

Items from other organizations carry only similarity, longest_run_words, url, title, domain and snippet: no passages or coverage. For a detailed review, the person opens the public url.

Matching across rings with the fingerprint

Section titled “Matching across rings with the fingerprint”

To find out whether a text already exists in another ring (.net x .com) without sending the text there, ask for "fingerprint": true in similarity (or fingerprint=true in search). Each item comes back with fingerprint (content_hash, simhash, word_count) and the response carries source_fingerprint for your text, when it fits in up to 20,000 characters. An equal content_hash means the same normalised text; a simhash a few bits apart (Hamming distance) means near-identical texts. Keep only the fingerprints, not the text. On a whole-platform query (Group app), same_org tells what belongs to your organization from what belongs to another. External partners and ck_ keys can ask for fingerprint too, but only receive the fingerprints of their own organization’s posts. Details in Fingerprint.

Search has 600 req/min (burst of 50) and similarity 120 req/min per credential, each with its own bucket. Read RateLimit-Remaining and slow down before it hits zero.

  • 429 RATE_LIMITED: wait Retry-After seconds. It is not a failure: it is the quota.
  • 503 DEPENDENCIA_INDISPONIVEL, INDEX_UNAVAILABLE or OVERLOADED: a transient service failure. Retry with exponential backoff and jitter: wait min(60, 2^attempt) seconds times a random factor between 0.5 and 1.5, honoring Retry-After when larger, and give up after 5 attempts. Never treat 503 as an invalid credential.
  • Other 4xx: do not retry; fix the request. 401, 403 and 404 do not improve with a new attempt. 501 FILTER_UNSUPPORTED means the filter does not exist yet: remove it from the request.
async function withBackoff(send, max = 5) {
for (let t = 0; ; t++) {
const r = await send();
if (r.status !== 429 && r.status !== 503) return r;
if (t >= max) throw new Error(`gave up after ${t + 1} attempts: ${r.status}`);
const hint = Number(r.headers.get('retry-after')) || 0;
const wait = Math.min(60, 2 ** t) * (0.5 + Math.random());
await new Promise((ok) => setTimeout(ok, Math.max(hint, wait) * 1000));
}
}

The text you send in text is a draft, sometimes someone else’s. The API uses it only to query its own index and does not log it. Do the same on your side: do not send third-party drafts to external services for checking, do not put them in a URL (always use the POST body), do not write them to logs and do not keep them beyond the review.

What Value
Items per similarity call limit up to 50, but the source returns up to 20 posts per 20,000-character piece; a limit above 20 can lose matches and comes with truncated: true
Short excerpt in a long text Recall is lower: a copied excerpt shorter than min_words consecutive words never counts, and in a long text a short copy weighs little in similarity. Also check with phrase search
text 50 to 50,000 characters; above that, 413 TEXT_TOO_LARGE
post_id Only a published post of yours; above 50,000 characters it is cut (input_truncated: true)
Search limit up to 100; sites up to 100 ids; type, category, tag, update and sort filters still answer 501
Freshness The index is updated after publication; an item with stale: true may lag slightly behind the post