diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index a606fda..affe332 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -33,7 +33,7 @@
         time.sleep(client.build_interval)
 
         try:
-            _, zone = client.show_zone(zone_id)
+            zone = client.show_zone(zone_id)[1]
         except lib_exc.NotFound:
             LOG.info('Zone %s is 404ing', zone_id)
             return
@@ -62,12 +62,12 @@
     """Waits for a zone to reach given status."""
     LOG.info('Waiting for zone %s to reach %s', zone_id, status)
 
-    _, zone = client.show_zone(zone_id, headers=headers)
+    zone = client.show_zone(zone_id, headers=headers)[1]
     start = int(time.time())
 
     while zone['status'] != status:
         time.sleep(client.build_interval)
-        _, zone = client.show_zone(zone_id, headers=headers)
+        zone = client.show_zone(zone_id, headers=headers)[1]
         status_curr = zone['status']
         if status_curr == status:
             LOG.info('Zone %s reached %s', zone_id, status)
@@ -98,12 +98,12 @@
     """Waits for an imported zone to reach the given status."""
     LOG.info('Waiting for zone import %s to reach %s', zone_import_id, status)
 
-    _, zone_import = client.show_zone_import(zone_import_id)
+    zone_import = client.show_zone_import(zone_import_id)[1]
     start = int(time.time())
 
     while zone_import['status'] != status:
         time.sleep(client.build_interval)
-        _, zone_import = client.show_zone_import(zone_import_id)
+        zone_import = client.show_zone_import(zone_import_id)[1]
         status_curr = zone_import['status']
         if status_curr == status:
             LOG.info('Zone import %s reached %s', zone_import_id, status)
@@ -131,16 +131,17 @@
             raise lib_exc.TimeoutException(message)
 
 
-def wait_for_zone_export_status(client, zone_export_id, status):
+def wait_for_zone_export_status(client, zone_export_id, status, headers=None):
     """Waits for an exported zone to reach the given status."""
     LOG.info('Waiting for zone export %s to reach %s', zone_export_id, status)
 
-    _, zone_export = client.show_zone_export(zone_export_id)
+    zone_export = client.show_zone_export(zone_export_id, headers=headers)[1]
     start = int(time.time())
 
     while zone_export['status'] != status:
         time.sleep(client.build_interval)
-        _, zone_export = client.show_zone_export(zone_export_id)
+        zone_export = client.show_zone_export(
+            zone_export_id, headers=headers)[1]
         status_curr = zone_export['status']
         if status_curr == status:
             LOG.info('Zone export %s reached %s', zone_export_id, status)
@@ -168,17 +169,20 @@
             raise lib_exc.TimeoutException(message)
 
 
-def wait_for_recordset_status(client, zone_id, recordset_id, status):
+def wait_for_recordset_status(
+        client, zone_id, recordset_id, status, headers=None):
     """Waits for a recordset to reach the given status."""
     LOG.info('Waiting for recordset %s to reach %s',
              recordset_id, status)
 
-    _, recordset = client.show_recordset(zone_id, recordset_id)
+    recordset = client.show_recordset(
+        zone_id, recordset_id, headers=headers)[1]
     start = int(time.time())
 
     while recordset['status'] != status:
         time.sleep(client.build_interval)
-        _, recordset = client.show_recordset(zone_id, recordset_id)
+        recordset = client.show_recordset(
+            zone_id, recordset_id, headers=headers)[1]
         status_curr = recordset['status']
         if status_curr == status:
             LOG.info('Recordset %s reached %s', recordset_id, status)
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index 61c6da0..d4df276 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -125,7 +125,7 @@
 
 
 def rand_recordset_data(record_type, zone_name, name=None, records=None,
-                        ttl=None):
+                        ttl=None, number_of_records=None):
     """Generate random recordset data, with optional overrides
     :return: A RecordsetModel
     """
