One of the benefits of a Roth IRA is that contributions can always be distributed out of the Roth IRA with no tax, and no early distribution penalty for those that are under age 59½. But, you have to be able to prove to IRS that you are taking a distribution of contributions only. Under the distribution ordering rules, all Roth IRAs are treated as one Roth account, contributions are deemed to be the first amount distributed, then conversions – first in, first out – and lastly earnings are distributed.
Example: Josh, age 45, has made Roth contributions totaling $30,000; he has done 3 Roth conversions of $10,000 each and has total earnings of $20,000 in his Roth IRAs. He wants to take a distribution of $25,000 from one of his Roth IRA accounts. The $25,000 will come from his total contributions of $30,000. It would be a tax-free and penalty-free distribution.
The Roth IRA custodian will issue Josh a 1099-R for the $25,000 distribution, will mark the box for taxable amount unknown, and code the distribution as an early distribution. Josh will have to file Form 8606 with his tax return to tell IRS that his distribution is not taxable. Since this is Josh’s first Roth distribution, he will need to know the total amount of his contributions. Where will Josh get this information? 
Tax software will generally track Roth contributions, even though they do not show up anywhere on the tax return. The IRA custodian issues a Form 5498 each year that will show the amount of contributions made for the year. Roth IRA statements will show contributions received for the year. Josh could have kept his own list of contributions he made for each year. He could have kept copies of cancelled checks used for the contributions or printouts of electronic transactions to make the contributions.
This is all a lot of paper for Josh to track. But, it is Josh’s responsibility to do this tracking. It is not up to the Roth IRA custodian to do it. Josh could have more than one account or he could move his account from one custodian to another, making it virtually impossible for his Roth IRA custodian to keep track of his contributions. It is also not up to IRS to track Josh’s contributions, although, in theory, they could since they get copies of the Form 5498 showing his contributions. It is Josh’s responsibility to track his contributions. If IRS questions him, he needs to be able to prove up the amount he claims he has contributed.
If he cannot prove up the amount of his contributions, he could owe income tax and the 10% early distribution penalty on part of his distribution if any of the distribution is deemed by IRS to be from earnings in his Roth IRA.
https://www.irahelp.com/slottreport/tracking-roth-contributions-those-under-age-59%C2%BD