Skip to main content

keys

Creates, updates, deletes, gets or lists a keys resource.

Overview

Namekeys
TypeResource
Idgoogle.apigee.keys

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
apiProductsarrayList of API products for which the credential can be used. Note: Do not specify the list of API products when creating a consumer key and secret for a developer app. Instead, use the UpdateDeveloperAppKey API to make the association after the consumer key and secret are created.
attributesarrayList of attributes associated with the credential.
consumerKeystringConsumer key.
consumerSecretstringSecret key.
expiresAtstring (int64)Time the developer app expires in milliseconds since epoch.
expiresInSecondsstring (int64)Input only. Expiration time, in seconds, for the consumer key. If not set or left to the default value of -1, the API key never expires. The expiration time can't be updated after it is set.
issuedAtstring (int64)Time the developer app was created in milliseconds since epoch.
scopesarrayScopes to apply to the app. The specified scope names must already be defined for the API product that you associate with the app.
statusstringStatus of the credential. Valid values include approved or revoked.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
organizations_developers_apps_keys_getselectorganizationsId, developersId, appsId, keysIdGets details for a consumer key for a developer app, including the key and secret value, associated API products, and other information.
organizations_appgroups_apps_keys_getselectorganizationsId, appgroupsId, appsId, keysIdGets details for a consumer key for a AppGroup app, including the key and secret value, associated API products, and other information.
organizations_developers_apps_keys_createinsertorganizationsId, developersId, appsIdCreates a custom consumer key and secret for a developer app. This is particularly useful if you want to migrate existing consumer keys and secrets to Apigee from another system. Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed. To avoid service disruptions, a consumer key and secret should not exceed 2 KBs each. Note: When creating the consumer key and secret, an association to API products will not be made. Therefore, you should not specify the associated API products in your request. Instead, use the UpdateDeveloperAppKey API to make the association after the consumer key and secret are created. If a consumer key and secret already exist, you can keep them or delete them using the DeleteDeveloperAppKey API. Note: All keys start out with status=approved, even if status=revoked is passed when the key is created. To revoke a key, use the UpdateDeveloperAppKey API.
organizations_appgroups_apps_keys_createinsertorganizationsId, appgroupsId, appsIdCreates a custom consumer key and secret for a AppGroup app. This is particularly useful if you want to migrate existing consumer keys and secrets to Apigee from another system. Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed. To avoid service disruptions, a consumer key and secret should not exceed 2 KBs each. Note: When creating the consumer key and secret, an association to API products will not be made. Therefore, you should not specify the associated API products in your request. Instead, use the UpdateAppGroupAppKey API to make the association after the consumer key and secret are created. If a consumer key and secret already exist, you can keep them or delete them using the DeleteAppGroupAppKey API.
organizations_developers_apps_keys_replace_developer_app_keyreplaceorganizationsId, developersId, appsId, keysIdUpdates the scope of an app. This API replaces the existing scopes with those specified in the request. Include or exclude any existing scopes that you want to retain or delete, respectively. The specified scopes must already be defined for the API products associated with the app. This API sets the scopes element under the apiProducts element in the attributes of the app.
organizations_developers_apps_keys_apiproducts_deletedeleteorganizationsId, developersId, appsId, keysId, apiproductsIdRemoves an API product from an app's consumer key. After the API product is removed, the app cannot access the API resources defined in that API product. Note: The consumer key is not removed, only its association with the API product.
organizations_developers_apps_keys_deletedeleteorganizationsId, developersId, appsId, keysIdDeletes an app's consumer key and removes all API products associated with the app. After the consumer key is deleted, it cannot be used to access any APIs. Note: After you delete a consumer key, you may want to: 1. Create a new consumer key and secret for the developer app using the CreateDeveloperAppKey API, and subsequently add an API product to the key using the UpdateDeveloperAppKey API. 2. Delete the developer app, if it is no longer required.
organizations_appgroups_apps_keys_deletedeleteorganizationsId, appgroupsId, appsId, keysIdDeletes an app's consumer key and removes all API products associated with the app. After the consumer key is deleted, it cannot be used to access any APIs.
organizations_developers_apps_keys_update_developer_app_keyexecorganizationsId, developersId, appsId, keysIdactionAdds an API product to a developer app key, enabling the app that holds the key to access the API resources bundled in the API product. In addition, you can add attributes and scopes associated with the API product to the developer app key. The status of the key can be updated via "action" Query Parameter. None of the other fields can be updated via this API. This API replaces the existing attributes with those specified in the request. Include or exclude any existing attributes that you want to retain or delete, respectively. None of the other fields can be updated. You can use the same key to access all API products associated with the app.
organizations_developers_apps_keys_create_createexecorganizationsId, developersId, appsIdCreates a custom consumer key and secret for a developer app. This is particularly useful if you want to migrate existing consumer keys and secrets to Apigee from another system. Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed. To avoid service disruptions, a consumer key and secret should not exceed 2 KBs each. Note: When creating the consumer key and secret, an association to API products will not be made. Therefore, you should not specify the associated API products in your request. Instead, use the UpdateDeveloperAppKey API to make the association after the consumer key and secret are created. If a consumer key and secret already exist, you can keep them or delete them using the DeleteDeveloperAppKey API. Note: All keys start out with status=approved, even if status=revoked is passed when the key is created. To revoke a key, use the UpdateDeveloperAppKey API.
organizations_developers_apps_keys_apiproducts_update_developer_app_key_api_productexecorganizationsId, developersId, appsId, keysId, apiproductsIdactionApproves or revokes the consumer key for an API product. After a consumer key is approved, the app can use it to access APIs. A consumer key that is revoked or pending cannot be used to access an API. Any access tokens associated with a revoked consumer key will remain active. However, Apigee checks the status of the consumer key and if set to revoked will not allow access to the API.
organizations_appgroups_apps_keys_update_app_group_app_keyexecorganizationsId, appgroupsId, appsId, keysIdAdds an API product to an AppGroupAppKey, enabling the app that holds the key to access the API resources bundled in the API product. In addition, you can add attributes and scopes to the AppGroupAppKey. This API replaces the existing attributes with those specified in the request. Include or exclude any existing attributes that you want to retain or delete, respectively. You can use the same key to access all API products associated with the app.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
apiproductsIdstring
appgroupsIdstring
appsIdstring
developersIdstring
keysIdstring
organizationsIdstring
actionstring

