AI Humanizer API Guide: Humanize and Detect Text in Your App
Add sentence-level humanizing and AI detection to your product. Working curl and Node examples, error handling, credit estimates and security tips.
An AI humanizer API lets your own product send a draft to a service, get back a revised version, and see which sentences changed. Academic Humanizer offers two endpoints for this: POST /api/v2/external/humanize rewrites only the sentences that read as machine text, and POST /api/v2/external/detector returns an AI detection assessment for up to 100,000 characters. Both authenticate with an API key and spend credits from the account that owns it.
This guide is the practical companion to our API v2 overview. It walks through real integration patterns, working curl and Node examples, how to handle errors and rate limits, how to estimate cost before you call, and the security habits that keep a key from leaking. The complete field reference lives at /docs; when this post and the docs differ, the docs win.
Where an AI humanizer API fits
Most teams that ask about the API already handle academic text somewhere in their stack. Three patterns come up again and again.
- Writing platforms. A thesis editor or manuscript tool adds a "revise flagged sentences" button next to its grammar check. The author sees each changed sentence and decides whether to keep it.
- LMS plug-ins. A course tool calls the detector so students can check their own drafts before submission. Used this way, the signal helps writers revise; it should never act as an automatic verdict on a student.
- Editing services. A language-editing firm runs client manuscripts through the detector first, then sends only the flagged passages to the humanizer, so the human editor starts from a cleaner draft and a short list of changes.
In all three, a person reviews the output. AI rewriting can introduce errors or shift meaning, and the author stays responsible for the final text. If your product serves students, also make it easy for them to check their institution's AI policy before they use any revision tool.
How a request moves through the API
Every call passes the same checks before any text is processed. Knowing the order helps when you read error codes later.
- API keyThe key in the X-API-Key header must be valid and active, on an active account.
- IP allow-listIf the key is in restricted mode, the request must come from a listed IP or CIDR range.
- Rate limitRequests above the per-second limit return HTTP 429.
- Credit checkThe account needs enough credits for the request, or it fails with a clear error.
- ResultThe text is analysed or rewritten, saved to the account, and returned as JSON.
Keys are created at /api while signed in. A key is shown once, at creation, and only a hash is stored on our side, so copy it straight into your secret store. The default rate limit is 10 requests per second per key.
The Humanize endpoint, with curl
The body is JSON with one required field, originalContent, and one optional field, researchField. Use it to tell the engine which discipline the text comes from. Supported values are Arts and Humanities, Social Sciences, Business and Economics, Engineering, Natural Sciences, and Medical and Health Sciences.
curl -X POST https://academichumanizer.ai/api/v2/external/humanize \
-H "Content-Type: application/json" \
-H "X-API-Key: $AH_API_KEY" \
-d '{"originalContent": "Paste the paragraph to revise here.", "researchField": "Social Sciences"}' \
-i
The -i flag prints response headers, which matters here: the saved result ID comes back in the X-Humanizer-Id header, not in the body. Store it next to your own record so you can trace a request to the saved result in the account later.
The JSON body includes humanizedText (the full revised text), changedCount (how many sentences were rewritten), per-sentence results, detector results for both the input and the output, and an overall assessment. The exact shape of the per-sentence and detector objects is documented at /docs; read it there rather than guessing from one sample response.
Why changedCount can be zero
Humanizer v2 works sentence by sentence. It scans the draft for sentences that AI detectors flag, rewrites only those, and leaves every other sentence exactly as the author wrote it. If nothing is flagged, the output equals the input and no credits are charged.
That has two consequences for your code. First, a changedCount of 0 is a normal, successful result, not an error; show the user a message such as "No sentences needed revision" instead of an empty diff. Second, you do not need your own logic to protect unflagged sentences. The engine already keeps them verbatim, along with numbers, citations and field terms in the sentences it does rewrite.
The Detector endpoint
The detector takes a single field, text, up to 100,000 characters, and returns an overall document assessment with the detector results. It costs 1 credit per 5,000 characters. A useful pattern is detector first, humanizer second: show the author which passages raise signals, let them choose what to revise, and only then call Humanize on those passages. That keeps both cost and changes small.
curl -X POST https://academichumanizer.ai/api/v2/external/detector \
-H "Content-Type: application/json" \
-H "X-API-Key: $AH_API_KEY" \
-d '{"text": "Paste the full chapter or paper here."}'
Verdicts use three labels: Human-written, Human-written & AI-refined, and AI-generated. The document rule is calibrated so that about 1% of whole human-written papers are flagged in each supported language. That is a low false-positive target, not zero, so present the result as a signal to review.
A Node.js client with retries
The sketch below uses the built-in fetch in Node 18 or later. It retries only on HTTP 429, with exponential backoff, and surfaces every other error to the caller.
const API = "https://academichumanizer.ai/api/v2/external";
async function callApi(path, body, attempt = 0) {
const res = await fetch(`${API}/${path}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": process.env.AH_API_KEY,
},
body: JSON.stringify(body),
});
if (res.status === 429 && attempt < 3) {
await new Promise((r) => setTimeout(r, 500 * 2 ** attempt));
return callApi(path, body, attempt + 1);
}
const data = await res.json();
if (!res.ok) {
throw new Error(`Academic Humanizer API ${res.status}: ${data.code ?? "unknown"}`);
}
return { data, humanizerId: res.headers.get("X-Humanizer-Id") };
}
const draft = "Paste the paragraph to revise here.";
const check = await callApi("detector", { text: draft });
console.log(check.data);
const { data, humanizerId } = await callApi("humanize", {
originalContent: draft,
researchField: "Natural Sciences",
});
if (data.changedCount === 0) {
console.log("No sentences needed revision.");
} else {
console.log(data.humanizedText, humanizerId);
}
Keep this code on your server. The key must never reach a browser bundle or a mobile app, where anyone can read it.
Errors you should handle
| Status | Usual cause | What to do |
|---|---|---|
| 400 | Missing or empty text, text over the limit, or an unsupported research field | Fix the request; do not retry as is |
| 401 | Missing or invalid key, or an inactive account | Check the key in your secret store |
| 403 | IP outside the allow-list, or insufficient credits | Read the error code to tell the two apart |
| 429 | Rate limit exceeded | Back off and retry |
Error bodies carry a short machine-readable code; branch on that code, not on the message text, which may change. For 5xx responses or network timeouts on Humanize, avoid blind retries. Credits are charged only when a complete result is saved, so check whether a result was saved before you send the same text again.
Estimating credits before you call
Humanize costs 1 credit per 500 characters, rounded up per request, and only when a complete result is saved. A run with zero changed sentences costs nothing. Detector costs 1 credit per 5,000 characters, rounded up. A quick estimate in code is Math.ceil(text.length / 500) for Humanize and Math.ceil(text.length / 5000) for Detector; treat it as approximate, since the server does the final count.
For long documents, split by paragraph or section rather than by a fixed character count. Breaking a paragraph in the middle gives the engine less context, and the rounding happens per request either way. Plans and credit packs are explained in how credits and pricing work; current prices are on /pricing.
Security checklist for production
- Store the key in a secret manager or server environment variable. It is shown only once, so you cannot recover it later from the dashboard.
- Turn on restricted IP mode and list your servers' egress IPs or CIDR blocks. A leaked key is then useless from anywhere else.
- Keep keys out of logs, error trackers and screenshots. Log the
X-Humanizer-Idinstead; it identifies the result without exposing the key. - Use a separate key per environment so you can tell staging traffic from production at a glance.
- Confirm that your users have the right to upload the text they send, and show them every output before it is used.
Building with Academic Humanizer
If your product already handles manuscripts, coursework or grant text, the API adds a detection check and a sentence-level revision step without sending users to another site. Inputs can be in English, Korean, Chinese, Japanese, Spanish, French, Portuguese, Russian or Arabic, and the product is validated against Turnitin, GPTZero, ZeroGPT, Copyleaks, Sapling and Originality.ai, with no guaranteed outcome on any of them. Start with the 10 free credits every new account gets, run a few real paragraphs through both endpoints, and read /docs before you go live.
Your ideas, without the AI footprint
Paste a draft and see which sentences AI detectors flag, then humanize only those sentences.
Try Humanizer free


