Cuando creas apps para desarrolladores y las asocias con productos de API, Apigee genera de manera automática las claves de consumidor y secretos de consumidor. (Esos procedimientos se abordan en Controla el acceso a tus API mediante el registro de aplicaciones). Sin embargo, es posible que tengas claves y secretos de consumidor existentes que deseas importar a Apigee desde otro sistema. Técnicamente, este proceso no es una importación. Vuelve a crear las claves existentes en Apigee de a una.
Para obtener una descripción de los campos que puedes proporcionar en el cuerpo de la solicitud, consulta Recurso: DeveloperAppKey.
Asocia la clave o secreto del consumidor con uno o más productos de la API de Apigee Esto permite usar la clave de consumidor importada (también llamada clave de API) en las llamadas a los proxies de API en la que los productos controlan la autorización.
Consulta la
API de ReplaceDeveloperAppKey. Este es el curl:
De forma opcional, borra el secreto/clave de consumidor inicial del que Apigee generó automáticamente. Sin embargo, puedes conservar la clave generada automáticamente. Tanto la clave importada como la clave generada de forma automática funcionan en las llamadas a la API, y ambas se muestran en la página de Detalles de la app para desarrolladores en la IU de Apigee.
Consulta la
clave de API delete para la API de app de desarrollador.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-03 (UTC)"],[[["\u003cp\u003eThis guide applies to both Apigee and Apigee hybrid platforms, focusing on managing consumer keys and secrets.\u003c/p\u003e\n"],["\u003cp\u003eWhile Apigee automatically creates consumer keys and secrets, users can recreate existing ones from external systems, up to the 2KB size limit for both keys and secrets.\u003c/p\u003e\n"],["\u003cp\u003eConsumer keys and secrets can be created using the Apigee API and should be associated with one or more API products to authorize API proxy calls.\u003c/p\u003e\n"],["\u003cp\u003eYou have the option to delete the initially auto-generated keys, but you can also retain them alongside your imported keys.\u003c/p\u003e\n"]]],[],null,["# Import existing consumer keys and secrets\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nApigee automatically generates consumer keys and consumer secrets when you create\ndeveloper apps and associate them with API products. (Those procedures are covered in\n[Controlling access to your APIs by registering apps](/apigee/docs/api-platform/publish/creating-apps-surface-your-api).) However, you may have existing\nconsumer keys and secrets that you want to import into\nApigee from another system. Technically, this process isn't an import. It's recreating the\nexisting keys in Apigee one at a time.\n| **Caution:** Be aware of the following size limits on API keys. By staying within these limits, you help avoid service disruptions.\n\n| **Note:** Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed.\n\n1. **Create the consumer keys and secrets** using the Apigee API. \n See the [`create` a consumer key and secret API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys/create). Here's the curl: \n\n ```\n curl https://apigee.googleapis.com/v1/organizations/{org}/developers/{developer_email}/apps/{app_name}/keys \\\n -X POST \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H 'Content-type:application/json' \\\n -d \\\n '{\n \"consumerKey\": \"key\",\n \"consumerSecret\": \"secret\",\n \"expiresInSeconds\": \"180\"\n }'\n ```\n\n Where `$TOKEN` is set to your OAuth 2.0 access token, as described in\n [Obtaining an OAuth 2.0 access token](/apigee/docs/api-platform/get-started/api-get-started#oauth20). For information about the `curl` options used in this example, see\n [Using curl](/apigee/docs/api-platform/get-started/api-get-started#curl). For a description of environment variables you can use, see\n [Setting\n environment variables for Apigee API requests](/apigee/docs/api-platform/get-started/api-get-started#api-environment-variables).\n\n\n For a description of the fields that you can provide in the request body,\n see [Resource: DeveloperAppKey](/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys.create).\n2. **Associate the consumer key/secret with one or more Apigee API products** . Doing this allows the imported consumer key (also called the API key) to be used in calls to API proxies where authorization is controlled by products. \n See the [`ReplaceDeveloperAppKey` API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys/replaceDeveloperAppKey). Here's the curl: \n\n ```\n curl https://apigee.googleapis.com/v1/organizations/{org}/developers/{developer_email}/apps/{app_name}/keys/{key} \\\n -X POST \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H 'Content-type:application/json' \\\n -d \\\n '{\n \"apiProducts\": [\"product_1\", \"product_2\"]\n }'\n ```\n\n Where `$TOKEN` is set to your OAuth 2.0 access token, as described in\n [Obtaining an OAuth 2.0 access token](/apigee/docs/api-platform/get-started/api-get-started#oauth20). For information about the `curl` options used in this example, see\n [Using curl](/apigee/docs/api-platform/get-started/api-get-started#curl). For a description of environment variables you can use, see\n [Setting\n environment variables for Apigee API requests](/apigee/docs/api-platform/get-started/api-get-started#api-environment-variables).\n3. Optionally delete the initial consumer key/secret that Apigee auto-generated. However, you can keep the auto-generated key. Both the imported key and the auto-generated key work in API calls, and both are displayed on the Developer App Details page in the Apigee UI. \n See the [`delete` API key for developer app API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys/delete)."]]