I need to build an api that can get the brand name of a generic drug, some generics have several hundred records, using pagination to go through this and parsing the data is not practical for my needs, is there a way to directly get the brand name of a generic using openFDA API
I don't think there is a currently available openFDA API that you can directly query and be guaranteed to get back - in a single record - a list of all possible brand names.
In some cases, you may get only one matching record for your query. For example, the following query against the openFDA drug product label endpoint returns a single matching record: https://api.fda.gov/drug/label.json?search=openfda.generic_name:%22ATORVASTATIN%20CALCIUM%20TRIHYDRATE%22&limit=100
But for other generics, to find all the brand names, you will have to parse through multiple records in the response if you are using one of the current openFDA APIs.