All Products

How to Get Fork Transaction Trace via API

How to get Fork Transaction trace via API

To get the transaction trace of a fork transaction, use the following REST API endpoint:{username}/project/{project_slug}/fork/{fork_id}/transaction/{transcation_id}

The call have the X-Access-Key header set to Tenderly Access Token.

Code Sample:

async function main() {
  const accessKey = process.env.TENDERLY_ACCESS_KEY;
  const username = process.env.TENDERLY_USERNAME;
  const projectSlug = process.env.TENDERLY_PROJECT_SLUG;
  // copy from the fork RPC
  const forkId = "397aa059-ac2c-4e11-a3fa-4f4f818d6855";
  // available in the RPC response
  const transactionId = "0745cb5a-fbb0-47db-b039-5ed96f8787c8";
  const forkTxAPI = `${username}/project/${projectSlug}/fork/${forkId}/transaction/${transactionId}`;
  const resp = await axios.get(forkTxAPI, {
      headers: {
          "X-Access-Key": accessKey