Execute a user transfer using mappings from a scan
curl --request POST \
--url https://your-instance.example.com/api/departments/transfer/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scanVersion": "v2026-05-18T12:00:00Z-abc123",
"assignments": [
{
"userId": "65b1f0a2c3d4e5f6a7b8c9d0",
"targetDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d1"
}
],
"deleteSourceDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d0"
}
'import requests
url = "https://your-instance.example.com/api/departments/transfer/execute"
payload = {
"scanVersion": "v2026-05-18T12:00:00Z-abc123",
"assignments": [
{
"userId": "65b1f0a2c3d4e5f6a7b8c9d0",
"targetDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d1"
}
],
"deleteSourceDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
scanVersion: 'v2026-05-18T12:00:00Z-abc123',
assignments: [
{
userId: '65b1f0a2c3d4e5f6a7b8c9d0',
targetDepartmentId: '65c1a0b0c0d0e0f0a0b0c0d1'
}
],
deleteSourceDepartmentId: '65c1a0b0c0d0e0f0a0b0c0d0'
})
};
fetch('https://your-instance.example.com/api/departments/transfer/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/departments/transfer/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scanVersion' => 'v2026-05-18T12:00:00Z-abc123',
'assignments' => [
[
'userId' => '65b1f0a2c3d4e5f6a7b8c9d0',
'targetDepartmentId' => '65c1a0b0c0d0e0f0a0b0c0d1'
]
],
'deleteSourceDepartmentId' => '65c1a0b0c0d0e0f0a0b0c0d0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/departments/transfer/execute"
payload := strings.NewReader("{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/departments/transfer/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/departments/transfer/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}"
response = http.request(request)
puts response.read_body{
"transferId": "65d0a0b0c0d0e0f0a0b0c0d0",
"status": "running",
"progress": {
"processed": 5,
"total": 24
}
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}DepartmentTransfer
Execute a user transfer using mappings from a scan
Apply the assignments returned by /scan or /scan-bulk. The supplied scanVersion must still match the live state — a stale scan returns 400 and the caller must re-scan. Optionally deletes the source department after a successful bulk move. Returns 202 with a transferId for status polling.
POST
/
api
/
departments
/
transfer
/
execute
Execute a user transfer using mappings from a scan
curl --request POST \
--url https://your-instance.example.com/api/departments/transfer/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scanVersion": "v2026-05-18T12:00:00Z-abc123",
"assignments": [
{
"userId": "65b1f0a2c3d4e5f6a7b8c9d0",
"targetDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d1"
}
],
"deleteSourceDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d0"
}
'import requests
url = "https://your-instance.example.com/api/departments/transfer/execute"
payload = {
"scanVersion": "v2026-05-18T12:00:00Z-abc123",
"assignments": [
{
"userId": "65b1f0a2c3d4e5f6a7b8c9d0",
"targetDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d1"
}
],
"deleteSourceDepartmentId": "65c1a0b0c0d0e0f0a0b0c0d0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
scanVersion: 'v2026-05-18T12:00:00Z-abc123',
assignments: [
{
userId: '65b1f0a2c3d4e5f6a7b8c9d0',
targetDepartmentId: '65c1a0b0c0d0e0f0a0b0c0d1'
}
],
deleteSourceDepartmentId: '65c1a0b0c0d0e0f0a0b0c0d0'
})
};
fetch('https://your-instance.example.com/api/departments/transfer/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/departments/transfer/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scanVersion' => 'v2026-05-18T12:00:00Z-abc123',
'assignments' => [
[
'userId' => '65b1f0a2c3d4e5f6a7b8c9d0',
'targetDepartmentId' => '65c1a0b0c0d0e0f0a0b0c0d1'
]
],
'deleteSourceDepartmentId' => '65c1a0b0c0d0e0f0a0b0c0d0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/departments/transfer/execute"
payload := strings.NewReader("{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/departments/transfer/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/departments/transfer/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scanVersion\": \"v2026-05-18T12:00:00Z-abc123\",\n \"assignments\": [\n {\n \"userId\": \"65b1f0a2c3d4e5f6a7b8c9d0\",\n \"targetDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d1\"\n }\n ],\n \"deleteSourceDepartmentId\": \"65c1a0b0c0d0e0f0a0b0c0d0\"\n}"
response = http.request(request)
puts response.read_body{
"transferId": "65d0a0b0c0d0e0f0a0b0c0d0",
"status": "running",
"progress": {
"processed": 5,
"total": 24
}
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}{
"error": "Scan version is stale; please re-scan"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Token from the prior scan; rejected if stale to prevent applying an out-of-date plan.
Per-user transfer plan: source userId -> target department / new role / re-assignee.
When set, the source department is deleted after the transfer succeeds (must be empty).
⌘I