> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tess.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Import Template Pack

> Imports a template pack, creating or updating a digital employee from the pack configuration.

Import a template pack to create or update a digital employee. If no `target_agent_id` is provided, a new host agent is created automatically to receive the imported employee.

<Note>
  Run [Preview Template Import](/en/de-preview-import) first to validate the pack and check for conflicts before executing the import.
</Note>

### **Code Examples**

<CodeGroup>
  ```http cURL theme={null}
  curl --request POST \
    --url 'https://api.tess.im/digital-employees/template-packs/import' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'x-workspace-id: YOUR_WORKSPACE_ID' \
    --header 'Content-Type: application/json' \
    --data '{
      "target_agent_id": 99,
      "collision_strategy": "rename",
      "pack": {}
    }'
  ```

  ```json Node.js theme={null}
  const axios = require('axios');

  const config = {
    method: 'post',
    url: 'https://api.tess.im/digital-employees/template-packs/import',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'x-workspace-id': 'YOUR_WORKSPACE_ID',
      'Content-Type': 'application/json'
    },
    data: {
      target_agent_id: 99,
      collision_strategy: 'rename',
      pack: {}
    }
  };

  try {
    const response = await axios(config);
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.tess.im/digital-employees/template-packs/import"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "x-workspace-id": "YOUR_WORKSPACE_ID",
      "Content-Type": "application/json"
  }
  payload = {
      "target_agent_id": 99,
      "collision_strategy": "rename",
      "pack": {}
  }

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

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.tess.im/digital-employees/template-packs/import",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
      'target_agent_id' => 99,
      'collision_strategy' => 'rename',
      'pack' => (object)[]
    ]),
    CURLOPT_HTTPHEADER => [
      "Authorization: Bearer YOUR_API_KEY",
      "x-workspace-id: YOUR_WORKSPACE_ID",
      "Content-Type: application/json"
    ]
  ]);

  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  String body = """
      {
        "target_agent_id": 99,
        "collision_strategy": "rename",
        "pack": {}
      }
      """;

  HttpClient client = HttpClient.newHttpClient();
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.tess.im/digital-employees/template-packs/import"))
      .header("Authorization", "Bearer YOUR_API_KEY")
      .header("x-workspace-id", "YOUR_WORKSPACE_ID")
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString(body))
      .build();

  HttpResponse<String> response = client.send(request,
      HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```

  ```go Go theme={null}
  package main

  import (
      "fmt"
      "io"
      "net/http"
      "strings"
  )

  func main() {
      payload := strings.NewReader(`{
        "target_agent_id": 99,
        "collision_strategy": "rename",
        "pack": {}
      }`)

      client := &http.Client{}
      req, _ := http.NewRequest("POST",
          "https://api.tess.im/digital-employees/template-packs/import",
          payload)
      req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
      req.Header.Add("x-workspace-id", "YOUR_WORKSPACE_ID")
      req.Header.Add("Content-Type", "application/json")

      resp, _ := client.Do(req)
      defer resp.Body.Close()
      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```jsonnet .NET theme={null}
  using System.Net.Http;
  using System.Text;
  using System.Text.Json;

  using var client = new HttpClient();
  client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
  client.DefaultRequestHeaders.Add("x-workspace-id", "YOUR_WORKSPACE_ID");

  var payload = new {
      target_agent_id = 99,
      collision_strategy = "rename",
      pack = new {}
  };

  var content = new StringContent(
      JsonSerializer.Serialize(payload),
      Encoding.UTF8,
      "application/json");

  var response = await client.PostAsync(
      "https://api.tess.im/digital-employees/template-packs/import",
      content);
  Console.WriteLine(await response.Content.ReadAsStringAsync());
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'json'

  uri = URI('https://api.tess.im/digital-employees/template-packs/import')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(uri)
  request['Authorization'] = 'Bearer YOUR_API_KEY'
  request['x-workspace-id'] = 'YOUR_WORKSPACE_ID'
  request['Content-Type'] = 'application/json'
  request.body = {
    target_agent_id: 99,
    collision_strategy: 'rename',
    pack: {}
  }.to_json

  response = http.request(request)
  puts response.read_body
  ```
</CodeGroup>

### **Headers**

<Note>
  Include your API key in the `Authorization` header as a Bearer token on every request.
</Note>

<ParamField header="x-workspace-id" type="integer" required>
  ID of the workspace. Required for all Digital Employees API requests.
</ParamField>

### **Request Body**

<ParamField body="pack" type="object" required>
  The template pack payload obtained from [Export Template Pack](/en/de-export-template).
</ParamField>

<ParamField body="target_agent_id" type="integer">
  ID of the agent to import into. If omitted, a new host agent is created automatically.
</ParamField>

<ParamField body="collision_strategy" type="string">
  How to handle naming conflicts with existing employees. Options:

  * `skip` — keep existing employees, skip conflicting imports (default)
  * `rename` — auto-rename imported employees to avoid conflicts
  * `overwrite` — replace existing employees with imported configuration
</ParamField>

### **Response**

Returns the import result object describing the employees created, updated, or skipped.

```json theme={null}
{
  "data": {
    "employees_created": [],
    "employees_updated": [],
    "employees_skipped": []
  }
}
```

### **Errors**

* `422` with `reason: digital_employee_template_import_blocked` — the pack contains blocking issues that prevent import. Inspect the `blocking_issues` array in the response for details.
* `422` — invalid pack structure or missing required fields.
