Organization Structure

The organization structure is a company's reporting hierarchy. Each employee you place in it gets a node, and each node has one parent and any number of subordinates. Use these endpoints to build the hierarchy, read it back, and change it.

This page covers creating the structure, adding employees to it (one at a time or several at once), reading it, moving a node, swapping two employees, and removing a node.

All endpoints on this page require a bearer access token (see How to Get API Access). CLIENT_ID is the company identifier returned as id when you create the company.


How the structure works

  • Nodes. When you place an employee in the structure, the employee gets a node with its own nodeId. A node ID is not an employee ID.
  • Parent and subordinates. Every node has a parent node. The nodes directly below a node are its subordinates. To make employee B report to employee A, place B's node under A's node.
  • Root. 0 is the root. It is the parent of every top-level node. You can pass 0 as a parent, but there is no node 0 to read or change. Top-level nodes have parentNodeId 0 and level 1.
  • Subtrees move together. When you move a node, its subordinates move with it.
  • Employees outside the structure. Employees you haven't placed are still returned by Get the Organization Structure, but without any node fields.

Which ID goes where

Employee IDs and node IDs are different numbers, and each endpoint takes one or the other. Check this table before each call.

EndpointID in the pathOther IDs
Add an EmployeeEmployee ID (EMPLOYEE_ID)newParentNodeId is a node ID.
Add SubordinatesNode ID of the parent (NODE_ID)The request body is an array of employee IDs.
Move a NodeNode ID (NODE_ID)newParentNodeId is a node ID.
Remove a NodeNode ID (NODE_ID)None.

You get employee IDs from Create an Employee or List Employees. You get node IDs from the response to Add an Employee or from Get the Organization Structure.


Endpoints overview

MethodNameEndpoint
POSTCreate the Organization Structurehttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct?effectiveDate={EFFECTIVE_DATE}
PUTAdd an Employeehttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{EMPLOYEE_ID}?newParentNodeId={NODE_ID}
POSTAdd Subordinateshttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}/subordinates
GETGet the Organization Structurehttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct
PATCHMove a Nodehttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}?newParentNodeId={NODE_ID}
—Swap EmployeesNot documented yet.
DELETERemove a Nodehttps://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}?includeSubordinates={true|false}

Every endpoint except Add Subordinates takes its parameters in the query string and has no request body.

Running example

The examples on this page build and then change the following structure, in order. Each section states the structure it starts from.

Employee IDName
4401Elena Marsh
4402David Klein
4403Sofia Alvarez
4404Priya Patel
4405Tomas Novak
4406Hannah Weber
4407Oliver Reyes
Elena Marsh
├── David Klein
│   ├── Sofia Alvarez
│   └── Priya Patel
└── Tomas Novak

Hannah Weber and Oliver Reyes are never placed. They show how unplaced employees appear in the response of Get the Organization Structure.


Create the Organization Structure

Creates the company's organization structure with an effective date.

This step is optional. If you skip it, the structure is created when you add the first employee.

Endpoint

POST https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct?effectiveDate={EFFECTIVE_DATE}
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
effectiveDatestring (date, YYYY-MM-DD)YesThe date the organization structure takes effect. Query parameter.

No request body.

Example request

require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct?effectiveDate=2026-10-07`;

async function createOrgStructure() {
  const response = await fetch(url, {
    method: "GET",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  console.log(response.status);
  const raw = await response.text();
  console.log(JSON.parse(raw));
}

createOrgStructure();
curl -s -X GET "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct?effectiveDate=2026-10-07" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0" | jq .

Example response

"2026-10-07T00:00:00Z"

The response body is the effective date of the structure, as a date-time string.


Add an Employee

Places an employee in the structure under a parent node and returns the ID of the employee's new node.

  • If you omit newParentNodeId, the employee is placed at the top level, under the root (0).
  • If newParentNodeId is the node of another employee, the employee becomes that employee's subordinate.
  • If the structure doesn't exist yet, this call creates it. See Create the Organization Structure.

To place several employees under the same parent in one request, use Add Subordinates.

Endpoint

PUT https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{EMPLOYEE_ID}?newParentNodeId={NODE_ID}
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
EMPLOYEE_IDintegerYesThe employee's id, as returned by Create an Employee or List Employees. This is an employee ID, not a node ID. Path parameter.
newParentNodeIdintegerNoThe nodeId of the parent node. 0 places the employee at the top level. Defaults to 0 when omitted. Query parameter.

No request body. Send newParentNodeId in the query string.

Example request

This example places David Klein (employee 4402) under Elena Marsh's node (2311).

require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const EMPLOYEE_ID = 4402;
const PARENT_NODE_ID = 2311;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct/${EMPLOYEE_ID}?newParentNodeId=${PARENT_NODE_ID}`;

