CR
Docs

Quick Start

Generate your first receipt in under 5 minutes.

1. Start a Job

Submit the transaction hash and chain ID you want to generate a receipt for.

client.js
// 1. Submit Receipt Request
const res = await fetch('https://api.txproof.xyz/api/v1/bills/resolve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
txHash: '0x123...', // Replace with actual Tx Hash
chainId: 1 // 1 = Mainnet, 137 = Polygon, etc.
})
});
const { jobId } = await res.json();
console.log("Job Started:", jobId);
// 2. Poll for Status
const poll = async (id) => {
const statusRes = await fetch(`https://api.txproof.xyz/api/v1/bills/job/${id}`);
const data = await statusRes.json();
if (data.status === 'completed') {
console.log("PDF Ready:", data.data.pdfUrl);
console.log("Metadata:", data.data.bill);
} else if (data.status === 'failed') {
console.error("Job Failed:", data.error);
} else {
// Retry after 2s
console.log("Status:", data.status);
setTimeout(() => poll(id), 2000);
}
};
poll(jobId);

2. Understand Responses

The API will return a job status. You should handle all states:

pendingJob accepted, waiting in queue.
processingWorker is fetching data and generating PDF.
completedSuccess! Response contains `pdfUrl` and `metadata`.
failedError triggered. Check `error` field in response.