# Humanizer

Transform AI-generated text into natural, human-like content.

Source: https://docs.walterwrites.ai/api-reference/humanizer

## POST /api/humanizer/

Transform AI-generated text into natural, human-like content that bypasses AI detection tools.

**Authentication:** `X-API-Key` header with `humanizer` scope

## Request Parameters

| Parameter        | Type    | Required | Description                                              |
| ---------------- | ------- | -------- | -------------------------------------------------------- |
| `content`        | string  | Yes      | Text content to humanize                                 |
| `callback_url`   | string  | No       | URL to receive results asynchronously via webhook        |
| `poll`           | boolean | No       | Set to `true` to enable polling mode (default: `false`)  |
| `webhook_secret` | string  | No       | Secret sent in `X-Webhook-Secret` header of webhook POST |

## Limits

| Limit          | Value       |
| -------------- | ----------- |
| Minimum length | 50 words    |
| Maximum length | 2,000 words |

Requests outside these bounds are rejected with `400` (code `service_error`) before any credits are charged. The limits apply to both synchronous and asynchronous requests.

## Processing Modes

The endpoint supports synchronous and asynchronous processing:

| Parameters                    | Mode                | Response                                                                            |
| ----------------------------- | ------------------- | ----------------------------------------------------------------------------------- |
| *(none)*                      | **Sync**            | `200 OK` — result in response body                                                  |
| `callback_url`                | **Async + webhook** | `202 Accepted` — result POSTed to your URL                                          |
| `poll: true`                  | **Async + polling** | `202 Accepted` — result via [`GET /api/jobs/{task_id}/`](https://docs.walterwrites.ai/api-reference/async-jobs.md) |
| `callback_url` + `poll: true` | **Async + both**    | `202 Accepted` — result via webhook AND polling                                     |

See [Async Jobs](https://docs.walterwrites.ai/api-reference/async-jobs.md) for details on asynchronous processing.

## Synchronous Example

### Request

```bash
curl -X POST https://developer-portal.walterwrites.ai/api/humanizer/ \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "content": "Artificial intelligence has revolutionized numerous industries by automating complex tasks and improving business decisions. Organizations across healthcare, finance, and manufacturing now rely on machine learning models to analyze vast amounts of data, identify meaningful patterns, and generate accurate predictions. As these technologies continue to evolve, they are expected to deliver even greater efficiency, innovation, and value across the global economy."
  }'
```

### Response (200 OK)

```json
{
  "status": "success",
  "task_id": null,
  "result": "AI has changed the way many industries work. It takes over complicated tasks and helps people make better decisions. Hospitals, banks, and factories now use machine learning to dig through huge amounts of data, spot useful patterns, and make solid predictions. As the technology keeps improving, it should bring even more efficiency, fresh ideas, and value to economies around the world.",
  "service_name": "humanizer_service",
  "execution_time": 2.34,
  "word_count": 60,
  "credits_remaining": 1940,
  "user": {
    "id": 12345
  }
}
```

## Asynchronous Example

### Request

```bash
curl -X POST https://developer-portal.walterwrites.ai/api/humanizer/ \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "content": "Artificial intelligence has revolutionized numerous industries by automating complex tasks and improving business decisions. Organizations across healthcare, finance, and manufacturing now rely on machine learning models to analyze vast amounts of data, identify meaningful patterns, and generate accurate predictions. As these technologies continue to evolve, they are expected to deliver even greater efficiency, innovation, and value across the global economy.",
    "poll": true,
    "callback_url": "https://your-server.com/webhook",
    "webhook_secret": "your_secret_123"
  }'
```

### Response (202 Accepted)

```json
{
  "status": "pending",
  "task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "result": null,
  "service_name": null,
  "execution_time": null,
  "word_count": 60,
  "credits_remaining": 1940,
  "user": {
    "id": 12345
  }
}
```

Use the returned `task_id` to [poll for results](https://docs.walterwrites.ai/api-reference/async-jobs.md), or wait for the webhook delivery to your `callback_url`.

## Response Fields

| Field               | Type           | Description                                                       |
| ------------------- | -------------- | ----------------------------------------------------------------- |
| `status`            | string         | `"success"` (sync) or `"pending"` (async)                         |
| `task_id`           | string \| null | Job ID for async requests; `null` for sync                        |
| `result`            | string \| null | Humanized text (sync) or `null` (async)                           |
| `service_name`      | string \| null | Name of the service that handled the request. For reference only. |
| `execution_time`    | float \| null  | Processing time in seconds                                        |
| `word_count`        | integer        | Word count of input text                                          |
| `credits_remaining` | integer        | Credit balance after this request                                 |
| `user.id`           | integer        | Your user ID                                                      |

## Rate Limits

| Mode             | Limit                                                                                |
| ---------------- | ------------------------------------------------------------------------------------ |
| **Synchronous**  | 3 requests per minute per user                                                       |
| **Asynchronous** | No time-based limit — constrained by credits and pending jobs limit (varies by plan) |

> **Note:** Rate limits may vary by plan. Higher-tier plans may have higher limits.

## Webhook Delivery

When using `callback_url`, the result is POSTed to your URL as JSON with the same response structure as the synchronous response. If you provided a `webhook_secret`, it is sent in the `X-Webhook-Secret` header so you can verify the request originated from WalterAI.

> **Warning:** The `callback_url` must be a publicly routable URL. Requests to private, internal, or reserved IP addresses are blocked for security reasons.

```
POST https://your-server.com/webhook
Content-Type: application/json
X-Webhook-Secret: your_secret_123

{
  "status": "success",
  "task_id": "a1b2c3d4-...",
  "result": "Humanized text...",
  ...
}
```
