This document proposes a smart M2M gateway-based architecture for managing M2M devices and endpoints. It uses a lightweight CoRE Link description and SenML-based metadata exchange. The architecture includes an ETSI-based IoT reference model with the M2M gateway in the middle. Configuration resources are described and can be accessed by a mobile client application. The architecture leverages relevant FI-WARE generic enablers for IoT gateway functions, backend services, data management and interfaces to networks and devices. The performance is evaluated to address scalability for large numbers of M2M devices and endpoints.