@@ -133,6 +133,8 @@
         name = rand_zone_name(prefix=record_type, suffix='.' + zone_name)
     if records is None:
         records = [rand_ip()]
+    if number_of_records:
+        records = [rand_ip() for r in range(number_of_records)]
     if ttl is None:
         ttl = rand_ttl()
     return {
diff --git a/designate_tempest_plugin/services/dns/v2/json/recordset_client.py b/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
index d07ca18..4440705 100644
--- a/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
+++ b/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
@@ -35,27 +35,24 @@
 
     @base.handle_errors
     def create_recordset(self, zone_uuid, recordset_data,
-                         params=None, wait_until=False):
+                         params=None, wait_until=False, headers=None):
         """Create a recordset for the specified zone.
-
         :param zone_uuid: Unique identifier of the zone in UUID format..
         :param recordset_data: A dictionary that represents the recordset
                                data.
         :param params: A Python dict that represents the query paramaters to
                        include in the request URI.
+        :param headers (dict): The headers to use for the request.
         :return: A tuple with the server response and the created zone.
         """
         resp, body = self._create_request(
             "/zones/{0}/recordsets".format(zone_uuid), params=params,
-            data=recordset_data)
-
+            data=recordset_data, headers=headers)
         # Create Recordset should Return a HTTP 202
         self.expected_success(202, resp.status)
-
         if wait_until:
             waiters.wait_for_recordset_status(
-                self, zone_uuid, body['id'], wait_until)
-
+                self, zone_uuid, body['id'], wait_until, headers=headers)
         return resp, body
 
     @base.handle_errors
diff --git a/designate_tempest_plugin/services/dns/v2/json/zone_exports_client.py b/designate_tempest_plugin/services/dns/v2/json/zone_exports_client.py
index 1f469ec..5089d36 100644
--- a/designate_tempest_plugin/services/dns/v2/json/zone_exports_client.py
+++ b/designate_tempest_plugin/services/dns/v2/json/zone_exports_client.py
@@ -19,7 +19,8 @@
 class ZoneExportsClient(base.DnsClientV2Base):
 
     @base.handle_errors
-    def create_zone_export(self, uuid, params=None, wait_until=False):
+    def create_zone_export(self, uuid, params=None,
+                           wait_until=False, headers=None):
         """Create a zone export.
 
         :param uuid: Unique identifier of the zone in UUID format.
@@ -27,18 +28,20 @@
                        include in the request URI.
         :param wait_until: Block until the exported zone reaches the
                            desired status
+        :param headers (dict): The headers to use for the request.
         :return: Serialized imported zone as a dictionary.
         """
 
         export_uri = 'zones/{0}/tasks/export'.format(uuid)
         resp, body = self._create_request(
-            export_uri, params=params)
+            export_uri, params=params, headers=headers)
 
         # Create Zone Export should Return a HTTP 202
         self.expected_success(202, resp.status)
 
         if wait_until:
-            waiters.wait_for_zone_export_status(self, body['id'], wait_until)
+            waiters.wait_for_zone_export_status(
+                self, body['id'], wait_until, headers=headers)
 
         return resp, body
 
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_quotas.py b/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
index c5725ed..17fd16f 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
@@ -11,13 +11,16 @@
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 # License for the specific language governing permissions and limitations
 # under the License.
-
+import random
 from oslo_log import log as logging
 from tempest import config
 from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
 
 from designate_tempest_plugin.tests import base
 from designate_tempest_plugin import data_utils as dns_data_utils
+from designate_tempest_plugin.common import constants as const
+
 
 LOG = logging.getLogger(__name__)
 
@@ -28,6 +31,7 @@
 class QuotasV2Test(base.BaseDnsV2Test):
 
     credentials = ['primary', 'admin', 'system_admin', 'alt']
+    test_quota_limit = 3
 
     @classmethod
     def setup_credentials(cls):
@@ -55,7 +59,9 @@
             cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
         cls.quotas_client = cls.os_primary.dns_v2.QuotasClient()
         cls.alt_client = cls.os_alt.dns_v2.QuotasClient()
