(covers information from several alternate timelines)
In early science fiction writing, the idea of a robot tended to include thinking machines that could perform independent judgments. Later, this was revised to the idea of an android and the notion of robots became limited to less advanced forms of machines. The basis for this change is generally credited to Isaac Asimov who, though referring to them as robots, created characters who were far more intelligent than Humans and operated according to the "Three Laws of Robotics" which later became the accepted basis for many characteristics of android behavior.
In 2259 of the alternate reality, James T. Kirk declared that he was not going to take ethics lessons from a robot, namely Spock, after the Vulcan tried to explain why firing advanced long-range torpedoes at "John Harrison" and Qo'noS was unacceptable. (Star Trek Into Darkness)
In 2268, upon Ensign Harper's death at the hands of the M-5 multitronic unit, Kirk became upset, saying that unlike the unmanned ore freighter it had previously destroyed, the ensign wasn't a robot. (TOS: "The Ultimate Computer")
In 2364, L.Q. Clemonds, upon hearing Commander William T. Riker refer to Lieutenant Commander Data as an android, asked if he meant a robot. To this, Data responded that there was a distinct difference between an android and a robot. (TNG: "The Neutral Zone")
In 2369, the exocomps, a type of highly advanced industrial and utility robots began displaying signs of sentience and self-preservation. The Federation later recognized the exocomps as artificial lifeforms, and in 2380, at least one exocomp served as an ensign in Starfleet. (TNG: "The Quality of Life"; LD: "No Small Parts")