API create and change task state