API

API Documentation

Integrate RewriteAI's humanization and analysis endpoints into your own application.

This page is the single reference for the RewriteAI API: quick start, endpoints, examples, errors, rate limits and API keys.

API keys are live. Create one from the dashboard API section - it is shown once at creation. The versioned /v1 endpoints require the key; the original /humanize and /detect endpoints stay open without one. Rate limits are enforced (60 requests/minute); paid plans are live but API usage billing is not enforced yet - see pricing for API access plans.

Quick Start

The API is a single base URL. Send a POST request with a JSON body and read the JSON response. The original endpoints (/humanize, /detect) need no authorization header; the versioned /v1 endpoints require an API key.

Base URL
https://api.rewriteai.site

Your first call can be as simple as the cURL example below. Responses are plain JSON - see Humanize and Detect for every field.

With a key, call the versioned /v1 API - same request body, standard response envelope:

cURL - authenticated /v1
curl -X POST https://api.rewriteai.site/v1/humanize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Text to humanize"}'

Request examples

Humanize

cURL
curl -X POST https://api.rewriteai.site/humanize \
  -H "Content-Type: application/json" \
  -d '{"text":"Your text here","mode":"standard","tone":"professional","language":"english"}'

Detect

cURL
curl -X POST https://api.rewriteai.site/detect \
  -H "Content-Type: application/json" \
  -d '{"text":"Text to analyze"}'

Authentication

Live

Every /v1 request authenticates with a personal API key sent as a bearer token:

HTTP header
Authorization: Bearer YOUR_API_KEY

Which endpoints require a key

  • POST /v1/humanize, POST /v1/detect, GET /v1/usage - key required. A missing, invalid, or revoked key answers 401 UNAUTHORIZED.
  • POST /humanize, POST /detect - no key required (the original endpoints the RewriteAI app itself calls).

A valid key also needs a plan with API access (Pro or Business - see pricing); otherwise the API answers 403 FORBIDDEN with Your plan does not include API access. Create keys from the dashboard -> API -> Create API Key - each key is shown exactly once at creation, see API Keys.

Authenticated requests count against your plan's usage - see Usage. Every response carries a request_id for support.

POST

/humanize

Rewrites submitted text and returns a revised version along with processing metadata.

Parameters

Parameter Type Required Description
text string Required The text to rewrite. Maximum 5000 words.
mode string Optional Writing style: standard, academic, professional, casual, creative. The RewriteAI app sends standard.
tone string Optional Tone: casual, professional, academic, creative, conversational. The RewriteAI app sends professional.
language string Optional Output language: english, spanish, french, german, portuguese, italian, dutch, polish, arabic, hindi. The RewriteAI app sends english.

Request body (JSON)

application/json
{
  "text":     "Your text here",
  "mode":     "standard",
  "tone":     "professional",
  "language": "english"
}

Success response (200 OK)

application/json
{
  "result": "The rewritten text.",
  "model":  "llama-3.1-8b-instruct-fp8",
  "time":   1903
}

time is the processing duration in milliseconds. model is the identifier of the model that handled the request - the value shown is a current example and may change as models are updated.

Versioned endpoint - POST /v1/humanize Key required

Same path body and parameters as above, plus the bearer key. Success answers the standard /v1 envelope:

application/json
{
  "success": true,
  "data": {
    "result": "The rewritten text.",
    "usage":  { "words": 12 },
    "model":  { "id": "llama-3.1-8b-instruct-fp8", "version": "humanizer-v1" },
    "time":   1903
  },
  "request_id": "rw_01M3PM98C5JX1NJY4JBAYBM3C5"
}

usage.words is the canonical word count that was billed to your plan; model.version is the pinned humanizer version - pin against it instead of the model id.

Request examples in cURL, JavaScript, Python, and PHP are in Quick Start.

POST

/detect

Model preview

Analyzes submitted text and returns AI, human, and mixed percentages with an overall verdict. When no detection model is connected, the endpoint reports that with a status code rather than inventing a score.

Parameters

Parameter Type Required Description
text string Required The text to analyze.

Request body (JSON)

application/json
{
  "text": "Text to analyze"
}

Success response (200 OK)

application/json
{
  "ai_percentage":    75,
  "human_percentage": 25,
  "mixed_percentage": 0,
  "verdict":          "AI",
  "time":             2090
}

time is the analysis duration in milliseconds. verdict is the overall label returned by the model (for example "AI" or "Human").

The detection model is in preview. If no model is connected, the request fails with 404 or 501 instead of returning a score - handle those statuses as "analysis unavailable", not as an error in your input.

Versioned endpoint - POST /v1/detect Key required

Same path body and parameters as above, plus the bearer key. Success answers the standard /v1 envelope with the model's real signal - never fabricated metrics:

