{"openapi":"3.1.0","info":{"title":"WriteHuman API","version":"1.3","termsOfService":"https://writehuman.ai/terms","description":"Humanize AI-generated text so it reads naturally.\n\n## Quickstart\n\n**1. Get your API key** — sign up or log in at [writehuman.ai](https://writehuman.ai/) and create your key from the dashboard.\n\n**2. Make your first request**\n\n<!-- title: cURL -->\n```bash\ncurl -X POST https://api.writehuman.ai/v1/humanize \\\n  -H \"Authorization: Bearer wh_live_your_api_key_here\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Artificial intelligence has revolutionized the way we approach content creation and digital communication.\"}'\n```\n\n<!-- title: Python -->\n```python\nimport requests\n\nr = requests.post(\n    \"https://api.writehuman.ai/v1/humanize\",\n    headers={\"Authorization\": \"Bearer wh_live_your_api_key_here\"},\n    json={\"text\": \"Artificial intelligence has revolutionized the way we approach content creation and digital communication.\"},\n)\nprint(r.json())\n```\n\n<!-- title: JavaScript -->\n```javascript\nconst resp = await fetch(\"https://api.writehuman.ai/v1/humanize\", {\n  method: \"POST\",\n  headers: {\n    \"Authorization\": \"Bearer wh_live_your_api_key_here\",\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    text: \"Artificial intelligence has revolutionized the way we approach content creation and digital communication.\",\n  }),\n});\nconsole.log(await resp.json());\n```\n\n**3. See the response**\n\nStandard plan:\n```json\n{\n  \"id\": \"hum_a1b2c3d4e5f6\",\n  \"created\": 1778533901580,\n  \"results\": [\"AI has changed how we create content and communicate online.\"],\n  \"scores\": null,\n  \"input_words\": 14,\n  \"words_remaining\": { \"included\": 124986, \"topup\": 0, \"total\": 124986 },\n  \"model\": \"standard\"\n}\n```\n\nPremium plan:\n```json\n{\n  \"id\": \"hum_a1b2c3d4e5f6\",\n  \"created\": 1778533901580,\n  \"results\": [\"Artificial intelligence has changed the game in content creation and communication.\\n\\n\", \"The role of artificial intelligence in transforming content creation and online communication is unprecedented.\\n\\n\", \"The use of artificial intelligence has changed the way we think about content creation and online communication.\"],\n  \"scores\": [0.82, 0.81, 0.79],\n  \"input_words\": 14,\n  \"words_remaining\": { \"included\": 399986, \"topup\": 0, \"total\": 399986 },\n  \"model\": \"standard\"\n}\n```\n\n## Authentication\nAll endpoints require a Bearer token in the `Authorization` header.\n```\nAuthorization: Bearer wh_live_your_api_key_here\n```\n\n## Errors\n\nEvery non-2xx response is a JSON object with a stable machine-readable `code` and a\nhuman-readable `error` message. Branch on `code`; the wording of `error` may change.\nA `402` for an exhausted balance also carries `words_remaining`. Request-body\nvalidation runs before authentication, so a malformed body returns `422` even without\na key.\n\nEvery `429`, `503` and `504` carries a `Retry-After` header in seconds. Wait at least\nthat long before retrying. Those statuses leave nothing charged and are safe to retry;\n`500` responses are not retried automatically by the official SDKs, because the\nrequest may have been processed. A `429`, `503` or `504` without this JSON body and\n`code` did not come from the API (a load balancer or proxy answered), carries no such\nguarantee, and should be handled like a client-side timeout: do not resend a billed\n`POST` automatically.\n\nWords are charged only on a `200`, with one exception: a `500 billing_failed` is\nreturned after a result was produced but the usage write failed part-way, and some of\nthe request's words, from the included allowance and/or from top-up credits, may\nalready have been charged. Every other non-2xx status leaves your balance unchanged.\nCheck `/v1/usage` after a `billing_failed`.\n\n| status | `code` | meaning |\n|---|---|---|\n| 422 | `invalid_request` | The body failed validation (missing `text`, too short or too long). |\n| 422 | `forbidden_param` | A parameter that is not available on the public API was sent. |\n| 422 | `word_limit` | The input is over the per-request word cap for your plan. |\n| 422 | `moderation_blocked` | Content moderation refused the input (`/v1/humanize` only). |\n| 422 | `freeze_tag_not_closed`, `freeze_tag_not_opened`, `freeze_tags_nested`, `freeze_tag_empty` | The `<freeze>` tags in `text` are malformed (accounts with freezing only; see `/v1/humanize`). Nothing charged. |\n| 422 | `nothing_to_rewrite` | Almost all of the text is frozen, so there is nothing left to humanize (accounts with freezing only). Nothing charged. |\n| 401 | `missing_api_key` | No usable `Authorization: Bearer` header. |\n| 401 | `invalid_api_key` | The key is unknown or revoked. |\n| 402 | `no_subscription` | The key is valid but the account has no active API subscription. |\n| 402 | `insufficient_balance` | Not enough words left for this request; `words_remaining` is included. |\n| 403 | `enhanced_requires_premium` | `enhanced: true` was sent on a Standard plan. `upgrade_url` links to the plans. Nothing charged. |\n| 403 | `enhanced_unavailable` | `enhanced: true` was sent while the enhanced model is switched off. Send the request without `enhanced`. Nothing charged. |\n| 403 | `reverify_required` | The account must be re-verified by email. The account owner signs in at writehuman.ai to continue; then the account's newest key created after the check began works within about a minute; every other key stays disabled until the check ends, so create a new key. Not retried by the SDKs. |\n| 429 | `rate_limited` | Over your plan's requests per minute. `Retry-After` is the time to the next window. |\n| 429 | `auth_locked_out` | Too many failed authentications from this address. `Retry-After` is the remaining lockout. |\n| 429 | `queue_full` | The admission queue is full. Retry after `Retry-After`. |\n| 429 | `queue_timeout` | The request waited in the admission queue past its deadline. Retry after `Retry-After`. |\n| 503 | `at_capacity` | Cluster-wide capacity shed. Retry after `Retry-After`. |\n| 503 | `billing_unavailable` | The billing store is unreachable; the request was refused rather than served unmetered. Retry after `Retry-After`. |\n| 503 | `detector_unavailable` | The detector, or the translation step before it, is unavailable (`/v1/detect` only). Retry after `Retry-After`. |\n| 504 | `timeout` | Generation did not finish within the server deadline (`/v1/humanize` only). Nothing charged; retry after `Retry-After`. |\n| 500 | `processing_failed` | Generation raised an error. |\n| 500 | `no_results` | Generation finished without a usable result. |\n| 500 | `safety_limit` | Generation produced far more text than the input; discarded. |\n| 500 | `billing_failed` | The result was produced but the usage write failed part-way; included and/or top-up words may already have been charged. Check `/v1/usage`. |\n\n## Plans\n\n| | Standard | Premium 400K | Premium 800K / 1.5M / 3M |\n|---|---|---|---|\n| Monthly words | 125,000 | 400,000 | 800,000 / 1,500,000 / 3,000,000 |\n| Max words per request | 2,000 | 4,000 | 6,000 |\n| Output variations | 1 | 3 | 3 |\n| Human-likeness scores | — | ✓ | ✓ |\n| Enhanced model (`enhanced: true`) | — | ✓ | ✓ |\n| Rate limit | 40 req/min | 120 req/min | 160 req/min |\n\nPremium plans automatically return 3 output variations per request with human-likeness scores. Standard plans return a single result without scores.\nUsage is tracked by input text word count. Words are deducted from your subscription first, then any top-up credits.\n\n## Supported Languages\n\nWriteHuman supports 40+ languages including English, Chinese (Mandarin), Chinese (Taiwan), French, Spanish, Vietnamese, Portuguese, Japanese, Ukrainian, Swedish, German, Russian, Italian, Arabic, Hindi, Bengali, Korean, Turkish, Dutch, Polish, Thai, Indonesian, Malay, Persian, Hebrew, Greek, Czech, Danish, Finnish, Norwegian, Romanian, Hungarian, Slovak, Bulgarian, Croatian, Serbian, Slovenian, Lithuanian, Latvian, Estonian, Urdu, Swahili, Tagalog, and Afrikaans.\n\n## Common Use Cases\n\n- **Content marketing platforms** generating blog posts, product descriptions, and ad copy with AI that need output indistinguishable from human writing.\n- **SEO agencies** producing high-volume content that must pass AI detection checks before publication.\n- **EdTech platforms and writing assistants** helping students improve AI-drafted essays into polished, human-quality work.\n- **SaaS products** with AI writing features where the final output needs to be indistinguishable from human writing.\n- **Enterprise teams** processing internal communications, reports, and documentation generated by large language models.\n\n## Terms of Service\n\nBy using the WriteHuman API you agree to our [Terms of Service](https://writehuman.ai/terms).\n","contact":{"name":"WriteHuman Support","url":"https://writehuman.zohodesk.com/portal/en/newticket","email":"support@writehuman.ai"}},"servers":[{"url":"https://api.writehuman.ai","description":"Production"},{"url":"https://api.dev.writehuman.ai","description":"Development"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/humanize":{"post":{"operationId":"humanize","summary":"Humanize text","description":"Rewrite AI-generated text to sound naturally human. Deducts input words from your balance.\n\nThe public API accepts `text`, `tone`, `language`, and `enhanced` only. Sending\n`model`, `num_outputs`, or `sequence_id` returns `422`.\n\nSet `enhanced: true` on a Premium plan to be served by our enhanced model. Words\nare charged the same as a standard request, and the response's `model` says which\nmodel served it. On a Standard plan it returns `403 enhanced_requires_premium` with\nan `upgrade_url`; while the enhanced model is switched off it returns\n`403 enhanced_unavailable`. Neither charges anything.\n\n**Freezing** keeps parts of your text exactly as you wrote them. It is English\nonly, and it is enabled per account on request (contact support); on any other\naccount `freeze_citations` is ignored and `<freeze>` tags are treated as ordinary\ntext. Two ways, which can be combined:\n\n- Wrap any passage in `<freeze>` and `</freeze>`. Tags cannot nest or overlap. A\n  tagged passage that spans several lines is kept line by line, so paragraph breaks\n  stay where they are.\n- Set `freeze_citations: true` to keep citations as written: numbered references\n  such as `[1]` or `[2–4]`, bracketed citation keys such as `[ref_3]`, author–year\n  references such as `(Smith et al., 2020)`, URLs and DOIs.\n\nThe tags are removed before anything else: they are never returned, never counted\ntoward the word limit and never charged. The request always returns humanized\ntext. The response then carries `frozen_items`: for each result, every frozen item\nin source order with its position in that result. Frozen text is kept in nearly\nevery case; an item that could not be kept in a result has `start` and `end` set to\n`null`, and that part of the result is humanized like the rest. Malformed tags, or\na text with almost nothing left to humanize once the frozen parts are set aside,\nreturn `422` and nothing is charged. For text in another language the request is\nhumanized as usual (tags are still removed), and frozen items are unlikely to be\nkept.\n","x-codeSamples":[{"lang":"cURL","label":"cURL","source":"curl -X POST https://api.writehuman.ai/v1/humanize \\\n  -H \"Authorization: Bearer wh_live_your_api_key_here\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"text\": \"Artificial intelligence has transformed numerous industries over the past decade.\",\n    \"tone\": \"professional\"\n  }'\n"},{"lang":"Python","label":"Python","source":"import requests\n\nr = requests.post(\n    \"https://api.writehuman.ai/v1/humanize\",\n    headers={\"Authorization\": \"Bearer wh_live_your_api_key_here\"},\n    json={\n        \"text\": \"Artificial intelligence has transformed numerous industries over the past decade.\",\n        \"tone\": \"professional\",\n    },\n)\nprint(r.json())\n"},{"lang":"JavaScript","label":"JavaScript","source":"const resp = await fetch(\"https://api.writehuman.ai/v1/humanize\", {\n  method: \"POST\",\n  headers: {\n    \"Authorization\": \"Bearer wh_live_your_api_key_here\",\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    text: \"Artificial intelligence has transformed numerous industries over the past decade.\",\n    tone: \"professional\",\n  }),\n});\nconsole.log(await resp.json());\n"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HumanizeRequest"},"examples":{"basic":{"summary":"Basic humanization","value":{"text":"Artificial intelligence has transformed numerous industries over the past decade. Machine learning algorithms now power recommendation systems, autonomous vehicles, and natural language processing tools."}},"with-tone":{"summary":"Professional tone","value":{"text":"The company reported strong quarterly earnings driven by increased demand.","tone":"professional"}},"enhanced":{"summary":"Enhanced model (Premium)","value":{"text":"The company reported strong quarterly earnings driven by increased demand.","enhanced":true}},"freezing":{"summary":"Freezing (accounts with freezing enabled)","value":{"text":"Remote work raised reported productivity by 13% in one large trial (Bloom et al., 2015). <freeze>Results may vary by role.</freeze> Managers should weigh these findings carefully.","freeze_citations":true}}}}}},"responses":{"200":{"description":"Text humanized successfully. Words deducted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HumanizeResponse"},"examples":{"standard":{"summary":"Standard plan","value":{"id":"hum_a1b2c3d4e5f6","created":1778533901580,"results":["Over the last ten years, AI has reshaped a wide range of sectors. Today, ML models drive everything from product recommendations to self-driving cars and advanced language tools."],"scores":null,"input_words":29,"words_remaining":{"included":124971,"topup":0,"total":124971},"model":"standard"}},"premium":{"summary":"Premium plan","value":{"id":"hum_a1b2c3d4e5f6","created":1778533901580,"results":["Over the last ten years, AI has reshaped a wide range of sectors. Today, ML models drive everything from product recommendations to self-driving cars and advanced language tools.","AI has reshaped many sectors over the past decade, powering recommendations, autonomous vehicles, and language tools.","In the last ten years, artificial intelligence has transformed numerous industries through machine learning."],"scores":[0.82,0.79,0.74],"input_words":29,"words_remaining":{"included":399971,"topup":0,"total":399971},"model":"standard"}},"premium-enhanced":{"summary":"Premium plan with `enhanced: true`","value":{"id":"hum_a1b2c3d4e5f6","created":1778533901580,"results":["Over the last ten years, AI has reshaped a wide range of sectors. Today, ML models drive everything from product recommendations to self-driving cars and advanced language tools.","AI has reshaped many sectors over the past decade, powering recommendations, autonomous vehicles, and language tools.","In the last ten years, artificial intelligence has transformed numerous industries through machine learning."],"scores":[0.86,0.83,0.8],"input_words":29,"words_remaining":{"included":399971,"topup":0,"total":399971},"model":"enhanced"}},"freezing":{"summary":"Freezing (accounts with freezing enabled)","value":{"id":"hum_a1b2c3d4e5f6","created":1778533901580,"results":["In one large trial, remote work lifted reported productivity by 13% (Bloom et al., 2015). Results may vary by role. Managers would do well to think these findings through."],"scores":null,"input_words":26,"words_remaining":{"included":124974,"topup":0,"total":124974},"model":"standard","frozen_items":[[{"text":"(Bloom et al., 2015)","start":68,"end":88},{"text":"Results may vary by role.","start":90,"end":115}]]}},"freezing-item-not-kept":{"summary":"Freezing: an item that could not be kept","value":{"id":"hum_a1b2c3d4e5f6","created":1778533901580,"results":["One large trial found remote work raised reported productivity by 13% (Bloom et al., 2015). Results can differ by role. Managers should weigh this carefully."],"scores":null,"input_words":26,"words_remaining":{"included":124974,"topup":0,"total":124974},"model":"standard","frozen_items":[[{"text":"(Bloom et al., 2015)","start":70,"end":90},{"text":"Results may vary by role.","start":null,"end":null}]]}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"invalid-key":{"summary":"Invalid API key","value":{"error":"Invalid API key","code":"invalid_api_key"}},"missing-header":{"summary":"Missing Authorization header","value":{"error":"Missing or invalid Authorization header. Use: Bearer <api_key>","code":"missing_api_key"}}}}}},"402":{"description":"No active subscription or insufficient word balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseWithBalance"},"examples":{"no-subscription":{"summary":"No active subscription","value":{"error":"No active subscription","code":"no_subscription"}},"insufficient-balance":{"summary":"Insufficient word balance","value":{"error":"Insufficient word balance","code":"insufficient_balance","words_remaining":{"included":12,"topup":0,"total":12}}}}}}},"403":{"description":"`enhanced_requires_premium`: `enhanced: true` was sent on a Standard plan. Upgrade\nat `upgrade_url`, or send the request without `enhanced`. Nothing is charged; do\nnot retry automatically.\n\n`enhanced_unavailable`: the enhanced model is switched off. Send the request\nwithout `enhanced`. Nothing is charged; do not retry automatically.\n\n`reverify_required`: the account must be re-verified by email before its keys\nare served again. The account owner signs in at writehuman.ai and follows the\nemailed link. The account's newest key created after the check began then works\nwithin about a minute; every other key stays disabled until the check ends, so\ncreate a new key on the dashboard. Nothing is charged. Do not retry automatically.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseWithUpgrade"},"examples":{"enhanced-requires-premium":{"summary":"`enhanced` on a Standard plan","value":{"error":"The enhanced parameter requires a Premium plan or above","code":"enhanced_requires_premium","upgrade_url":"https://writehuman.ai/api#pricing"}},"enhanced-unavailable":{"summary":"The enhanced model is switched off","value":{"error":"The enhanced model is not available right now","code":"enhanced_unavailable"}},"reverify-required":{"summary":"Account must be re-verified","value":{"error":"This account must be re-verified by email. The account owner should sign in at writehuman.ai to continue.","code":"reverify_required"}}}}}},"422":{"description":"Invalid input, forbidden parameters, malformed `<freeze>` tags, over word limit, or content blocked by moderation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"invalid-request":{"summary":"Invalid request body","value":{"error":"Invalid request: ...","code":"invalid_request"}},"forbidden-param-model":{"summary":"`model` is not available on the public API","value":{"error":"The model parameter is not available","code":"forbidden_param"}},"forbidden-param-num-outputs":{"summary":"`num_outputs` is not available on the public API","value":{"error":"The num_outputs parameter is not available","code":"forbidden_param"}},"forbidden-param-sequence-id":{"summary":"`sequence_id` is not available on the public API","value":{"error":"The sequence_id parameter is not available","code":"forbidden_param"}},"word-limit":{"summary":"Over word limit","value":{"error":"Input exceeds per-request limit of 2000 words for your plan. Received ~2500 words.","code":"word_limit"}},"moderation":{"summary":"Content blocked","value":{"error":"Content blocked: sexual","code":"moderation_blocked"}},"freeze-tag-not-closed":{"summary":"A `<freeze>` tag is never closed","value":{"error":"A <freeze> tag is never closed. Add the matching </freeze>.","code":"freeze_tag_not_closed"}},"freeze-tag-not-opened":{"summary":"A `</freeze>` tag has no opening tag","value":{"error":"A </freeze> tag has no <freeze> before it.","code":"freeze_tag_not_opened"}},"freeze-tags-nested":{"summary":"`<freeze>` tags nest or overlap","value":{"error":"A <freeze> tag starts inside another one. Tags cannot nest or overlap.","code":"freeze_tags_nested"}},"freeze-tag-empty":{"summary":"A `<freeze>` tag wraps no text","value":{"error":"A <freeze> tag wraps no text.","code":"freeze_tag_empty"}},"nothing-to-rewrite":{"summary":"Almost all of the text is frozen","value":{"error":"Almost all of the text is frozen, so there is nothing left to humanize.","code":"nothing_to_rewrite"}}}}}},"429":{"description":"Rate limit, queue capacity, or too many failed auth attempts.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Seconds before retrying. For `rate_limited` it is the time to the next one-minute window; for `auth_locked_out` the remaining lockout; for queue rejections a short fixed delay."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"rate-limit":{"summary":"Rate limited","value":{"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"}},"auth-failures":{"summary":"Too many failed auth attempts","value":{"error":"Too many failed authentication attempts","code":"auth_locked_out"}},"queue-full":{"summary":"Request queue full","value":{"error":"Too many queued requests. Please retry shortly.","code":"queue_full"}},"queue-timeout":{"summary":"Queue wait timeout","value":{"error":"Request waited too long for capacity. Please retry.","code":"queue_timeout"}}}}}},"503":{"description":"Service at capacity, or billing temporarily unavailable. No words charged.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Suggested seconds before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"at-capacity":{"summary":"Service at capacity","value":{"error":"Service is at capacity. Please retry shortly.","code":"at_capacity"}},"billing-unavailable":{"summary":"Billing temporarily unavailable","value":{"error":"Service temporarily unavailable, please retry shortly.","code":"billing_unavailable"}}}}}},"504":{"description":"The request did not finish within the server deadline (170 seconds from request entry; generation is stopped once 10 seconds remain so that billing is never cut part-way). No words charged; safe to retry.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Seconds before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"Processing did not finish within 160 seconds. Nothing was charged; please retry.","code":"timeout"}}}},"500":{"description":"Processing 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.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"processing-failed":{"summary":"Generation failed","value":{"error":"Processing failed","code":"processing_failed"}},"no-results":{"summary":"Generation returned nothing usable","value":{"error":"Processing returned no results","code":"no_results"}},"safety-limit":{"summary":"Output exceeded the safety limit","value":{"error":"Output exceeded safety limit","code":"safety_limit"}},"billing-failed":{"summary":"Billing update failed after generation","value":{"error":"Billing update failed","code":"billing_failed"}}}}}}}}},"/v1/usage":{"get":{"operationId":"getUsage","summary":"Get usage","description":"Returns your subscription usage, tier, and the API version. Read-only — never deducts words.\n\nRemaining balance = `included_words - words_used_this_cycle + topup_balance`.\n","x-codeSamples":[{"lang":"cURL","label":"cURL","source":"curl https://api.writehuman.ai/v1/usage \\\n  -H \"Authorization: Bearer wh_live_your_api_key_here\"\n"},{"lang":"Python","label":"Python","source":"import requests\n\nr = requests.get(\n    \"https://api.writehuman.ai/v1/usage\",\n    headers={\"Authorization\": \"Bearer wh_live_your_api_key_here\"},\n)\nprint(r.json())\n"},{"lang":"JavaScript","label":"JavaScript","source":"const resp = await fetch(\"https://api.writehuman.ai/v1/usage\", {\n  headers: { \"Authorization\": \"Bearer wh_live_your_api_key_here\" },\n});\nconsole.log(await resp.json());\n"}],"responses":{"200":{"description":"Current usage for the authenticated subscription.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"},"example":{"included_words":400000,"words_used_this_cycle":524,"topup_balance":520554,"tier":"api_premium","version":"v1.3"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/NoSubscription"},"403":{"$ref":"#/components/responses/ReverifyRequired"},"429":{"description":"Too many failed auth attempts.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Remaining lockout, in seconds."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"Too many failed authentication attempts","code":"auth_locked_out"}}}}}}},"/v1/detect":{"post":{"operationId":"detect","summary":"Detect AI-generated text","description":"Score text for AI authorship. **Billed per input word** (the original text — non-English input is translated to English before scoring at no extra charge).\n\nShares the same per-request word cap and per-minute rate limit as `/v1/humanize`. Detection skips content moderation: it is a read-only scoring operation, and callers may legitimately need to score flagged content.\n\n`ai_probability` is on a `0`–`1` scale where `1` = AI — the **opposite** orientation of the `/v1/humanize` `scores` field, where higher means more human-sounding.\n\nIf the detector is unavailable or at capacity (or, for non-English input, the translation step fails), the endpoint returns `503` and **no words are charged**.\n","x-codeSamples":[{"lang":"cURL","label":"cURL","source":"curl -X POST https://api.writehuman.ai/v1/detect \\\n  -H \"Authorization: Bearer wh_live_your_api_key_here\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Your text to check here.\", \"include_sentences\": true}'\n"},{"lang":"Python","label":"Python","source":"import requests\n\nr = requests.post(\n    \"https://api.writehuman.ai/v1/detect\",\n    headers={\"Authorization\": \"Bearer wh_live_your_api_key_here\"},\n    json={\"text\": \"Your text to check here.\", \"include_sentences\": True},\n)\nprint(r.json())\n"},{"lang":"JavaScript","label":"JavaScript","source":"const resp = await fetch(\"https://api.writehuman.ai/v1/detect\", {\n  method: \"POST\",\n  headers: {\n    \"Authorization\": \"Bearer wh_live_your_api_key_here\",\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    text: \"Your text to check here.\",\n    include_sentences: true,\n  }),\n});\nconsole.log(await resp.json());\n"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectRequest"},"examples":{"basic":{"summary":"Document-level score","value":{"text":"Artificial intelligence has transformed numerous industries over the past decade. Machine learning algorithms now power recommendation systems and natural language processing tools."}},"with-sentences":{"summary":"Include per-sentence probabilities","value":{"text":"Artificial intelligence has transformed numerous industries over the past decade. Machine learning algorithms now power recommendation systems and natural language processing tools.","include_sentences":true}}}}}},"responses":{"200":{"description":"Detection scored successfully. Words deducted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectResponse"},"examples":{"document":{"summary":"Document-level score","value":{"scanId":"20260609ICVGLRR6","version":"txtdetect-2026-05-14","versionID":"V1.1.1","ai_probability":0.96,"predicted_class":"ai","class_probabilities":{"ai":0.96,"human":0.02,"mixed":0.02},"request_meta":{"doc_length":{"chars":799,"tokens":126}},"language":"English"}},"with-sentences":{"summary":"With per-sentence probabilities","value":{"scanId":"20260609ICVGLRR6","version":"txtdetect-2026-05-14","versionID":"V1.1.1","ai_probability":0.96,"predicted_class":"ai","class_probabilities":{"ai":0.96,"human":0.02,"mixed":0.02},"request_meta":{"doc_length":{"chars":799,"tokens":126}},"language":"English","sentences":[{"text":"Artificial intelligence has rapidly transformed modern business.","ai_prob":0.97},{"text":"Many teams now depend on it every single day.","ai_prob":0.61}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"No active subscription or insufficient word balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseWithBalance"},"examples":{"no-subscription":{"summary":"No active subscription","value":{"error":"No active subscription","code":"no_subscription"}},"insufficient-balance":{"summary":"Insufficient word balance","value":{"error":"Insufficient word balance","code":"insufficient_balance","words_remaining":{"included":12,"topup":0,"total":12}}}}}}},"403":{"$ref":"#/components/responses/ReverifyRequired"},"422":{"description":"Invalid input or over the per-request word limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"invalid-request":{"summary":"Invalid request body","value":{"error":"Invalid request: ...","code":"invalid_request"}},"word-limit":{"summary":"Over word limit","value":{"error":"Input exceeds per-request limit of 2000 words for your plan. Received ~2500 words.","code":"word_limit"}}}}}},"429":{"description":"Rate limit or too many failed auth attempts.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Seconds before retrying. For `rate_limited` it is the time to the next one-minute window; for `auth_locked_out` the remaining lockout."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"rate-limit":{"summary":"Rate limited","value":{"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"}},"auth-failures":{"summary":"Too many failed auth attempts","value":{"error":"Too many failed authentication attempts","code":"auth_locked_out"}}}}}},"503":{"description":"Detector unavailable or at capacity, translation failed, or billing temporarily unavailable. No words charged.","headers":{"Retry-After":{"required":true,"schema":{"type":"integer"},"description":"Seconds before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"detector-unavailable":{"summary":"Detector unavailable, at capacity, or translation failed","value":{"error":"Detection service unavailable. Please retry.","code":"detector_unavailable"}},"billing-unavailable":{"summary":"Billing temporarily unavailable","value":{"error":"Service temporarily unavailable, please retry shortly.","code":"billing_unavailable"}}}}}},"500":{"description":"Billing update failure after a successful scan. Some of the request's words (included and/or top-up) may already have been charged before the write failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"Billing update failed","code":"billing_failed"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Your WriteHuman API key, e.g. `wh_live_abc123...`"}},"schemas":{"HumanizeRequest":{"type":"object","required":["text"],"properties":{"text":{"type":"string","minLength":30,"maxLength":100000,"description":"The text to humanize."},"tone":{"type":["string","null"],"enum":["professional","academic","blog","casual","creative","scientific","technical",null],"description":"Optional writing tone. Omit for default style. A value outside this list is ignored."},"language":{"type":["string","null"],"description":"Target language (e.g. `English`, `Spanish`, `Chinese (Mandarin)`). Auto-detected if omitted."},"enhanced":{"type":"boolean","default":false,"description":"Serve this request with our enhanced model. Premium plans and above; on a Standard plan `true` returns `403 enhanced_requires_premium`. Must be a JSON boolean."},"freeze_citations":{"type":"boolean","default":false,"description":"Keep the text's citations exactly as written (English only). Available on accounts with freezing enabled, on request; ignored on other accounts. Must be a JSON boolean."}}},"HumanizeResponse":{"type":"object","additionalProperties":false,"required":["id","created","results","scores","input_words","words_remaining","model"],"properties":{"id":{"type":"string","description":"Unique identifier for this humanization request."},"created":{"type":"integer","description":"Unix timestamp (milliseconds) when the request was received."},"results":{"type":"array","items":{"type":"string"},"description":"Humanized text variations, sorted by score (best first)."},"scores":{"type":["array","null"],"items":{"type":["number","null"]},"description":"Human-likeness score per result (0–1, higher = more human). `null` on Standard plans; array on Premium."},"input_words":{"type":"integer","description":"Number of words billed for this request."},"words_remaining":{"$ref":"#/components/schemas/WordsRemaining"},"model":{"type":"string","enum":["standard","enhanced"],"description":"Which model served the request: `enhanced` when the request was sent with `enhanced: true`, else `standard`."},"frozen_items":{"type":"array","items":{"type":"array","items":{"$ref":"#/components/schemas/FrozenItem"}},"description":"Present only when the request used freezing. One list per entry of `results`, in the same order: every frozen item in source order, with its place in that result."}}},"FrozenItem":{"type":"object","additionalProperties":false,"required":["text","start","end"],"properties":{"text":{"type":"string","description":"The frozen text, exactly as sent (without the tags)."},"start":{"type":["integer","null"],"description":"Offset where the item starts in the result, counted in Unicode code points (in JavaScript, index `Array.from(result)`); `null` when it could not be kept."},"end":{"type":["integer","null"],"description":"Offset just past the item's end in the result, counted in Unicode code points; `null` when it could not be kept."}}},"WordsRemaining":{"type":"object","additionalProperties":false,"required":["included","topup","total"],"properties":{"included":{"type":"integer","description":"Words remaining in your monthly subscription allowance."},"topup":{"type":"integer","description":"Words remaining from purchased top-ups."},"total":{"type":"integer","description":"Total words available (included + topup)."}}},"UsageResponse":{"type":"object","additionalProperties":false,"required":["included_words","words_used_this_cycle","topup_balance","tier","version"],"properties":{"included_words":{"type":"integer","description":"Monthly word allowance for your plan."},"words_used_this_cycle":{"type":"integer","description":"Words consumed in the current billing cycle."},"topup_balance":{"type":"integer","description":"Remaining purchased top-up words."},"tier":{"type":"string","enum":["api_standard","api_premium"],"description":"Your plan. Every Premium size reports `api_premium`."},"version":{"type":"string","description":"API version."}}},"DetectRequest":{"type":"object","required":["text"],"properties":{"text":{"type":"string","minLength":10,"maxLength":100000,"description":"The text to score."},"language":{"type":["string","null"],"description":"Language of the input (e.g. `English`, `Spanish`). Auto-detected if omitted. Non-English text is translated to English before scoring."},"include_sentences":{"type":"boolean","default":false,"description":"Include per-sentence AI probabilities in the response."}}},"DetectResponse":{"type":"object","additionalProperties":false,"required":["scanId","version","versionID","ai_probability","predicted_class","class_probabilities","request_meta","language"],"properties":{"scanId":{"type":["string","null"],"description":"Identifier for this detection scan."},"version":{"type":["string","null"],"description":"Detector model version."},"versionID":{"type":["string","null"],"description":"Detector build identifier."},"ai_probability":{"type":["number","null"],"minimum":0,"maximum":1,"description":"Probability the text is AI-generated (`1` = AI — opposite orientation of `/v1/humanize` scores)."},"predicted_class":{"type":["string","null"],"enum":["ai","human","mixed",null],"description":"Overall label for the document."},"class_probabilities":{"type":"object","additionalProperties":false,"properties":{"ai":{"type":["number","null"]},"human":{"type":["number","null"]},"mixed":{"type":["number","null"]}},"description":"Probabilities for each class."},"request_meta":{"type":"object","additionalProperties":false,"required":["doc_length"],"properties":{"doc_length":{"type":"object","additionalProperties":false,"required":["chars","tokens"],"properties":{"chars":{"type":["integer","null"]},"tokens":{"type":["integer","null"]}},"description":"Length of the scored text."}}},"language":{"type":"string","description":"Detected (or supplied) language of the input."},"sentences":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["text","ai_prob"],"properties":{"text":{"type":["string","null"]},"ai_prob":{"type":["number","null"]}}},"description":"Per-sentence AI probabilities. Present only when `include_sentences` is `true`."}}},"ErrorCode":{"type":"string","description":"Stable, machine-readable reason for a non-2xx response. Branch on this, not on\n`error`, whose wording may change.\n","enum":["invalid_request","forbidden_param","word_limit","moderation_blocked","freeze_tag_not_closed","freeze_tag_not_opened","freeze_tags_nested","freeze_tag_empty","nothing_to_rewrite","missing_api_key","invalid_api_key","no_subscription","insufficient_balance","reverify_required","enhanced_requires_premium","enhanced_unavailable","rate_limited","auth_locked_out","queue_full","queue_timeout","at_capacity","billing_unavailable","detector_unavailable","timeout","processing_failed","no_results","safety_limit","billing_failed"]},"ErrorResponse":{"type":"object","additionalProperties":false,"required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable error message."},"code":{"$ref":"#/components/schemas/ErrorCode"}}},"ErrorResponseWithBalance":{"type":"object","additionalProperties":false,"required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable error message."},"code":{"$ref":"#/components/schemas/ErrorCode"},"words_remaining":{"$ref":"#/components/schemas/WordsRemaining"}}},"ErrorResponseWithUpgrade":{"type":"object","additionalProperties":false,"required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable error message."},"code":{"$ref":"#/components/schemas/ErrorCode"},"upgrade_url":{"type":"string","format":"uri","description":"Where to upgrade the plan. Present on `enhanced_requires_premium`."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"invalid-key":{"summary":"Invalid API key","value":{"error":"Invalid API key","code":"invalid_api_key"}},"missing-header":{"summary":"Missing Authorization header","value":{"error":"Missing or invalid Authorization header","code":"missing_api_key"}}}}}},"NoSubscription":{"description":"No active subscription (HTTP 402).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"No active subscription","code":"no_subscription"}}}},"ReverifyRequired":{"description":"The account must be re-verified by email before its keys are served again (HTTP 403).\nThe account owner signs in at writehuman.ai and follows the emailed link. The\naccount's newest key created after the check began then works within about a minute;\nevery other key stays disabled until the check ends, so create a new key on the\ndashboard. Nothing is charged. Do not retry automatically.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"This account must be re-verified by email. The account owner should sign in at writehuman.ai to continue.","code":"reverify_required"}}}}}}}