+        cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
         cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
+        cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
 
     @classmethod
     def resource_setup(cls):
@@ -71,40 +77,203 @@
         cls.admin_tld_client.delete_tld(cls.class_tld[1]['id'])
         super(QuotasV2Test, cls).resource_cleanup()
 
-    @decorators.idempotent_id('6987953a-dccf-11eb-903e-74e5f9e2a801')
-    def test_alt_reaches_zones_quota(self):
-
-        alt_project_id = self.alt_client.project_id
-        http_header = {'x-auth-sudo-project-id': alt_project_id}
-        limit_zones_quota = 3
-
-        LOG.info('As Admin user set Zones quota for Alt user '
-                 'to:{} '.format(limit_zones_quota))
-        quotas = dns_data_utils.rand_quotas()
-        quotas['zones'] = limit_zones_quota
+    def _set_quota_for_project(self, project_id, quotas):
+        http_header = {'x-auth-sudo-project-id': project_id}
         self.admin_client.set_quotas(
-            project_id=alt_project_id, quotas=quotas, headers=http_header)
+            project_id=project_id, quotas=quotas, headers=http_header)
         self.addCleanup(
-            self.admin_client.delete_quotas, project_id=alt_project_id)
+            self.admin_client.delete_quotas,
+            project_id=project_id, headers=http_header)
 
-        LOG.info('As Alt user try to create zones, up untill'
-                 ' "zones" quota (status code 413) is reached')
+    def _reach_quota_limit(
+            self, limit_threshold, quota_type, zone=None):
         attempt_number = 0
-        while attempt_number <= limit_zones_quota + 1:
-            attempt_number += 1
-            LOG.info('Attempt No:{} '.format(attempt_number))
+        not_raised_msg = "Failed, expected '413 over_quota' response of " \
+                         "type:{} wasn't received.".format(quota_type)
+        while attempt_number <= limit_threshold + 1:
             try:
