Humanize text
POSThttps://api.writehuman.ai/v1/humanize
Rewrites text so that it reads as human-written. Requests are charged by the number of words submitted, and only when the request succeeds.
curl https://api.writehuman.ai/v1/humanize \ -H "Authorization: Bearer $WRITEHUMAN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Artificial intelligence has revolutionized the way we approach content creation and digital communication." }'{ "id": "hum_a1b2c3d4-e5f", "created": 1778533901580, "results": [ "AI has changed how we create content and communicate online." ], "scores": null, "input_words": 14, "words_remaining": { "included": 124986, "topup": 0, "total": 124986 }, "model": "standard"}Request body#
A JSON object. Only text is required.
textstringrequiredThe text to rewrite. 30 to 100,000 characters. The plan also limits the number of words per request: see Plans and limits.
tonestringThe writing style of the result. Values are lowercase and case-sensitive. Omit the field to use the default style. Any other value is ignored without an error.
languagestringThe language of
text, by its English name, such asSpanish. The result is returned in the same language. Detected from the text if omitted. See Tone and language for the supported languages.and 40 moreenhancedbooleanUses the enhanced model for this request, at the same per-word rate. Default: false. Premium plans only. Must be a JSON boolean. See Enhanced model.
freeze_citationsbooleanPreserves citations, URLs and DOIs exactly as written. Default: false. Applies only to accounts with freezing enabled and is ignored otherwise. See Freezing text.
Unrecognized fields are ignored, with three exceptions: model, num_outputs and sequence_id are rejected with 422 forbidden_param. The number of results is determined by the plan, and the model by enhanced.
Response#
A 200 response indicates that the text was rewritten and the words were charged.
idstringIdentifier of this request, such as
hum_a1b2c3d4-e5f.createdintegerWhen the request arrived, as a Unix timestamp in milliseconds.
resultsstring[]The rewritten text. One entry on Standard plans and three on Premium plans, ordered best first.
scores(number | null)[] | nullOn Premium plans, one score per entry of
results, from 0 to 1, where a higher score indicates more human-like text.nullon Standard plans.An individual entry is
nullif that result could not be scored. A score equals 1 minus theai_probabilitythat /v1/detect returns for the same text, so a separate detect request is unnecessary.input_wordsintegerThe number of words charged for this request.
words_remainingobjectThe account balance after this request.
includedinteger- Words remaining in the plan allowance for the current cycle.
topupinteger- Words remaining from top-ups.
totalinteger- The sum of
includedandtopup.
modelstringenhancedwhen the request setenhanced: true, otherwisestandard.frozen_itemsobject[][]Present only for requests that used freezing. One list per entry of
results, in the same order, containing every frozen item in the order it appeared in the input.textstring- The frozen text exactly as submitted, without the tags.
startinteger | null- The start offset of the item in that result, in Unicode code points.
nullif the item could not be preserved. endinteger | null- The end offset of the item, exclusive.
nullif the item could not be preserved.
Behavior#
- Length and structure. Results are generated to preserve the paragraph structure of the input and to remain close to it in length.
- Result order on Premium.
results[0]is the result ranked best overall. It usually, but not always, has the highest score. To rank by score alone, sort the results byscores. - Response time. Short inputs typically return within a few seconds. Requests near the plan's word limit can take up to a minute. The API always responds within 170 seconds. See Timeouts for recommended client settings.
- Other languages. Non-English text takes longer to process than English text of the same length.
- Blocked content. Text that fails content moderation is rejected with 422
moderation_blockedand is not charged. - No idempotency. The API does not support idempotency keys. Submitting the same text twice results in two rewrites and two charges.
Errors#
Every error response contains a code and an error message. The Errors page describes each code and indicates which errors can be retried.
401Missing or invalid API key.Show examples
Invalid API key
{ "error": "Invalid API key", "code": "invalid_api_key"}Missing Authorization header
{ "error": "Missing or invalid Authorization header. Use: Bearer <api_key>", "code": "missing_api_key"}402No active subscription or insufficient word balance.Show examples
No active subscription
{ "error": "No active subscription", "code": "no_subscription"}Insufficient word balance
{ "error": "Insufficient word balance", "code": "insufficient_balance", "words_remaining": { "included": 12, "topup": 0, "total": 12 }}403The request was rejected before processing, and no words were charged. The code identifies the reason.Show examples
enhanced on a Standard plan
{ "error": "The enhanced parameter requires a Premium plan or above", "code": "enhanced_requires_premium", "upgrade_url": "https://writehuman.ai/api#pricing"}The enhanced model is switched off
{ "error": "The enhanced model is not available right now", "code": "enhanced_unavailable"}Account must be re-verified
{ "error": "This account must be re-verified by email. The account owner should sign in at writehuman.ai to continue.", "code": "reverify_required"}422Invalid input, forbidden parameters, malformed <freeze> tags, over word limit, or content blocked by moderation.Show examples
Invalid request body
{ "error": "Invalid request: ...", "code": "invalid_request"}model is not available on the public API
{ "error": "The model parameter is not available", "code": "forbidden_param"}num_outputs is not available on the public API
{ "error": "The num_outputs parameter is not available", "code": "forbidden_param"}sequence_id is not available on the public API
{ "error": "The sequence_id parameter is not available", "code": "forbidden_param"}Over word limit
{ "error": "Input exceeds per-request limit of 2000 words for your plan. Received ~2500 words.", "code": "word_limit"}Content blocked
{ "error": "Content blocked: sexual", "code": "moderation_blocked"}A <freeze> tag is never closed
{ "error": "A <freeze> tag is never closed. Add the matching </freeze>.", "code": "freeze_tag_not_closed"}A </freeze> tag has no opening tag
{ "error": "A </freeze> tag has no <freeze> before it.", "code": "freeze_tag_not_opened"}<freeze> tags nest or overlap
{ "error": "A <freeze> tag starts inside another one. Tags cannot nest or overlap.", "code": "freeze_tags_nested"}A <freeze> tag wraps no text
{ "error": "A <freeze> tag wraps no text.", "code": "freeze_tag_empty"}Almost all of the text is frozen
{ "error": "Almost all of the text is frozen, so there is nothing left to humanize.", "code": "nothing_to_rewrite"}429Rate limit, queue capacity, or too many failed auth attempts.Show examples
Rate limited
{ "error": "Rate limit exceeded for your plan (api_standard -> 40/min). api_standard: 40/min | api_premium: 120/min | api_premium 800K+: 160/min", "code": "rate_limited"}Too many failed auth attempts
{ "error": "Too many failed authentication attempts", "code": "auth_locked_out"}Request queue full
{ "error": "Too many queued requests. Please retry shortly.", "code": "queue_full"}Queue wait timeout
{ "error": "Request waited too long for capacity. Please retry.", "code": "queue_timeout"}500Processing failure. No words charged, except that billing_failed may have charged some of the request's words (included and/or top-up) before the usage write failed.Show examples
Generation failed
{ "error": "Processing failed", "code": "processing_failed"}Generation returned nothing usable
{ "error": "Processing returned no results", "code": "no_results"}Output exceeded the safety limit
{ "error": "Output exceeded safety limit", "code": "safety_limit"}Billing update failed after generation
{ "error": "Billing update failed", "code": "billing_failed"}503Service at capacity, or billing temporarily unavailable. No words charged.Show examples
Service at capacity
{ "error": "Service is at capacity. Please retry shortly.", "code": "at_capacity"}Billing temporarily unavailable
{ "error": "Service temporarily unavailable, please retry shortly.", "code": "billing_unavailable"}504The request did not finish within 170 seconds. No words were charged, and the request is safe to retry.Show example
{ "error": "Processing did not finish within 160 seconds. Nothing was charged; please retry.", "code": "timeout"}