@Rajoli Hari Krishna Thanks for reaching out. From the description i understand that you would need to fetch the gateway details for each api in an APIM service.
i don't see any option to get the gateway details associated with each api. Apis - List By Service - REST API (Azure API Management) | Microsoft Learn
this rest api lists all the api details for the particular APIM instance, but for each api below are the only properties returned
the only way is to use the gateway id, first you need to fetch the gateway id's for each apim instance and with each gateway id you can see the list of api's associated.
$apimContext = New-AzApiManagementContext -ResourceGroupName "XXXX" -ServiceName "XXX"
Get-AzApiManagementGateway -Context $apimContext
this powershell command will return all the self-hosted gateways available for particular APIM instance.
with that you can use this rest api https://learn.microsoft.com/en-us/rest/api/apimanagement/gateway-api/list-by-service?view=rest-apimanagement-2022-08-01&tabs=HTTP#code-try-0 to see the list of api's associated to that particular gateway using gateway id.
do let me know incase of further queries, I would be happy to assist you.