API Documentation
SwapTxt REST API Reference
Complete developer reference for SwapTxt /v1/ocr, /v1/edits, /v1/account, rate limits, idempotency keys, and HMAC-SHA256 webhook verification.
Authentication & Rate Limits
Pass your key in the Authorization: Bearer <API_KEY> header. Per-account limits are 30 POST submissions/minute, 240 GET reads/minute, 10 concurrent running jobs, and 30 queued jobs.
Core Endpoints
POST /v1/ocr— Extracts text lines and integer[x, y, w, h]boxes on a 0–1000 scale. Same image within 24 hours returnscharged_ocr: 0.POST /v1/edits— Acceptsimage_id,image_url,image_base64, or multipartimageplus 1–20 replacements. Omitboxfor automatic OCR matching (match: all | first); unmatched text returns422 text_not_foundwithout charging.GET /v1/edits/{id}— Returnsqueued(withqueue_positionandestimated_seconds),processing,succeeded(Results A, B, C), orfailed(auto-refunded).GET /v1/account— Returns remaining edit/OCR balances, active packs, and account limits.
Signed Webhooks
Pass an HTTPS callback_url on POST /v1/edits. When the job finishes, SwapTxt posts the final edit JSON signed with X-SwapTxt-Signature: sha256=<hmac> and retries failed deliveries after 1, 5, and 30 minutes.