Using api.count function to minimize API key usage