Installation
The package is published under the
@parsetx scope rather than the bare name parsetx. The npm registry’s similarity-detection rules block parsetx as too close to the existing parse5 package, so the official home is @parsetx/sdk. TypeScript type definitions are bundled directly — no separate @types/ install is needed.CDN / No-install Alternative
If you’re working in an environment where you can’t use npm — a browser project, a Cloudflare Worker, or a Deno script — you can import the standalone ES module directly from the jsDelivr CDN:The CDN build is the same source file published to npm. It exports the identical
ParseTxClient class, so all examples on this page apply without any changes.Initialization
Pass your API key to the constructor. Every subsequent call from that client instance automatically sends the key in theX-API-Key header — you never need to include it yourself.
Synchronous Enrichment
Useclient.enrich() when you need results immediately. It sends up to 10 transactions to POST /v1/enrich and resolves with the fully enriched payload.
response.results maps 1-to-1 to your input array by position. Check result.status before reading enrichment fields — possible values are "complete", "rejected" (high-entropy or unrecognizable input), and "retry" (transient processing fault).
Max batch size
Up to 10 items per synchronous call. Passing more than 10 throws immediately on the client before any network request is made.
Response time
Cached merchants typically resolve in under 50 ms. Novel merchants route through the LLM pipeline and may take slightly longer.
Asynchronous Batch Enrichment
For batches larger than 10 items, useclient.enrichAsync(). It submits up to 500 transactions to the background queue and returns a job_id string immediately — no waiting for results.
Each async batch is capped at 500 items. If you need to process more than 500 items, split your list into chunks of ≤ 500 and submit each as a separate job.
Polling for Async Results
Once you have ajob_id, pass it to client.pollJob(). The method checks the job status in a loop and resolves only when the status transitions to "complete" or "failed". It uses built-in exponential backoff — starting at a 2-second interval, multiplying by 1.5 on each pass, and capping at 10-second intervals — so you don’t need to implement any waiting logic yourself.
Polling options
pollJob accepts an optional second argument to tune the backoff behaviour:
| Option | Type | Default | Description |
|---|---|---|---|
intervalMs | number | 2000 | Initial delay between poll attempts, in milliseconds. |
maxWaitMs | number | 120000 | Maximum total wait time before the call throws a timeout error (2 minutes). |
Complete Async Workflow
Method Reference
new ParseTxClient(apiKey)
Creates a new client instance.
apiKey (string, required) is your pt_live_... key. An optional second argument baseUrl overrides the default https://api.parsetx.com.client.enrich(transactions[])
Synchronously enriches an array of up to 10 raw transaction strings. Returns
Promise<EnrichResponse> containing a results array, a job_id of null, and a status string.client.enrichAsync(transactions[])
Submits an array of up to 500 raw transaction strings for background processing. Returns
Promise<string> — the job_id you use to retrieve results.client.pollJob(jobId, options?)
Polls
GET /v1/enrich/jobs/:id with exponential backoff until the job reaches "complete" or "failed". Returns Promise<EnrichResponse>.