Read or access CircleCI API POST request body or headers

Is it possible to somehow access the body of a POST request that triggered CircleCI build?

I would like to create the functionality to restart a failed Pull Request build by creating a comment in the PR section e.g. “/rerun” but I am not sure how to achieve this.

I don’t know, but you could always make a new call to GitHub/Bitbucket using their APIs to do what you want. You’d have to ensure that Circle and the VCS host do not enter an infinite build loop though.

You could probably scrape the data out of the web hooks page payload details on GitHub. The only way to re-trigger a job is via either a new commit, or requesting one via UI or API. There is no way to resend, or send a new web hook manually.

I used Github actions which allow me to see the body of the trigger and send the needed data to the CircleCI as a environment variables.