Skip to main content
Use the Crypto Tax P&L API to calculate a workbook for a financial year. This recipe submits an asynchronous job and follows it through upload, polling, and download.

Before you start

  • Get an API key and an access token from Authenticate.
  • Prepare a crypto tradebook as crypto_tradebook.json. The sample tradebook uses FY 2025-26.
  • Set API_KEY and ACCESS_TOKEN in your shell. The authorization header takes the token without a Bearer prefix.
The examples use FY 2025-26 and JSON output. Set financial_year to the year you want to calculate; FY 2026-27 uses the Income-tax Act, 2025 calculation.

Submit, upload, poll, and download

1

Submit a job

Call Submit Job. Send the calculation parameters in the query string and leave the body empty.
Save data.job_id as JOB_ID and data.url as UPLOAD_URL. The URL is for the input upload.
2

Upload the tradebook

Upload the JSON workbook to the complete signed URL. The upload starts processing.
3

Poll the job

Call Poll Job with the saved job identifier.
Continue polling while the status is queued or in_progress. A created job is waiting for its upload. Stop on failed and inspect data.message if present. When the status is succeeded, save data.url as DOWNLOAD_URL.
4

Download the result

Download the output workbook with the URL from the successful poll response.
Read the Tax P&L output reference for the summary, spot, receipts, and futures tables.

Calculate synchronously

The sync endpoint accepts the workbook directly and returns the JSON calculation in data.
For Excel output, use x-accept-type: application/xlsx. A synchronous response returns the download URL in data; an asynchronous job returns its download URL in data.url after it succeeds. For FY 2026-27, use the asynchronous workflow for Excel. The synchronous Excel download link is currently unusable. Synchronous JSON is unaffected by this download issue.