Is there any API to help us upgrade or downgrade the task‘s level ?

for example
before:
WBS ID TEXT
1 1 task1
1.1 2 task1.1
1.2 3 task1.2
2 4 task2
2.1 5 task2.1
2.2 6 task2.2
is there any function maybe like gantt.upgradeLevel(“2”)
then
after:
WBS ID TEXT
1 1 task1
1.1 3 task1.2
2 4 task2
2.1 5 task2.1
2.2 6 task2.2
3 2 task1.1

I found it
gantt.moveTask()

Hi,
you are right, it is a good way to change WBS if you know the task’s id. You also can use Drag-and-drop functionality to change the WBS of the task:
https://docs.dhtmlx.com/gantt/desktop__reordering_tasks.html#dragndropwithinthewholeganttstructure.
Just activate the property order_branch , which allows reordering your tasks vertically within the same tree level. Here is a link:
https://docs.dhtmlx.com/gantt/api__gantt_order_branch_config.html
To reorder tasks within the whole gantt, you should use order_branch_free :
https://docs.dhtmlx.com/gantt/api__gantt_order_branch_free_config.html

Your way is better !
I can only save the change of the parent id after Drag-and-drop, when the grid is refresh from server , there are out of order.
is there any way to save the order after Drag-and-drop?

You’ll need some extra code on the backend in order to save the order of tasks.
Have you checked this article: https://docs.dhtmlx.com/gantt/desktop__server_side.html#storingtheorderoftasks ?
Also, if you check our step-by-step tutorials https://docs.dhtmlx.com/gantt/desktop__guides.html , which has a paragraph Storing the order of tasks which describes the implementation on different platforms.
If this is not what you need, please clarify.