See this post Bulk Download Assistance for Crystal struct + properties Using OPTIMADE API(AFLOW Data as showcase)
these docs for the client Using the OPTIMADE client - OPTIMADE Python tools
and the tutorials at GitHub - Materials-Consortia/optimade-tutorial-exercises: Tutorial exercises for the OPTIMADE API