संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस दस्तावेज़ में, Maps Embed API का इस्तेमाल करने की ज़रूरी शर्तों के बारे में बताया गया है. साथ ही, इसे चालू करने और पुष्टि किया गया अनुरोध करने का तरीका बताया गया है.
checklist
पक्का करें कि आपने ज़रूरी शर्तें पूरी की हों.
settings
अपने Google Cloud प्रोजेक्ट में एपीआई चालू करें.
verified_user
एपीआई पासकोड कॉन्फ़िगर करें, ताकि पुष्टि किया गया एपीआई अनुरोध किया जा सके.
[null,null,["आखिरी बार 2025-08-16 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eGoogle Maps Platform secures its products by requiring API keys for authentication and billing purposes.\u003c/p\u003e\n"],["\u003cp\u003eAPI keys can be created and managed through the Google Cloud Console or the Cloud SDK.\u003c/p\u003e\n"],["\u003cp\u003eRestricting API keys to specific websites and APIs enhances security by limiting unauthorized usage.\u003c/p\u003e\n"],["\u003cp\u003eAll Maps Embed API requests must include your API key as a parameter for authentication.\u003c/p\u003e\n"]]],["API keys are crucial for securing Google Maps Platform products, linking API calls to your billing account. To create one, go to the Google Maps Platform Credentials page and select \"Create credentials\" then \"API key.\" Restrict your key via the Credentials page, selecting \"HTTP referrers\" for application restrictions and choosing specific APIs under \"API restrictions,\" like Maps Embed API. You can also create and manage API keys via the Cloud SDK. Every Maps Embed API request must include the generated key for authentication.\n"],null,["Google Maps Platform products are secured from unauthorized use by restricting API calls\nto those that provide proper authentication credentials. These credentials are in the form of\nan API key - a unique alphanumeric string that associates your Google billing account with your\nproject, and with the specific API or SDK.\n\nThis guide shows how to create, restrict, and use your API Key for Google Maps Platform.\n\nBefore you begin\n\nBefore you start using the Maps Embed API, you need a project with a billing account and the\nMaps Embed API enabled. To learn more, see [Set up in Cloud console](/maps/documentation/embed/cloud-setup).\n\nCreate API keys\n\nThe API key is a unique identifier that authenticates requests associated with your project for\nusage and billing purposes. You must have at least one API key associated with your project.\n\nTo create an API key:\n\nConsole \n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_CreateAPIKey&utm_content=Docs_maps-embed-backend)\n2. On the **Credentials** page, click **Create credentials \\\u003e API key** . \n The **API key created** dialog displays your newly created API key.\n3. Click **Close.** \n The new API key is listed on the **Credentials** page under **API keys** . \n (Remember to [restrict the API](/maps/api-security-best-practices#restricting-api-keys) key before using it in production.)\n\nCloud SDK \n\n```bash\ngcloud services api-keys create \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n --display-name \"\u003cvar translate=\"no\"\u003eDISPLAY_NAME\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys create`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/create)\n\nRestrict API keys\n\nGoogle strongly recommends that you restrict your API keys by limiting their usage to those only\nAPIs needed for your application. Restricting API keys adds security to your application by\nprotecting it from unwarranted requests. **You are financially responsible for charges caused by abuse of unrestricted API keys.** For more information, see\n[API security best practices](/maps/api-security-best-practices#restrict_apikey).\n\n| When restricting an API key in the Cloud console, **Application restrictions** override any APIs enabled under **API restrictions**. Follow best practices by creating a separate API key for each app, and for each platform on which that app is available.\n\nTo restrict an API key:\n\nConsole\n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_RestrictAPIKey&utm_content=Docs_maps-embed-backend)\n2. Select the API key that you want to set a restriction on. The API key property page appears.\n3. Under **Key restrictions**, set the following restrictions:\n - Application restrictions:\n 1. To accept requests from the list of websites that you supply, select **HTTP\n referers (web sites)** from the list of **Application\n restrictions**.\n 2. Specify one or more referrer websites. You can use wildcard characters to authorize all subdomains (for example, `https://*.google.com` accepts all sites ending in `.google.com` when accessed over HTTPS). Note that if you specify www.domain.com, it acts as a wildcard www.domain.com/\\*, and authorizes any subpath on that hostname. Only the `https://` and `http://` referrer schemes are supported.\n - API restrictions:\n 1. Click **Restrict key**.\n 2. Select **Maps Embed API** from **Select APIs** dropdown. If the Maps Embed API is not listed, you need to [enable](/maps/documentation/embed/cloud-setup#enabling-apis) it.\n 3. If your project uses Places Library, also select **Places API** . Similarly, if your project uses other services in the JavaScript API ([Directions Service](/maps/documentation/javascript/directions), [Distance Matrix Service](/maps/documentation/javascript/distancematrix), [Elevation Service](/maps/documentation/javascript/elevation), and/or [Geocoding Service](/maps/documentation/javascript/geocoding)), you must also enable and select the corresponding API in this list.\n4. To finalize your changes, click **Save** . \n\nCloud SDK\n\n\nList existing keys. \n\n```bash\ngcloud services api-keys list --project=\"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\n\nClear existing restrictions on existing key. \n\n```bash\ngcloud services api-keys update \"projects/\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e/keys/\u003cvar translate=\"no\"\u003eKEY_ID\u003c/var\u003e\" \\\n --clear-restrictions\n```\n\n\nSet new restrictions on existing key. \n\n```bash\ngcloud services api-keys update projects/PROJECT/locations/global/keys/KEY_ID \\\n --api-target=service=maps-embed-backend.googleapis.com\n --allowed-referrers=\"\u003cvar translate=\"no\"\u003ereferer\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys update`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/update)\n- [`gcloud services api-keys lookup`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/lookup)\n- [`gcloud services api-keys list`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list)\n\nAdd the API key to your request\n\n\nYou must include an API key with every Maps Embed API request.\nIn the following example, replace `YOUR_API_KEY` with your\nAPI key. \n\n```scdoc\n https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY¶meters\n```"]]