-                zone_name = dns_data_utils.rand_zone_name(
-                    name="alt_reaches_zones_quota", suffix=self.tld_name)
-                zone = self.alt_zone_client.create_zone(name=zone_name)[1]
-                self.addCleanup(
-                    self.wait_zone_delete, self.alt_zone_client, zone['id'])
-            except Exception as err:
-                raised_error = str(err).replace(' ', '')
-                if not "'code':413" and "'type':'over_quota'" in raised_error \
-                        and attempt_number == limit_zones_quota + 1:
-                    raise (
-                        "Failed, expected status code 413 (type:over_quota) "
-                        "was not raised or maybe it has been raised mistakenly"
-                        "(bug) before the quota was actually reached."
-                        " Test failed with: {} ".format(err))
+                attempt_number += 1
+                LOG.info('Attempt No:{} '.format(attempt_number))
+                if quota_type == 'zones_quota':
+                    zone_name = dns_data_utils.rand_zone_name(
+                        name="_reach_quota_limit", suffix=self.tld_name)
+                    zone = self.zone_client.create_zone(
+                        name=zone_name,
+                        description='Test zone for:{}'.format(quota_type))[1]
+                    self.addCleanup(
+                        self.wait_zone_delete,
+                        self.zone_client, zone['id'])
+                else:
+                    if quota_type == 'zone_recordsets':
+                        max_number_of_records = 10
+                        prj_quota = self.admin_client.show_quotas(
+                            project_id=self.zone_client.project_id,
+                            headers=self.all_projects_header)[1][
+                            'zone_records']
+                        if max_number_of_records > prj_quota:
+                            max_number_of_records = prj_quota
+                        recordset_data = dns_data_utils.rand_recordset_data(
+                            record_type='A', zone_name=zone['name'],
+                            number_of_records=random.randint(
+                                1, max_number_of_records))
+                    else:
+                        recordset_data = dns_data_utils.rand_recordset_data(
+                            record_type='A', zone_name=zone['name'])
+                    recordset = self.recordset_client.create_recordset(
+                        zone['id'], recordset_data=recordset_data,
+                        wait_until=const.ACTIVE)[1]
+                    self.addCleanup(
+                        self.wait_recordset_delete,
+                        self.recordset_client,
+                        zone['id'], recordset['id'])
+                self.assertLess(
+                    attempt_number, limit_threshold + 1, not_raised_msg)
+            except Exception as e:
+                raised_err = str(e).replace(' ', '')
+                if not_raised_msg in str(e):
+                    raise AssertionError(not_raised_msg)
+                elif "'code':413" in raised_err and \
+                        "'type':'over_quota'" in raised_err:
+                    LOG.info("OK, type':'over_quota' was raised")
+                    break
+                else:
+                    raise
+
+    @decorators.attr(type='slow')
+    @decorators.idempotent_id('41d9cf2c-866a-11ec-8ccb-201e8823901f')
+    @decorators.skip_because(bug="1960495")
+    def test_api_export_size_quota(self):
+        LOG.info('Admin sets "api_export_size:{}" quota for Primary'
+                 ' user'.format(self.test_quota_limit))
+        quotas = dns_data_utils.rand_quotas()
+        quotas['api_export_size'] = self.test_quota_limit
+        self._set_quota_for_project(
+            self.zone_client.project_id, quotas)
+        LOG.info('Create a Zone, wait until ACTIVE and add:{}'
+                 ' Recordsets'.format(self.test_quota_limit + 1))
+        zone = self.zone_client.create_zone(
+            description='Zone for test_api_export_size_quota',
+            wait_until=const.ACTIVE)[1]
+        self.addCleanup(
+            self.wait_zone_delete,
+            self.zone_client, zone['id'])
+        for i in range(self.test_quota_limit + 1):
+            recordset_data = dns_data_utils.rand_recordset_data(
+                record_type='A', zone_name=zone['name'])
+            LOG.info('Try to create a recordset No:{}'.format(i))
+            recordset = self.recordset_client.create_recordset(
+                zone['id'], recordset_data=recordset_data,
+                wait_until=const.ACTIVE)[1]
+            self.addCleanup(
+                self.wait_recordset_delete,
+                self.recordset_client,
+                zone['id'], recordset['id'])
+        LOG.info(
+            'Ensure that the Number of Recordsets is bigger than configured'
+            ' api_export_size:{}'.format(self.test_quota_limit))
+        number_of_recordsets = len(self.recordset_client.list_recordset(
+            zone['id'])[1]['recordsets'])
+        self.assertGreater(
+            number_of_recordsets, self.test_quota_limit,
+            'Failed, the number of recordsets within a Zone is not enough to'
+            ' trigger "413 over quota" on Zone Export')
+        LOG.info('Try to export Zone. Expected:"413 over_quota"')
+        with self.assertRaisesDns(
+                lib_exc.OverLimit, 'over_quota', 413):
+            self.export_zone_client.create_zone_export(zone['id'])
+
+    @decorators.attr(type='slow')
+    @decorators.idempotent_id('2513cb6e-85ec-11ec-bf7f-201e8823901f')
+    def test_recordset_records_quota(self):
+        LOG.info('Admin sets "recordset_records:{}" quota for Primary'
+                 ' user'.format(self.test_quota_limit))
+        quotas = dns_data_utils.rand_quotas()
+        quotas['recordset_records'] = self.test_quota_limit
+        self._set_quota_for_project(
+            self.zone_client.project_id, quotas)
+        LOG.info('Create a Zone and wait until ACTIVE')
+        zone_name = dns_data_utils.rand_zone_name(
+            name="test_recordset_records_quota", suffix=self.tld_name)
+        zone = self.zone_client.create_zone(
+            name=zone_name,
+            description='Zone for test_recordset_records_quota',
+            wait_until=const.ACTIVE)[1]
+        self.addCleanup(
+            self.wait_zone_delete,
+            self.zone_client, zone['id'])
+        LOG.info(
+            'Create recordset data with:{} records and try to create'
+            ' a recordset. Expected:"413 over_quota"'.format(
+                self.test_quota_limit + 1))
+        recordset_data = dns_data_utils.rand_recordset_data(
+            record_type='A', zone_name=zone['name'],
+            number_of_records=self.test_quota_limit + 1)
+        LOG.info('Try to create a recordset. Expected:"413 over_quota"')
+        with self.assertRaisesDns(
+                lib_exc.OverLimit, 'over_quota', 413):
+            self.recordset_client.create_recordset(
+                zone['id'], recordset_data=recordset_data)
+
+    @decorators.attr(type='slow')
+    @decorators.idempotent_id('893dc648-868d-11ec-8ccb-201e8823901f')
+    def test_zone_records_quota(self):
+        LOG.info('Create a Zone and wait until ACTIVE')
+        zone_name = dns_data_utils.rand_zone_name(
+            name="test_zone_records_quota", suffix=self.tld_name)
+        zone = self.zone_client.create_zone(
+            name=zone_name,
+            description='Zone for test_zone_records_quota',
+            wait_until=const.ACTIVE)[1]
+        self.addCleanup(
+            self.wait_zone_delete,
+            self.zone_client, zone['id'])
+        LOG.info('Admin sets "zone_records:{}" quota for Primary '
+                 'user'.format(self.test_quota_limit))
+        quotas = dns_data_utils.rand_quotas()
+        quotas['zone_records'] = self.test_quota_limit
+        self._set_quota_for_project(
+            self.zone_client.project_id, quotas)
+        LOG.info(
+            'Try to add:{} recordsets (with a single record) to the Zone in'
+            ' loop. Expected:"413 over_quota"'.format(
+                self.test_quota_limit + 1))
+        self._reach_quota_limit(
+            self.test_quota_limit + 1, 'zone_records', zone)
+
+    @decorators.attr(type='slow')
+    @decorators.idempotent_id('f567bdda-86b3-11ec-8ccb-201e8823901f')
+    def test_zone_recordsets_quota(self):
+        LOG.info('Create a Zone and wait until ACTIVE')
+        zone_name = dns_data_utils.rand_zone_name(
+            name="test_zone_recordsets_quota", suffix=self.tld_name)
+        zone = self.zone_client.create_zone(
+            name=zone_name,
+            description='Zone for test_zone_recordsets_quota',
+            wait_until=const.ACTIVE)[1]
+        self.addCleanup(
+            self.wait_zone_delete,
+            self.zone_client, zone['id'])
+        LOG.info('Admin sets "zone_recordsets:{}" quota for Primary '
+                 'user'.format(self.test_quota_limit))
+        quotas = dns_data_utils.rand_quotas()
+        quotas['zone_recordsets'] = self.test_quota_limit
+        self._set_quota_for_project(
+            self.zone_client.project_id, quotas)
+        LOG.info(
+            'Try to add:{} recordsets (with a random number of records) to a'
+            ' Zone in loop. Expected:"413 over_quota"'.format(
+                self.test_quota_limit + 1))
+        self._reach_quota_limit(
+            self.test_quota_limit + 1,
+            'zone_recordsets', zone)
+
+    @decorators.attr(type='slow')
+    @decorators.idempotent_id('6987953a-dccf-11eb-903e-74e5f9e2a801')
+    def test_zones_quota(self):
+        LOG.info('Admin sets "zones" quota for Primary user')
+        quotas = dns_data_utils.rand_quotas()
+        quotas['zones'] = self.test_quota_limit
+        self._set_quota_for_project(
+            self.zone_client.project_id, quotas)
+        LOG.info('Try to create Zones. Expected:"413 over_quota"')
+        self._reach_quota_limit(self.test_quota_limit, 'zones_quota')
