Most historical writers are aware of the Pinkerton Detective Agency and the fictional tales of Sherlock Holmes. Both are from the 19th Century. Below are links and tidbits to other detective related stories and tidbits.
The Revelations of a Private Detective ©1868
Here's a copy of an advertisement for the above story with other detective stories listed.
Chapter Five of Major Joshua is a chapter on the life of the character as a private detective. 1894
Chapter Seven of Sealed Orders is the chapter on a private detective. 1886
Thirty Years A Detective by Allan Pinkerton ©1884
The Adventures of a United States Detective ©1876
Traced and Tracked; or Memoirs of a City Detective ©1884
Hands Up; Or Twenty Years a Detective ©1882
There are many more volumes you can find in Google books if you wish to search further and within your time frame.