> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eon.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eon.io/_mcp/server.

# Create Restore Template

POST https://%7Baccount-domain%7D.console.eon.io/api/v1/projects/{projectId}/inventory/restore-templates
Content-Type: application/json

Creates a restore template.

Reference: https://docs.eon.io/api/api-reference/restore-connections/restore-templates/create-restore-template

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `projectId` (string, required) — ID of the project the restore template is in. You can get your project ID from the [API Credentials](https://console.eon.io/global-management/api-credentials) page in your global management console.

### Body (application/json)

This endpoint expects a CreateRestoreTemplateRequest.

- `name` (string, required) — Restore template display name.
- `resourceType` (enum, required) — Resource type the restore template applies to. `RESTORE_TEMPLATE_RESOURCE_TYPE_UNSPECIFIED` is supported only in responses.
  - Allowed values: `RESTORE_TEMPLATE_RESOURCE_TYPE_UNSPECIFIED`, `EC2_INSTANCE`, `S3_BUCKET`
- `description` (string, optional) — Description of the purpose of the restore template.
- `ec2Params` (Ec2TemplateParams, optional)
- `s3Params` (S3TemplateParams, optional)

## Response

### 201

Restore template created.

- `restoreTemplate` (RestoreTemplate, required) — Created restore template.

## Types

### Ec2TemplateParams

- `subnetId` (string, required) — Cloud-provider-assigned ID of the subnet for the restored EC2 instance.
- `keepOriginalTags` (boolean, required, default: true) — Whether to keep the original tags from the source resource.
- `nameTemplate` (string, required) — Template for naming the restored EC2 instance.
- `startAfterRestore` (boolean, required) — Whether to start the restored EC2 instance after restoration.
- `targetAccountId` (string, required) — Eon-assigned ID of the destination restore account.
- `targetRegion` (string, required) — Target region for the restore.
- `securityGroupIds` (list of string, optional) — Cloud-provider-assigned IDs of the security groups to attach to the restored EC2 instance.
- `instanceType` (string, optional) — EC2 instance type for the restored instance. Required unless `inheritInstanceType` is set to `true`, in which case, must be empty.
- `inheritInstanceType` (boolean, optional, default: false) — Whether to restore each instance with the instance type recorded in its own snapshot, instead of `instanceType`. The template's subnet must be in an availability zone that offers the specified type.
- `kmsKeyArn` (string, optional) — ARN of the KMS key to use for encrypting the restored instance.
- `additionalTags` (list of Ec2TemplateParamsAdditionalTagsItems, optional) — Additional tags to apply to the restored EC2 instance.

### S3TemplateParams

- `targetBucketId` (string, required) — Name of the target S3 bucket for the restore.
- `prefixTemplate` (string, required) — Template for the prefix to use when restoring objects.
- `targetAccountId` (string, required) — Eon-assigned ID of the target restore account.
- `targetRegion` (string, required) — Target region for the restore.
- `kmsKeyArn` (string, optional) — ARN of a customer-managed KMS key in the target account and region. It encrypts the restore's temporary secrets in the restore account: the vault access secret and the container-registry token. Restored objects use the target bucket's default encryption. AWS-managed keys aren't accepted.

### RestoreTemplate

- `id` (string, required) — ID of the restore template.
- `name` (string, required) — Restore template display name.
- `resourceType` (enum, required) — Resource type the restore template applies to. `RESTORE_TEMPLATE_RESOURCE_TYPE_UNSPECIFIED` is supported only in responses.
  - Allowed values: `RESTORE_TEMPLATE_RESOURCE_TYPE_UNSPECIFIED`, `EC2_INSTANCE`, `S3_BUCKET`
- `description` (string, optional) — Description of the restore template's purpose.
- `ec2Params` (Ec2TemplateParams, optional)
- `s3Params` (S3TemplateParams, optional)
- `attachedResourceCount` (integer, optional) — Number of resources currently using this restore template.
- `createdAt` (datetime, optional) — Date and time the restore template was created.
- `updatedAt` (datetime, optional) — Date and time the restore template was last updated.

### Ec2TemplateParamsAdditionalTagsItems

- `key` (string, optional) — Tag key.
- `value` (string, optional) — Tag value.

## Examples

**Request**

```json
{
  "name": "EC2 production restore template",
  "resourceType": "EC2_INSTANCE"
}
```

**Response**

```json
{
  "restoreTemplate": {
    "id": "de308488-df3d-5b82-8f37-477ef529f491",
    "name": "EC2 production restore template",
    "resourceType": "EC2_INSTANCE",
    "description": "Used for restoring production EC2 instances",
    "ec2Params": {
      "subnetId": "subnet-0123456789abcdef0",
      "keepOriginalTags": true,
      "nameTemplate": "{original_name}-restored",
      "startAfterRestore": false,
      "targetAccountId": "9b76a8a2-a918-57e6-94d5-0316ebab663c",
      "targetRegion": "us-east-1",
      "securityGroupIds": [
        "sg-0123456789abcdef0"
      ],
      "instanceType": "t3.medium",
      "inheritInstanceType": false,
      "kmsKeyArn": "arn:aws:kms:us-east-1:123456789012:key/mrk-abc123",
      "additionalTags": [
        {
          "key": "eon_api_restore",
          "value": "true"
        }
      ]
    },
    "s3Params": {
      "targetBucketId": "my-restore-bucket",
      "prefixTemplate": "restored/{original_prefix}",
      "targetAccountId": "9b76a8a2-a918-57e6-94d5-0316ebab663c",
      "targetRegion": "us-east-1",
      "kmsKeyArn": "arn:aws:kms:us-east-1:123456789012:key/mrk-abc123"
    },
    "attachedResourceCount": 3,
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-16T14:20:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/projects/733888d8-2573-5f9a-b81d-21f051d24fda/inventory/restore-templates"

payload = {
    "name": "EC2 production restore template",
    "resourceType": "EC2_INSTANCE"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/projects/733888d8-2573-5f9a-b81d-21f051d24fda/inventory/restore-templates';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"EC2 production restore template","resourceType":"EC2_INSTANCE"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/projects/733888d8-2573-5f9a-b81d-21f051d24fda/inventory/restore-templates")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"EC2 production restore template\",\n  \"resourceType\": \"EC2_INSTANCE\"\n}")
  .asString();
```