A Apigee gera automaticamente secrets e tokens do cliente quando você cria
aplicativos de desenvolvedor e os associa a produtos de API. Esses procedimentos são abordados em
Como controlar o acesso às APIs registrando aplicativos. No entanto, é possível ter secrets e tokens do cliente que você quer importar para
a Apigee a partir de outro sistema. Tecnicamente, esse processo não é uma importação. Ele recria as
chaves atuais na Apigee, uma de cada vez.
Para ver uma descrição dos campos que podem ser fornecidos no corpo da solicitação, consulte Recurso: DeveloperAppKey.
Associe o token do consumidor ou secret a um ou mais produtos da API Apigee. Isso
permite que o token do consumidor importado (também chamado de chave de API) seja usado nas chamadas para os proxies da API, em que a autorização é controlada pelos produtos.
Consulte a
API ReplaceDeveloperAppKey. Veja o curl:
Opcionalmente, exclua o token do cliente ou o secret gerados automaticamente pela Apigee. No entanto, é
possível manter a chave gerada automaticamente. Tanto a chave importada quanto a chave gerada automaticamente funcionam nas chamadas da
API. Ambas são exibidas na página "Detalhes do app do desenvolvedor" na IU da Apigee.
Consulte a
chave de API delete da API do app para desenvolvedores.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-28 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)."]]