SELECT examples

Gets details for a consumer key for a developer app, including the key and secret value, associated API products, and other information.

SELECT
apiProducts,
attributes,
consumerKey,
consumerSecret,
expiresAt,
expiresInSeconds,
issuedAt,
scopes,
status
FROM google.apigee.keys
WHERE organizationsId = '{{ organizationsId }}' -- required
AND developersId = '{{ developersId }}' -- required
AND appsId = '{{ appsId }}' -- required
AND keysId = '{{ keysId }}' -- required;

INSERT examples

Creates a custom consumer key and secret for a developer app. This is particularly useful if you want to migrate existing consumer keys and secrets to Apigee from another system. Consumer keys and secrets can contain letters, numbers, underscores, and hyphens. No other special characters are allowed. To avoid service disruptions, a consumer key and secret should not exceed 2 KBs each. Note: When creating the consumer key and secret, an association to API products will not be made. Therefore, you should not specify the associated API products in your request. Instead, use the UpdateDeveloperAppKey API to make the association after the consumer key and secret are created. If a consumer key and secret already exist, you can keep them or delete them using the DeleteDeveloperAppKey API. Note: All keys start out with status=approved, even if status=revoked is passed when the key is created. To revoke a key, use the UpdateDeveloperAppKey API.

INSERT INTO google.apigee.keys (
data__apiProducts,
data__attributes,
data__consumerKey,
data__consumerSecret,
data__expiresAt,
data__issuedAt,
data__scopes,
data__status,
data__expiresInSeconds,
organizationsId,
developersId,
appsId
)
SELECT
'{{ apiProducts }}',
'{{ attributes }}',
'{{ consumerKey }}',
'{{ consumerSecret }}',
'{{ expiresAt }}',
'{{ issuedAt }}',
'{{ scopes }}',
'{{ status }}',
'{{ expiresInSeconds }}',
'{{ organizationsId }}',
'{{ developersId }}',
'{{ appsId }}'
RETURNING
apiProducts,
attributes,
consumerKey,
consumerSecret,
expiresAt,
expiresInSeconds,
issuedAt,
scopes,
status
;

REPLACE examples

Updates the scope of an app. This API replaces the existing scopes with those specified in the request. Include or exclude any existing scopes that you want to retain or delete, respectively. The specified scopes must already be defined for the API products associated with the app. This API sets the scopes element under the apiProducts element in the attributes of the app.

REPLACE google.apigee.keys
SET
data__apiProducts = '{{ apiProducts }}',
data__attributes = '{{ attributes }}',
data__consumerKey = '{{ consumerKey }}',
data__consumerSecret = '{{ consumerSecret }}',
data__expiresAt = '{{ expiresAt }}',
data__issuedAt = '{{ issuedAt }}',
data__scopes = '{{ scopes }}',
data__status = '{{ status }}',
data__expiresInSeconds = '{{ expiresInSeconds }}'
WHERE
organizationsId = '{{ organizationsId }}' --required
AND developersId = '{{ developersId }}' --required
AND appsId = '{{ appsId }}' --required
AND keysId = '{{ keysId }}' --required
RETURNING
apiProducts,
attributes,
consumerKey,
consumerSecret,
expiresAt,
expiresInSeconds,
issuedAt,
scopes,
status;

DELETE examples

Removes an API product from an app's consumer key. After the API product is removed, the app cannot access the API resources defined in that API product. Note: The consumer key is not removed, only its association with the API product.

DELETE FROM google.apigee.keys
WHERE organizationsId = '{{ organizationsId }}' --required
AND developersId = '{{ developersId }}' --required
AND appsId = '{{ appsId }}' --required
AND keysId = '{{ keysId }}' --required
AND apiproductsId = '{{ apiproductsId }}' --required;

Lifecycle Methods

Adds an API product to a developer app key, enabling the app that holds the key to access the API resources bundled in the API product. In addition, you can add attributes and scopes associated with the API product to the developer app key. The status of the key can be updated via "action" Query Parameter. None of the other fields can be updated via this API. This API replaces the existing attributes with those specified in the request. Include or exclude any existing attributes that you want to retain or delete, respectively. None of the other fields can be updated. You can use the same key to access all API products associated with the app.

EXEC google.apigee.keys.organizations_developers_apps_keys_update_developer_app_key 
@organizationsId='{{ organizationsId }}' --required,
@developersId='{{ developersId }}' --required,
@appsId='{{ appsId }}' --required,
@keysId='{{ keysId }}' --required,
@action='{{ action }}'
@@json=
'{
"apiProducts": "{{ apiProducts }}",
"attributes": "{{ attributes }}",
"consumerKey": "{{ consumerKey }}",
"consumerSecret": "{{ consumerSecret }}",
"expiresAt": "{{ expiresAt }}",
"issuedAt": "{{ issuedAt }}",
"scopes": "{{ scopes }}",
"status": "{{ status }}",
"expiresInSeconds": "{{ expiresInSeconds }}"
}';