> ## 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.

# Reparent Digital Employee

> Assigns a new parent employee, making this employee a child of another.

### **Code Examples**

```http cURL theme={null}
curl --request POST \
  --url 'https://api.tess.im/digital-employees/123/reparent' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --header 'x-workspace-id: 10' \
  --data '{"parent_employee_id": 100}'
```

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

const config = {
  method: 'post',
  url: 'https://api.tess.im/digital-employees/123/reparent',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
    'x-workspace-id': '10'
  },
  data: {
    parent_employee_id: 100
  }
};

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/123/reparent"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
    "x-workspace-id": "10"
}
payload = {
    "parent_employee_id": 100
}

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/123/reparent",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode(["parent_employee_id" => 100]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json",
    "x-workspace-id: 10"
  ]
]);

$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;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.tess.im/digital-employees/123/reparent"))
    .header("Authorization", "Bearer YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .header("x-workspace-id", "10")
    .POST(HttpRequest.BodyPublishers.ofString("{\"parent_employee_id\": 100}"))
    .build();

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

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

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

func main() {
    client := &http.Client{}
    body := strings.NewReader(`{"parent_employee_id": 100}`)
    req, _ := http.NewRequest("POST", "https://api.tess.im/digital-employees/123/reparent", body)
    req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("x-workspace-id", "10")
    resp, _ := client.Do(req)
    defer resp.Body.Close()
    respBody, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(respBody))
}
```

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

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

var content = new StringContent(
    "{\"parent_employee_id\": 100}",
    Encoding.UTF8,
    "application/json"
);

var response = await client.PostAsync(
    "https://api.tess.im/digital-employees/123/reparent",
    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/123/reparent')
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['Content-Type'] = 'application/json'
request['x-workspace-id'] = '10'
request.body = { parent_employee_id: 100 }.to_json

response = http.request(request)
puts response.read_body
```

### **Headers**

> [!NOTE]
>
> Pass your API key as a Bearer token in the `Authorization` header: `Authorization: Bearer YOUR_API_KEY`.

**x-workspace-id** `integer`

ID of the workspace. If not provided, the user's selected workspace will be used.

### **Path Parameters**

**employeeId** `integer` *required*

ID of the digital employee to reassign to a new parent.

### **Body Parameters**

**parent\_employee\_id** `integer` *required*

ID of the new parent digital employee. The parent must exist in the same workspace.

### **Response**

```json theme={null}
{
  "data": {
    "id": 123,
    "name": "Finance Ops",
    "parent_employee_id": 100,
    "workspace_id": 10
  }
}
```

> [!NOTE]
>
> Use [Detach](https://docs.tess.im/en/de-detach.md) to remove a parent relationship without setting a new one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.