API reference
Rewrite (async)
Draft
POST https://paperpurr.com/v1/rewrite
Queue text for rewriting and get a job_id right away. Collect the result with Job status or a webhook.
Headers
Authorizationstring · requiredBearerfollowed by your keyIdempotency-Keystring- 1–255 characters. Retrying with the same value won’t create a duplicate job or charge you twice.
Body parameters
textstring · required- The text to rewrite. The per-request limit is announced at launch
variantsinteger · default 1- 1–4. How many drafts to return
webhook_urlstring- A public
https://URL to notify when the job ends
Examples
curl
curl -X POST "https://paperpurr.com/v1/rewrite" \
-H "Authorization: Bearer $PAPERPURR_API_KEY" \
-H "Idempotency-Key: 5f1c9a7e-2d4b-4e8a-9c31-7b0e6f2a1d55" \
-H "Content-Type: application/json" \
-d '{"text":"Thoreau moved to the woods because he wished to live deliberately.","variants":2,"webhook_url":"https://example.com/hooks/paperpurr"}'Python
import os
import requests
r = requests.post(
"https://paperpurr.com/v1/rewrite",
headers={
"Authorization": f"Bearer {os.environ['PAPERPURR_API_KEY']}",
"Idempotency-Key": "5f1c9a7e-2d4b-4e8a-9c31-7b0e6f2a1d55",
},
json={
"text": "Thoreau moved to the woods because he wished to live deliberately.",
"variants": 2,
"webhook_url": "https://example.com/hooks/paperpurr"
},
)
print(r.json())JS
const r = await fetch("https://paperpurr.com/v1/rewrite", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PAPERPURR_API_KEY}`,
"Idempotency-Key": "5f1c9a7e-2d4b-4e8a-9c31-7b0e6f2a1d55",
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "Thoreau moved to the woods because he wished to live deliberately.",
"variants": 2,
"webhook_url": "https://example.com/hooks/paperpurr"
}),
});
console.log(await r.json());Response
202
{
"job_id": "job_7Qm2xK",
"status": "queued",
"status_url": "/v1/jobs/job_7Qm2xK",
"request_id": "req_51d0c8aa3e9f4b2c7d16a0e8"
}503
{
"error": {
"type": "unavailable",
"code": "coming_soon",
"message": "开发者 API 即将发布",
"param": null,
"request_id": "req_d41a8c3e7f2b09a6e5c1d8f3"
}
}job_idstring · required- Job ID
statusstring · requiredqueuedright after you submitstatus_urlstring · required- Path for checking status
request_idstring · required- Request ID
Why it’s asynchronous
Rewriting runs on GPUs that cold-start when idle, so a job can queue for a few minutes. You get a job_id right away instead of holding the request open. Set webhook_url if you’d rather not poll.
Possible errors
| Status | code | Cause | What to do |
|---|---|---|---|
400 | missing_parameter | A required parameter is missing. param names it. | Add the parameter. |
400 | invalid_parameter | A parameter has the wrong type or value. param names it. | Fix it to match the type and range in the reference. |
402 | insufficient_balance | This month’s trial allowance doesn’t cover the units this request needs. | Check /v1/usage, send fewer items or wait for next month’s reset. Word packs go on sale at launch. |
409 | idempotency_conflict | The same Idempotency-Key was sent with a different body. | Use a new key for each new job. |
413 | text_too_long | The text is over the per-request limit. | Split the text into parts. |
422 | unprocessable_content | The content can’t be processed. | Check that text isn’t blank or garbled. |
429 | rate_limit_exceeded | A rate limit was hit (per IP, per key or per account). message says which. | Wait the number of seconds in Retry-After, then retry. Queue requests if several processes share one key. |
503 | coming_soon | The API isn’t open yet. Every /v1 and /mcp call returns this for now. | Join the waitlist. We’ll announce the launch on Discord. |
Metering
- Charged per input word: each Chinese character counts as one word, everything else by words. The actual charge is
usage.charged_wordsin the job result. - Concurrent jobs are limited by tier. See Rate limits and metering.