application/json
{
  "success": true,
  "data": {
    "score": 75,
    "label": "ai_likely",
    "ai_percentage": 75,
    "human_percentage": 25,
    "mixed_percentage": 0,
    "verdict": "AI",
    "word_count": 12,
    "model": { "id": "llama-3.1-8b-instruct-fp8", "version": "detector-v1" },
    "time": 2090
  },
  "request_id": "rw_01M3PM9AM2TZETEFW9YHK5JZ3A"
}

score mirrors ai_percentage and label is its stable machine-readable form - the API never returns confidence or sentence-level values the model did not produce.

Request examples in cURL, JavaScript, Python, and PHP are in Quick Start.

GET

/v1/usage

Key required

Reports your current period's API usage: requests made, API words consumed, and the plan pools they count against. Requires an API key - without one the API answers 401, because usage is per-key attribution. The same numbers appear in the dashboard under API -> Usage.

Success response (200 OK)

application/json
{
  "success": true,
  "data": {
    "plan": "Pro",
    "plan_slug": "pro",
    "subscription_status": "active",
    "api_enabled": true,
    "requests": 42,
    "api":   { "words_used": 180, "words_limit": 100000, "words_remaining": 99820 },
    "words": { "used": 1234, "limit": 500000, "remaining": 498766 },
    "period_start": "2026-09-01T00:00:00+00:00",
    "period_end":   "2026-10-01T00:00:00+00:00"
  },
  "request_id": "rw_01M3PM9AM2TZETEFW9YHK5JZ3A"
}

requests is your key-attributed request count for period_start...period_end. api is the API-word pool that /v1 calls are charged against; words is your plan's overall word pool (app + API). requests may be null if the count could not be read - treat null as unknown, not as zero.

Errors

Failed requests answer with a status code. The original endpoints (/humanize, /detect) return a plain string message; the /v1 endpoints return the standard envelope with a stable error code:

400 - legacy endpoint
{
  "error": "Text too short"
}
401 - /v1 endpoint
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "A valid API key is required."
  },
  "request_id": "rw_01M3PM9AM2TZETEFW9YHK5JZ3A"
}
Status Meaning
400 Missing, invalid, or too-short input.
401 Missing, invalid, or revoked API key on a /v1 request (UNAUTHORIZED).
402 Usage limit reached for the current period (USAGE_LIMIT_REACHED).
403 Your plan does not include API access (FORBIDDEN).
404 / 501 Unknown endpoint, or the model is not available yet.
429 Rate limited (RATE_LIMITED) - retry after Retry-After seconds, see Rate Limits.
500 Server error - retry with backoff.

Unknown paths return a 404 - {"error": "Not found."} on the original endpoints, the envelope with NOT_FOUND on /v1. Treat any response without the documented fields as a failure; include request_id when contacting support.

Rate Limits

Live

The API allows 60 requests per minute per endpoint - counted per API key on /v1 requests and per client IP on the anonymous /humanize and /detect endpoints. That is a single safe baseline for every plan; plan-specific quotas are not in effect yet.

Requests over the limit return 429 with a Retry-After header telling you how many seconds remain in the window - wait that long, then retry with backoff. /v1 responses use the standard error envelope with error.code = "RATE_LIMITED"; the legacy endpoints return a plain {"error": "..."} string.

Build with polite defaults: retry with backoff on 429 and 500, and reuse responses instead of re-sending identical text.

API Keys

Live

Keys are created from the dashboard's API section. Each key is shown once at creation - copy it immediately; afterwards only a masked prefix (rw_live_xxxx...) is ever displayed. The server stores only a SHA-256 hash of the key, so a lost key cannot be recovered: revoke it and create a replacement.

  1. Open the dashboard -> API -> API Keys.
  2. Enter a name for the key (for example Production app) and choose Create API Key.
  3. Copy the full key from the dialog - it will not be shown again.
  4. Send it as Authorization: Bearer YOUR_API_KEY on every /v1 request.
  5. Revoke keys you no longer use - revocation takes effect immediately.

Up to 5 active keys per account. Each key's row shows its masked prefix, created date, last used date, and status. Never embed a raw key in client-side code or commit it to source control.

Questions about early API access? Contact us - or start from the quick start.

FAQ

API questions, answered plainly

Is the API live?

Yes. The POST /humanize and POST /detect endpoints respond without a key, and the versioned /v1 endpoints (POST /v1/humanize, POST /v1/detect, GET /v1/usage) work with an API key. Rate limits are enforced at 60 requests per minute; paid plans are live, but API usage billing is not enforced yet. This documentation lists exactly what each endpoint accepts and returns.

Do I need an API key?

For the /v1 endpoints, yes - send Authorization: Bearer YOUR_API_KEY on every /v1 request. Keys are created from the dashboard's API section and shown once at creation. The original /humanize and /detect endpoints need no key.

What are the limits?

API access is available on the Pro and Business plans, and each /v1 request counts against the plan's monthly API-word allowance - an exhausted allowance answers 402. Rate limits allow 60 requests per minute per endpoint and answer 429 with a Retry-After header. API access is listed on the pricing page.