

# CreateInvitation

Creates a pending invitation for a customer account to connect to an environment. Call this operation from the account that owns the environment.

At most one non-terminal (PENDING or ACTIVE) invitation can exist per `(environment, inviteeAccountId)` pair. If you call this operation when a non-terminal invitation already exists, the service returns `ConflictException`.

## Request Parameters
<a name="API_CreateInvitation_RequestParameters"></a>

 ** environmentArn **   
The ARN of this governance environment.  
Type: String  
Length Constraints: Minimum length of 3. Maximum length of 2048.  
Pattern: `(arn:aws[a-zA-Z-]*:assurance:[a-z0-9-]+:[0-9]{12}:environment/[a-zA-Z0-9][a-zA-Z0-9\-]*|[a-zA-Z0-9][a-zA-Z0-9\-]*)`   
Required: Yes

 ** inviteeAccountId **   
The ID of the invited AWS account.  
Type: String  
Length Constraints: Fixed length of 12.  
Pattern: `[0-9]{12}`   
Required: Yes

## Response Elements
<a name="API_CreateInvitation_ResponseElements"></a>

The following elements are returned by the service.

 ** expiresAt **   
The time when the invitation expires if not accepted.  
Type: Timestamp

 ** status **   
The lifecycle state of the created invitation. PENDING for a freshly created invitation. If an active invitation already exists for the same environment and account, the operation returns the current state (for example, ACTIVE) unchanged.  
Type: String  
Valid Values: `PENDING | ACTIVE | REJECTED | REVOKED | EXPIRED` 

## Errors
<a name="API_CreateInvitation_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.  
HTTP Status Code: 403

 ** ConflictException **   
A conflict occurred (for example, resource already exists).  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred.  
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The requested resource was not found.  
HTTP Status Code: 404

 ** ThrottlingException **   
The request was throttled.  
HTTP Status Code: 429

 ** ValidationException **   
The request failed validation.  
HTTP Status Code: 400

## See Also
<a name="API_CreateInvitation_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/assurance-2022-07-26/CreateInvitation) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/assurance-2022-07-26/CreateInvitation) 