CR
Docs

Quick Start

Generate your first receipt in under 5 minutes.

0. Get Supported Chains

Discover which blockchain networks are currently supported by the platform.

terminal
curl https://api.txproof.xyz/api/v1/chains

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',
'X-API-Key': 'sk_live_...' // Optional for public, required for higher limits
},
body: JSON.stringify({
txHash: '0x51c68f2c3d5e2d6b3a3c754630a969f6e4a2c070', // Example Base Tx
chainId: 8453
})
});
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.state === 'completed') {
console.log("PDF Ready:", data.pdfUrl);
// data.data is now a URL to the JSON file
console.log("Bill Data URL:", data.data);
// Fetch if needed:
// const billJson = await (await fetch(data.data)).json();
} else if (data.state === 'failed') {
console.error("Job Failed:", data.error);
} else {
// Retry after 2s
console.log("Status:", data.state, "Queue Pos:", data.queuePosition);
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.