

# CreateTemplate
<a name="API_CreateTemplate"></a>

Creates an Active Directory compatible certificate template. The connectors issues certificates using these templates based on the requester’s Active Directory group membership.

## Request Syntax
<a name="API_CreateTemplate_RequestSyntax"></a>

```
POST /templates HTTP/1.1
Content-type: application/json

{
   "ClientToken": "string",
   "ConnectorArn": "string",
   "Definition": { ... },
   "Name": "string",
   "Tags": { 
      "string" : "string" 
   }
}
```

## URI Request Parameters
<a name="API_CreateTemplate_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_CreateTemplate_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [ClientToken](#API_CreateTemplate_RequestSyntax) **   <a name="PcaConnectorAd-CreateTemplate-request-ClientToken"></a>
Idempotency token.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[!-~]+`   
Required: No

 ** [ConnectorArn](#API_CreateTemplate_RequestSyntax) **   <a name="PcaConnectorAd-CreateTemplate-request-ConnectorArn"></a>
The Amazon Resource Name (ARN) that was returned when you called [CreateConnector](https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html).  
Type: String  
Length Constraints: Minimum length of 5. Maximum length of 200.  
Pattern: `arn:[\w-]+:pca-connector-ad:[\w-]+:[0-9]+:connector\/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}`   
Required: Yes

 ** [Definition](#API_CreateTemplate_RequestSyntax) **   <a name="PcaConnectorAd-CreateTemplate-request-Definition"></a>
Template configuration to define the information included in certificates. Define certificate validity and renewal periods, certificate request handling and enrollment options, key usage extensions, application policies, and cryptography settings.  
Type: [TemplateDefinition](API_TemplateDefinition.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: Yes

 ** [Name](#API_CreateTemplate_RequestSyntax) **   <a name="PcaConnectorAd-CreateTemplate-request-Name"></a>
Name of the template. The template name must be unique.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `(?!^\s+$)((?![\x5c'\x2b,;<=>#\x22])([\x20-\x7E]))+`   
Required: Yes

 ** [Tags](#API_CreateTemplate_RequestSyntax) **   <a name="PcaConnectorAd-CreateTemplate-request-Tags"></a>
Metadata assigned to a template consisting of a key-value pair.  
Type: String to string map  
Required: No

## Response Syntax
<a name="API_CreateTemplate_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "TemplateArn": "string"
}
```

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

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [TemplateArn](#API_CreateTemplate_ResponseSyntax) **   <a name="PcaConnectorAd-CreateTemplate-response-TemplateArn"></a>
If successful, the Amazon Resource Name (ARN) of the template.  
Type: String  
Length Constraints: Minimum length of 5. Maximum length of 200.  
Pattern: `arn:[\w-]+:pca-connector-ad:[\w-]+:[0-9]+:connector\/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\/template\/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}` 

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

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

 ** AccessDeniedException **   
You can receive this error if you attempt to create a resource share when you don't have the required permissions. This can be caused by insufficient permissions in policies attached to your AWS Identity and Access Management (IAM) principal. It can also happen because of restrictions in place from an AWS Organizations service control policy (SCP) that affects your AWS account.   
HTTP Status Code: 403

 ** ConflictException **   
This request cannot be completed for one of the following reasons because the requested resource was being concurrently modified by another request.    
 ** ResourceId **   
The identifier of the AWS resource.  
 ** ResourceType **   
The resource type, which can be one of `Connector`, `Template`, `TemplateGroupAccessControlEntry`, `ServicePrincipalName`, or `DirectoryRegistration`.
HTTP Status Code: 409

 ** InternalServerException **   
The request processing has failed because of an unknown error, exception or failure with an internal server.   
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The operation tried to access a nonexistent resource. The resource might not be specified correctly, or its status might not be ACTIVE.    
 ** ResourceId **   
The identifier of the AWS resource.  
 ** ResourceType **   
The resource type, which can be one of `Connector`, `Template`, `TemplateGroupAccessControlEntry`, `ServicePrincipalName`, or `DirectoryRegistration`.
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
Request would cause a service quota to be exceeded.    
 ** QuotaCode **   
The code associated with the service quota.  
 ** ResourceId **   
The identifier of the AWS resource.  
 ** ResourceType **   
The resource type, which can be one of `Connector`, `Template`, `TemplateGroupAccessControlEntry`, `ServicePrincipalName`, or `DirectoryRegistration`.  
 ** ServiceCode **   
Identifies the originating service.
HTTP Status Code: 402

 ** ThrottlingException **   
The limit on the number of requests per second was exceeded.     
 ** QuotaCode **   
The code associated with the quota.  
 ** ServiceCode **   
Identifies the originating service.
HTTP Status Code: 429

 ** ValidationException **   
An input validation error occurred. For example, invalid characters in a template name, or if a pagination token is invalid.     
 ** Reason **   
The reason for the validation error. This won't be return for every validation exception.
HTTP Status Code: 400

## See Also
<a name="API_CreateTemplate_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/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/pca-connector-ad-2018-05-10/CreateTemplate) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/pca-connector-ad-2018-05-10/CreateTemplate) 