Before you can use Routes Preferred API methods in your code, you must enable them.
To enable Routes Preferred API methods with your project:
Log in to Cloud console and select the project selection tab:
In the Select from window, select New Project.
Specify a name and location for the project, and then select Create.
Contact your Google representative.
If you don't already have the Routes Preferred API enabled for your project, navigate to the APIs & Services Library in Google Cloud console. You can skip this step if Routes Preferred is already enabled.
Then search for Routes Preferred to open the Routes Preferred API.
To enable the API, select Enable.
If you don't already have an API key associated with your project, navigate to the Credentials tab. You can skip this step if you already have an API key.
Select Create Credentials, and then API Key.