async function addEmployeeToOrgStructure() {
  const response = await fetch(url, {
    method: "PUT",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  console.log(response.status);
  const raw = await response.text();
  console.log(JSON.parse(raw));
}

addEmployeeToOrgStructure();
curl -s -X PUT "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct/4402?newParentNodeId=2311" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0" | jq .

Example response

2312

The response body is the nodeId of David Klein's new node, as a bare number, not a JSON object. Save it. You need it as NODE_ID to add subordinates under David, move him, or remove him.

Place an employee at the top level

To place Elena Marsh (employee 4401) at the top level, omit newParentNodeId:

PUT https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/4401

This returns the nodeId of Elena's new node, 2311 in the running example. The example above uses that value as David's parent.

Error response

If newParentNodeId is not the ID of an existing node, the endpoint returns 400:

{
  "status": 0,
  "code": "400",
  "errorCode": "EeOrgStructureNotFound",
  "message": "10/7/2026 - 12:01:29 PM : An Employee Organization Structure record not found.",
  "stackTrace": "",
  "pagination": {
    "pageNo": 0,
    "pageSize": 0,
    "totalRecords": 0,
    "totalPages": 0,
    "dataToken": ""
  },
  "validationErrors": null
}

If employee already exists in orgStructure you will get an error.

{
  status: 0,
  code: '400',
  errorCode: 'EeExistsInOrgStructure',
  message: '10/8/2026 - 9:21:47 AM : Missing localization for key: Worklio.Business.Clients.Companies.Logic.OrganisationStructure.EeExistsInOrgStructure',
  stackTrace: '',
  pagination: {
    pageNo: 0,
    pageSize: 0,
    totalRecords: 0,
    totalPages: 0,
    dataToken: ''
  },
  validationErrors: null
}

See Errors for how to read this envelope.


Add Subordinates

Places several employees directly under one parent node in a single request.

Endpoint

POST https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}/subordinates
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
NODE_IDintegerYesThe nodeId of the parent node. This is a node ID, not an employee ID. Path parameter.

Request body

The request body is a JSON array of employee IDs. Each entry is an employee's id, not a node ID.

ItemTypeRequiredDescription
(array item)integerYesThe id of an employee to place under the parent node.

Example request

This example places Sofia Alvarez (4403) and Priya Patel (4404) under David Klein's node (2312).

require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const NODE_ID = 2312;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct/${NODE_ID}/subordinates`;

const payload = [4403, 4404];

async function addSubordinates() {
  const response = await fetch(url, {
    method: "POST",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    },
    body: JSON.stringify(payload)
  });

  // A successful request returns 204 with no body, so there is nothing to parse.
  console.log(response.status);
}

addSubordinates();
curl -s -o /dev/null -w "%{http_code}\n" -X POST \
  "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct/2312/subordinates" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0" \
  -d '[4403, 4404]'

Example response

204 No Content

A successful request returns 204 with no response body. Don't parse the body of a 204 response as JSON.

The response doesn't include the new node IDs. To read them, call Get the Organization Structure.


Get the Organization Structure

Returns the company's organization structure as a flat array. The array contains every employee of the company, whether or not the employee is in the structure.

Endpoint

GET https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.

No request body. Don't send effectiveDate — on this path it creates the structure instead of returning it.

Example request

require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct`;

async function getOrgStructure() {
  const response = await fetch(url, {
    method: "GET",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  console.log(response.status);
  const raw = await response.text();
  console.log(JSON.stringify(JSON.parse(raw), null, 2));
}

getOrgStructure();
curl -s -X GET "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0" | jq .

Example response

This response reflects the running example after the Add steps. The first five entries are in the structure. The last two, Hannah Weber and Oliver Reyes, are not.

[
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "nodeId": 2311,
    "parentNodeId": 0,
    "employeeId": 4401,
    "employeeUI_ID": 1,
    "firstName": "Elena",
    "lastName": "Marsh",
    "hireDate": "2026-01-05T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-2204",
    "division": "",
    "department": "",
    "position": "",
    "level": 1,
    "nodePath": "/2311/",
    "parentNodePath": "/"
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "nodeId": 2312,
    "parentNodeId": 2311,
    "employeeId": 4402,
    "employeeUI_ID": 2,
    "firstName": "David",
    "lastName": "Klein",
    "hireDate": "2026-02-02T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-7731",
    "division": "",
    "department": "",
    "position": "",
    "level": 2,
    "nodePath": "/2311/2312/",
    "parentNodePath": "/2311/"
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "nodeId": 2314,
    "parentNodeId": 2312,
    "employeeId": 4403,
    "employeeUI_ID": 3,
    "firstName": "Sofia",
    "lastName": "Alvarez",
    "hireDate": "2026-03-16T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-5518",
    "division": "",
    "department": "",
    "position": "",
    "level": 3,
    "nodePath": "/2311/2312/2314/",
    "parentNodePath": "/2311/2312/"
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "nodeId": 2315,
    "parentNodeId": 2312,
    "employeeId": 4404,
    "employeeUI_ID": 4,
    "firstName": "Priya",
    "lastName": "Patel",
    "hireDate": "2026-05-04T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-0942",
    "division": "",
    "department": "",
    "position": "",
    "level": 3,
    "nodePath": "/2311/2312/2315/",
    "parentNodePath": "/2311/2312/"
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "nodeId": 2313,
    "parentNodeId": 2311,
    "employeeId": 4405,
    "employeeUI_ID": 5,
    "firstName": "Tomas",
    "lastName": "Novak",
    "hireDate": "2026-01-12T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-3367",
    "division": "",
    "department": "",
    "position": "",
    "level": 2,
    "nodePath": "/2311/2313/",
    "parentNodePath": "/2311/"
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "employeeId": 4406,
    "employeeUI_ID": 6,
    "firstName": "Hannah",
    "lastName": "Weber",
    "hireDate": "2026-09-21T00:00:00Z",
    "status": 1,
    "ssnMasked": "***-**-8120",
    "division": "",
    "department": ""
  },
  {
    "orgStructureDate": "2026-10-07T00:00:00Z",
    "employeeId": 4407,
    "employeeUI_ID": 7,
    "firstName": "Oliver",
    "lastName": "Reyes",
    "status": 0,
    "ssnMasked": "***-**-6459",
    "division": "",
    "department": ""
  }
]

Response fields

FieldTypeDescription
orgStructureDatestring (date-time)The effective date of the organization structure.
nodeIdintegerThe employee's node ID. Use it as NODE_ID in the endpoints on this page. Omitted if the employee is not in the structure.
parentNodeIdintegerThe nodeId of the parent node. 0 for a top-level node. Omitted if the employee is not in the structure.
employeeIdintegerThe employee's id. Use it as EMPLOYEE_ID.
employeeUI_IDintegerThe employee's employeeUI_ID, as returned by List Employees.
firstNamestringEmployee's first name.
lastNamestringEmployee's last name.
hireDatestring (date-time)Employee's hire date. Omitted if the employee has no hire date.
statusintegerEmployee status. Uses the same values as status in List Employees.
ssnMaskedstringThe masked SSN, for display. The full SSN is not returned by this endpoint.
divisionstringThe employee's division. Empty string if not set.
departmentstringThe employee's department. Empty string if not set.
positionstringThe employee's position. Empty string if not set. Omitted if the employee is not in the structure.
levelintegerDepth of the node. 1 is a top-level node. Omitted if the employee is not in the structure.
nodePathstringThe IDs of the node and all its ancestors, from the top level down, each followed by /. For example, /2311/2312/2314/. Omitted if the employee is not in the structure.
parentNodePathstringThe nodePath of the parent node. / for a top-level node. Omitted if the employee is not in the structure.

Notes on the response

  • Employees outside the structure have no node fields. Hannah Weber and Oliver Reyes have no nodeId, parentNodeId, level, nodePath, parentNodePath, or position. An entry without nodeId is not in the structure.
  • Build the tree from parentNodeId. Group entries by parentNodeId and start from 0. Don't rely on array position.
  • ssnMasked can come back in different masks. Treat it as display text. Don't parse it.

Move a Node

Moves a node, together with all of its subordinates, under a new parent node. Use newParentNodeId=0 to move the node to the top level.

Endpoint

PATCH https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}?newParentNodeId={NODE_ID}
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
NODE_IDintegerYesThe nodeId of the node to move. This is a node ID, not an employee ID. Path parameter.
newParentNodeIdintegerYesThe nodeId of the new parent. 0 moves the node to the top level. Query parameter.

No request body. Send newParentNodeId in the query string.

Example request

This example moves David Klein's node (2312) under Tomas Novak's node (2313). Sofia Alvarez and Priya Patel report to David, so they move with him.

Before:

Elena Marsh
├── David Klein
│   ├── Sofia Alvarez
│   └── Priya Patel
└── Tomas Novak

After:

Elena Marsh
└── Tomas Novak
    └── David Klein
        ├── Sofia Alvarez
        └── Priya Patel
require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const NODE_ID = 2312;
const NEW_PARENT_NODE_ID = 2313;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct/${NODE_ID}?newParentNodeId=${NEW_PARENT_NODE_ID}`;

async function moveNode() {
  const response = await fetch(url, {
    method: "PATCH",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  // A successful move returns 204 with no body, so there is nothing to parse.
  console.log(response.status);
}

moveNode();
curl -s -o /dev/null -w "%{http_code}\n" -X PATCH \
  "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct/2312?newParentNodeId=2313" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0"

Example response

204 No Content

A successful move returns 204 with no response body. Don't parse the body of a 204 response as JSON.


Swap Employees

Swaps the positions of two employees in the structure.

🚧

Not documented yet. This endpoint's details haven't been confirmed.

Endpoint

POST https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}/swap?employeeId={EMPLOYEE_ID}
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
NODE_IDintegerYesThe nodeId of the node whose employee is swapped. This is a node ID, not an employee ID. Path parameter.
employeeIdintegerYesThe id of the employee to swap with. This is an employee ID, not a node ID. Query parameter.

No request body. Send employeeId in the query string.

Notes:

  • Employee doesn't have to already be in the structure. When Employee that is not in the sctructure is swapped with one that is employee is removed from the structure.
  • Subordinates don't move, they stay and get attached to the new employee.
  • NodeId stay with the employee, changing employee A with employee B doesn't swap their nodeIds.

Example request

This example swaps Sofia Alvarez (node 2314) with Priya Patel (employee 4404). Both report to David Klein and neither has subordinates, so the structure in the other examples on this page stays valid.

require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const NODE_ID = 2314;
const EMPLOYEE_ID = 4404;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct/${NODE_ID}/swap?employeeId=${EMPLOYEE_ID}`;

async function swapEmployees() {
  const response = await fetch(url, {
    method: "POST",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  // A successful swap returns 204 with no body, so there is nothing to parse.
  console.log(response.status);
}

swapEmployees();
curl -s -o /dev/null -w "%{http_code}\n" -X POST \
  "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct/2314/swap?employeeId=4404" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0"

Example response

204 No Content

A successful swap returns 204 with no response body. Don't parse the body of a 204 response as JSON. To see the result, call Get the Organization Structure.

Errors response

Access will be denied when you try to access employee from different company, accessing node from different company or accessing employee record that doesn't exist.

{
  status: 0,
  code: '400',
  errorCode: 'AccessDenied',
  message: '10/7/2026 - 3:27:30 PM : Access Denied',
  stackTrace: '',
  pagination: {
    pageNo: 0,
    pageSize: 0,
    totalRecords: 0,
    totalPages: 0,
    dataToken: ''
  },
  validationErrors: null
}
{
  status: 0,
  code: '400',
  errorCode: 'ClientEmployeeNotFound',
  message: '10/8/2026 - 9:25:36 AM : Employee not found.',
  stackTrace: '',
  pagination: {
    pageNo: 0,
    pageSize: 0,
    totalRecords: 0,
    totalPages: 0,
    dataToken: ''
  },
  validationErrors: null
}
{
  status: 0,
  code: '400',
  errorCode: 'WEP_BadRequest',
  message: '10/8/2026 - 9:26:27 AM : Unauthorized Company.',
  stackTrace: '',
  pagination: {
    pageNo: 0,
    pageSize: 0,
    totalRecords: 0,
    totalPages: 0,
    dataToken: ''
  },
  validationErrors: null
}


Remove a Node

Removes a node from the structure. Use includeSubordinates to choose what happens to the node's subordinates.

includeSubordinatesWhat happens
false (default)The node is removed. Its subordinates stay in the structure and are attached to the removed node's parent.
trueThe node and all of its subordinates are removed.

Removing a node takes the employee out of the structure. It doesn't terminate or delete the employee.

Endpoint

DELETE https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/{NODE_ID}?includeSubordinates={true|false}
ParameterTypeRequiredDescription
CLIENT_IDintegerYesThe company's id. Path parameter.
NODE_IDintegerYesThe nodeId of the node to remove. This is a node ID, not an employee ID. Path parameter.
includeSubordinatesbooleanNotrue also removes all of the node's subordinates. Defaults to false. Query parameter.

No request body.

Example request

All three outcomes below start from the structure after Move a Node:

Elena Marsh
└── Tomas Novak
    └── David Klein
        ├── Sofia Alvarez
        └── Priya Patel

This example removes David Klein's node (2312) and keeps his subordinates. Sofia Alvarez and Priya Patel are attached to David's parent, Tomas Novak.

Result with includeSubordinates=false:

Elena Marsh
└── Tomas Novak
    ├── Sofia Alvarez
    └── Priya Patel
require("dotenv").config();

const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const NODE_ID = 2312;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/orgstruct/${NODE_ID}`;

async function removeNode() {
  const response = await fetch(url, {
    method: "DELETE",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    }
  });

  // A successful delete returns 204 with no body, so there is nothing to parse.
  console.log(response.status);
}

removeNode();
curl -s -o /dev/null -w "%{http_code}\n" -X DELETE \
  "https://api.worklio.com/wep/companies/$CLIENT_ID/orgstruct/2312" \
  -H "accept: application/json" \
  -H "api-version: 2.0" \
  -H "authorization: Bearer $API_KEY" \
  -H "content-type: application/json" \
  -H "x-api-version: 2.0"

Remove a node and its subordinates

To remove David Klein, Sofia Alvarez, and Priya Patel in one call, add includeSubordinates=true:

DELETE https://api.worklio.com/wep/companies/{CLIENT_ID}/orgstruct/2312?includeSubordinates=true

Result with includeSubordinates=true:

Elena Marsh
└── Tomas Novak

The three removed employees are no longer in the structure. Get the Organization Structure still returns them, without node fields.

Example response

204 No Content

A successful delete returns 204 with no response body. Don't parse the body of a 204 response as JSON.


Errors

Only one error response has been captured for these endpoints.

HTTP statuserrorCodeMessageEndpointCauseFix
400EeOrgStructureNotFoundAn Employee Organization Structure record not found.Add an EmployeenewParentNodeId is not the ID of an existing node.Get node IDs from Get the Organization Structure, or use the node ID returned by Add an Employee.

Related


Did this page help you?