How to get Fork Transaction trace via API
Forks will be deprecated on March 31, 2025.
Please migrate to Tenderly Virtual TestNets or contact our support for assistance with automatic migration.
New projects on Tenderly should use Virtual TestNets.
New projects on Tenderly should use Virtual TestNets.
To get the transaction trace of a fork transaction, use the following REST API endpoint:
https://api.tenderly.co/api/v1/account/{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:
example.js
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 = `https://api.tenderly.co/api/v1/account/${username}/project/${projectSlug}/fork/${forkId}/transaction/${transactionId}`;
const resp = await axios.get(forkTxAPI, {
headers: {
"X-Access-Key": accessKey
}
});
console.log(resp.data);
}
main().catch(console.error);