When can I write “patent pending?”

As soon as you are awarded an application number by the USPTO (usually immediately upon filing of your application), you should feel free to claim “patent pending.” However, please note that “patent pending” only means that you have filed an application and it does not give you any exclusive rights until a patent is actually granted.