Skip to main content
Compress text with a preset or a custom operation chain. Every request returns a job, always the same shape. Small inline inputs are processed inline and the job comes back already completed (HTTP 200, result included); everything else is queued (HTTP 202) and finishes asynchronously. Fast-path eligibility: inline text of at most 50 KB (UTF-8) with no webhookUrl. Everything else is queued.

Request

Authorization
string
required
Bearer sk_live_...
Idempotency-Key
string
Optional, 1–255 characters. Returns the existing job if a job with this key was already created. Applies to queued jobs only; fast-path jobs complete inline and are not deduplicated.
text
string
Inline text to process, up to 5,000,000 characters. Provide exactly one of text or fileId.
fileId
string
Id of an upload, .pdf or .txt only.
preset
string
One of chill, medium, aggressive. Either preset or operations is required.
operations
array
1–10 custom operations, applied in order. See below.
webhookUrl
string
URL to receive job.completed / job.failed events for this job. Forces the queued path. Requires a plan with webhooks.

Presets

Operations

GET /v1/text/presets and GET /v1/text/operations return these definitions as JSON.

Examples

Fast path (inline text)
Queued (uploaded PDF)

Results

One code path handles both: check status. If it’s completed, the result is already in the response. Otherwise poll GET /v1/jobs/:id (ideally with ?wait=25 to long-poll) or wait for the webhook. Jobs created from inline text return result.outputText; jobs created from a fileId return result.outputUrl pointing to a .txt file. PDFs have their text extracted before processing.

Credits

1 credit per started 100 KB of input, reserved up front and refunded if the job ultimately fails. See Credits.