N.Y. RPP. LAW § 223-b : NY Code - Section 223-B: Retaliation by landlord against tenant

1. No landlord of
  premises or units to which this section is applicable shall serve a  no-
  tice  to  quit  upon  any  tenant or commence any action to recover real
  property or summary proceeding to recover possession of real property in
  retaliation for:
    a. A good faith complaint, by  or  in  behalf  of  the  tenant,  to  a
  governmental authority of the landlord's alleged violation of any health
  or  safety law, regulation, code, or ordinance, or any law or regulation
  which has as its objective the regulation of premises used for  dwelling
  purposes  or which pertains to the offense of rent gouging in the third,
  second or first degree; or
    b. Actions taken in good faith, by or in  behalf  of  the  tenant,  to
  secure  or enforce any rights under the lease or rental agreement, under
  section two hundred thirty-five-b of this chapter, or  under  any  other
  law of the state of New York, or of its governmental subdivisions, or of
  the  United States which has as its objective the regulation of premises
  used for dwelling purposes or which pertains  to  the  offense  of  rent
  gouging in the third, second or first degree; or
    c.  The  tenant's  participation  in  the  activities  of  a  tenant's
  organization.
    2. No  landlord  or  premises  or  units  to  which  this  section  is
  applicable  shall  substantially  alter  the  terms  of  the  tenancy in
  retaliation for any actions set forth in  paragraphs  a,  b,  and  c  of
  subdivision  one  of this section. Substantial alteration shall include,
  but is not limited to, the refusal to continue a tenancy of  the  tenant
  or, upon expiration of the tenant's lease, to renew the lease or offer a
  new  lease;  provided,  however,  that  a landlord shall not be required
  under this section to offer a new lease or a lease renewal  for  a  term
  greater than one year and after such extension of a tenancy for one year
  shall not be required to further extend or continue such tenancy.
    3. A landlord shall be subject to a civil action for damages and other
  appropriate  relief,  including injunctive and other equitable remedies,
  as may be determined by a court of competent jurisdiction in any case in
  which the landlord has violated the provisions of this section.
    4. In any action to recover real property  or  summary  proceeding  to
  recover  possession  of real property, judgment shall be entered for the
  tenant if the court finds that the landlord is acting in retaliation for
  any action set forth in paragraphs a, b, and c  of  subdivision  one  of
  this  section  and  further  finds that the landlord would not otherwise
  have commenced such action or proceeding. Retaliation shall be  asserted
  as an affirmative defense in such action or proceeding. The tenant shall
  not  be  relieved  of  the  obligation  to  pay any rent for which he is
  otherwise liable.
    5. In an action or proceeding instituted against a tenant of  premises
  or  a unit to which this section is applicable, a rebuttable presumption
  that the landlord is acting in  retaliation  shall  be  created  if  the
  tenant  establishes  that  the  landlord  served  a  notice  to quit, or
  instituted an action or proceeding to recover possession,  or  attempted
  to  substantially  alter  the  terms  of  the tenancy, within six months
  after:
    a. A good faith complaint was made, by or in behalf of the tenant,  to
  a  governmental  authority  of the landlord's violation of any health or
  safety law, regulation, code, or ordinance, or  any  law  or  regulation
  which  has as its objective the regulation of premises used for dwelling
  purposes or which pertains to the offense of rent gouging in the  third,
  second or first degree; or
    b.  The  tenant  in  good faith commenced an action or proceeding in a
  court or administrative body of  competent  jurisdiction  to  secure  or

  enforce against the landlord or his agents any rights under the lease or
  rental  agreement,  under  section  two  hundred  thirty-five-b  of this
  chapter, or under any other law of the state of  New  York,  or  of  its
  governmental  subdivisions,  or  of  the  United States which has as its
  objective the regulation of premises used for dwelling purposes or which
  pertains to the offense of rent gouging in the third,  second  or  first
  degree.
    c.  Judgment  under  subdivision  three  or  four  of this section was
  entered for the tenant in a previous action between the parties;  or  an
  inspection  was made, an order was entered, or other action was taken as
  a result of a complaint or act described in paragraph a  or  b  of  this
  subdivision.
    But  the  presumption shall not apply in an action or proceeding based
  on the violation by the tenant of the terms and conditions of the  lease
  or rental agreement, including nonpayment of the agreed-upon rent.
    The  effect  of  the  presumption  shall be to require the landlord to
  provide a credible explanation of a non-retaliatory motive for his acts.
  Such an explanation shall overcome and remove the presumption unless the
  tenant disproves it by a preponderance of the evidence.
    5-a. Any lease provision which seeks  to  assess  a  fee,  penalty  or
  dollar  charge, in addition to the stated rent, against a tenant because
  such tenant files a bona fide complaint with  a  building  code  officer
  regarding  the  condition of such tenant's leased premises shall be null
  and void as being against public policy. A landlord who seeks to enforce
  such a fee, penalty or charge shall be liable to the tenant  for  triple
  the amount of such fee, penalty or charge.
    6.  This section shall apply to all rental residential premises except
  owner-occupied  dwellings  with  less  than  four  units.  However,  its
  provisions  shall  not  be  given  effect  in  any  case  in which it is
  established that the condition from which the complaint or action  arose
  was caused by the tenant, a member of the tenant's household, or a guest
  of  the  tenant.  Nor  shall  it  apply  in  a  case where a tenancy was
  terminated pursuant to the terms of a lease as a result of a  bona  fide
  transfer of ownership.