Ho to create new ToDo using custom script

Hi,
i want to add todo to assign person on changing workflow state in background using script how i can achieve this ?
Note : i am not using ERPnext

@Rohan_Gaikwad can you ellaborate more like you will create a ToDo with API right?

Thanks for the reply , Yes i want to create ToDo with Api in python .

@Rohan_Gaikwad you can use below snippet for creating ToDo.

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d '{
  "data": {
    "subject": "Your ToDo Subject",
    "description": "Your ToDo Description",
    "status": "Open",  # You can set the initial status
    "owner": "your_user",  # Assign the ToDo to a user
    "doctype": "ToDo"
  }
}' http://your-frappe-instance/api/resource/ToDo