Note - the federal AO Tax Credit can only be used for tuition, mandatory fees, books and required supplies, but not room and board or travel. I mention that because a person above asked about what happens when they don’t pay any tuition out of pocket. Money that is paid towards tuition using loans can be used for the tax credit.
https://www.irs.gov/uac/American-Opportunity-Tax-Credit:-Questions-and-Answers
(The 1098s are confusing for some people because they do not include all legitimate higher education expenses that can be used for 529 accounts. For instance, money paid to a college for room and board is not typically listed, which are legitimate 529 account expenses.)