Apigee automatically generates consumer keys and consumer secrets when you create
developer apps and associate them with API products. (Those procedures are covered in
Controlling access to your APIs by registering apps.) However, you may have existing
consumer keys and secrets that you want to import into
Apigee from another system. Technically, this process isn't an import. It's recreating the
existing keys in Apigee one at a time.
For a description of the fields that you can provide in the request body,
see Resource: DeveloperAppKey.
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.
See the
ReplaceDeveloperAppKey API. Here's the curl:
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.
See the
delete API key for developer app API.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 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)."]]