Claves de API
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En este documento, se describen las claves de API, cuándo usarlas, cómo adquirirlas y cómo usarlas con la biblioteca cliente de las API de Google para .NET.
Introducción
Cuando llamas a una API que no accede a datos privados del usuario, puedes usar una clave de API simple.
Esta clave se usa para autenticar tu aplicación con fines contables.
Obtén más información sobre las claves de API en la documentación de la consola.
Nota: Si necesitas acceder a datos privados del usuario, debes usar OAuth 2.0.
Cómo usar claves de API
Para usar una clave de API, pásala a la propiedad BaseClientService.Initializer APIKey
. En el ejemplo de API simple de la página de introducción, se proporciona un ejemplo completo que usa claves de API.
Cuando configuras la propiedad APIKey
, te aseguras de que todas las llamadas que realices al servicio incluyan la clave de API.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-08-31 (UTC)
[null,null,["Última actualización: 2025-08-31 (UTC)"],[[["\u003cp\u003eAPI keys are used for authenticating applications when accessing public data, not private user data.\u003c/p\u003e\n"],["\u003cp\u003eYou can create and manage API keys through the Credentials page in the Google API Console.\u003c/p\u003e\n"],["\u003cp\u003eTo use an API key with the Google API Client Library for .NET, set the \u003ccode\u003eAPIKey\u003c/code\u003e property within the \u003ccode\u003eBaseClientService.Initializer\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSecurely store and manage your API keys by adhering to Google's best practices.\u003c/p\u003e\n"]]],[],null,["This document describes API Keys, when to use them, how to acquire them,\nand how to use them with the Google API Client Library for .NET.\n\nIntroduction\n\n\nWhen calling an API that does not access private user data,\nyou can use a simple API key.\nThis key is used to authenticate your application for accounting purposes.\nYou can read more on [API keys](/console/help/using-keys) in the Console documentation.\n\n\n**Note** :\nIf you *do* need to access private user data, you must use\n[OAuth 2.0](/api-client-library/dotnet/guide/aaa_oauth).\n\nAcquiring API keys\n\n1. Open the [Credentials page](https://console.cloud.google.com/apis/credentials) in the API Console.\n2. Click **Create credentials \\\u003e API key** and select the appropriate key type.\n\nTo keep your API keys secure, follow the [best practices for\nsecurely using API keys](//cloud.google.com/docs/authentication/api-keys).\n\nUsing API keys\n\n\nTo use an API key, pass it to the\n[BaseClientService.Initializer `APIKey`](https://googleapis.dev/dotnet/Google.Apis/latest/api/Google.Apis.Services.BaseClientService.Initializer.html)\nproperty. The\n[Simple API Example](/api-client-library/dotnet/get_started#simple)\non the Get Started page provides a complete example that uses API keys.\n\n\nBy setting the `APIKey` property, you ensure that every call you make\nto the service will include the API key."]]