Get started
Stay organized with collections
Save and categorize content based on your preferences.
Google APIs are consumed from Google Cloud projects. This guide walks through
the process of creating a Google Cloud Project, enabling the OR API in such a
project, and obtaining an API key to call the API endpoints.
Create a Google Cloud project
Using a Google hosted account,
create
a project in the Google Cloud console. If the solver you intend to use is
under a trusted tester program, follow this
guide first.
Enable the API
Get an API key
Navigate to the
credentials
menu.
Click "+ CREATE CREDENTIALS"
Select API key
Save the API key in a credentials.json
file with the following body
{
"key": "your_api_key"
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eGoogle Cloud projects are necessary to utilize Google APIs, and this guide outlines the setup process for accessing the Optimization Routing API (OR API).\u003c/p\u003e\n"],["\u003cp\u003eThe process involves three main steps: creating a Google Cloud project, enabling the OR API within the project, and generating an API key for authentication.\u003c/p\u003e\n"],["\u003cp\u003eBefore proceeding, ensure you have a Google account, and if utilizing a solver under a trusted tester program, refer to the provided guide for specific instructions.\u003c/p\u003e\n"],["\u003cp\u003eOnce enabled, you'll need to obtain an API key through the Google Cloud console and securely store it in a 'credentials.json' file for API access.\u003c/p\u003e\n"]]],["The process involves three core steps: creating a Google Cloud project, enabling the OR API within that project, and obtaining an API key. First, create a project via the Google Cloud console. Second, enable the OR API by navigating to the APIs library and clicking \"Enable.\" Finally, generate an API key through the credentials menu, saving it to a `credentials.json` file with the specified format. This API key is needed to call the API endpoints.\n"],null,["Google APIs are consumed from Google Cloud projects. This guide walks through\nthe process of creating a Google Cloud Project, enabling the OR API in such a\nproject, and obtaining an API key to call the API endpoints.\n\n1. Create a Google Cloud project\n\n Using a Google hosted account,\n [create](https://console.cloud.google.com/projectcreate)\n a project in the Google Cloud console. If the solver you intend to use is\n under a trusted tester program, follow this\n [guide](/optimization/service/trusted_testers) first.\n2. Enable the API\n\n - Navigate to the [APIs\n library](https://console.cloud.google.com/apis/library/optimization.googleapis.com).\n\n - Click \"Enable\".\n\n3. Get an API key\n\n - Navigate to the\n [credentials](https://console.cloud.google.com/apis/credentials)\n menu.\n\n - Click \"+ CREATE CREDENTIALS\"\n\n - Select API key\n\n - Save the API key in a `credentials.json` file with the following body\n\n {\n \"key\": \"your_api_key\"\n }"]]