create_api_key
async
¶
create_api_key(
api_id: String,
*,
config_overrides: Optional[AsyncAppSyncClientConfig] = None,
description: Optional[String] = None,
expires: Optional[Long] = None,
) -> CreateApiKeyResponse
Creates a unique key that you can distribute to clients who invoke your API.
Parameters:
-
api_id(String) –The ID for your GraphQL API.
-
description(Optional[String], default:None) –A description of the purpose of the API key.
-
expires(Optional[Long], default:None) –From the creation time, the time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour. The default value for this parameter is 7 days from creation time. For more information, see .
Raises:
-
ApiKeyLimitExceededException–The API key exceeded a limit. Try your request again.
-
ApiKeyValidityOutOfBoundsException–The API key expiration must be set to a value between 1 and 365 days from creation (for
CreateApiKey) or from update (forUpdateApiKey). -
BadRequestException–The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again.
-
InternalFailureException–An internal AppSync error occurred. Try your request again.
-
LimitExceededException–The request exceeded a limit. Try your request again.
-
NotFoundException–The resource specified in the request was not found. Check the resource, and then try again.
-
UnauthorizedException–You aren't authorized to perform this operation.
-
UnknownServiceError–The service returned an error code this client does not model.