You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs/api-platform/publish/import-existing-consumer-keys-and-secrets). info

Apigee Edge automatically generates consumer keys and consumer secrets when you create
developer apps and associate them with API products. (Those procedures are covered in [Register apps and manage API
keys](https://docs.apigee.com/api-platform/publish/creating-apps-surface-your-api).) However, you may have existing consumer keys and secrets that you want to import into
Apigee Edge from another system. Technically, this process isn't an import. It's recreating the
existing keys in Edge one at a time.

> [!CAUTION]
> Be aware of the following size limits on API keys. By staying within these limits, you help avoid service disruptions.

|---|---|
| **Consumer key** (API key) size | 2 KB |
| **Consumer secret** size | 2 KB |

> [!NOTE]
> **Note:** Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed.

1. **Create the consumer keys and secrets** in Edge with the management API, one at a time.  
   See the [`create` a consumer key and secret API](https://apidocs.apigee.com/docs/developer-app-keys/1/routes/organizations/%7Borg_name%7D/developers/%7Bdeveloper_email%7D/apps/%7Bapp_name%7D/keys/create/post). Here's the cURL:  

   ```
   curl -H 'Content-type:application/json' -u email:password https://api.enterprise.apigee.com/v1/organizations/{organization}/developers/{developer_email_or_id}/apps/{app_name}/keys/create -X POST -d \
   '{
     "consumerKey": "key",
     "consumerSecret": "secret"
     }'
   ```
2. **Associate the consumer key/secret with one or more Edge 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 [add (`post`) API product to key API](https://apidocs.apigee.com/docs/developer-app-keys/1/routes/organizations/%7Borg_name%7D/developers/%7Bdeveloper_email%7D/apps/%7Bapp_name%7D/keys/%7Bconsumer_key%7D/post). Here's the cURL:

   ```
   curl -H 'Content-type:application/json' -u email:password https://api.enterprise.apigee.com/v1/organizations/{organization}/developers/{developer_email_or_id}/apps/{app_name}/keys/{consumer_key_name} -X POST -d \
   '{
    "apiProducts": ["product_1", "product_2"]
   }'
   ```
3. Optionally delete the initial consumer key/secret that Edge 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 management UI.  
   See the [`delete` key for a developer app API](https://apidocs.apigee.com/docs/developer-app-keys/1/routes/organizations/%7Borg_name%7D/developers/%7Bdeveloper_email%7D/apps/%7Bapp_name%7D/keys/%7Bconsumer_key%7D/delete).