Generally, NYC landlords must return security deposits within 14 days of the tenancy ending. You could have legal grounds to file a lawsuit for an unreturned deposit if your landlord:
Failed to return your deposit
Was unable to explain any security deposit deductions
Used your deposit wrongfully to cover normal wear and tear
Made excessive deductions
Charged a cleaning fee against the deposit after you already paid a cleaning fee
However, to have a good chance of getting your security deposit, you will need relevant evidence, such as written correspondence with your landlord, witnesses who can testify regarding the apartment’s condition, and other materials. Without evidence, proving that the landlord retained your deposit illegally can be tricky.