You can use NCBI Datasets. If you're looking for genome accessions, you can use the following command (I'm using human, 9606 as an example of taxid)
datasets summary genome taxon 9606 --assmaccs
datasets will return a list of accessions in JSON format. If you want more information than that, you can remove the assmaccs and you would have the complete JSON with info about each assembly. You can then parse the information using jq, for example.
Let me know if you have any questions or if you are looking for something else.