The most direct way to interact with the QGIS API (short for Application Programming Interface) is through the Python Console, which can be opened by going to Plugins | Python Console. As you can see in the following screenshot, the Python Console is displayed within a new panel below the map:
Our access point for interaction with the application, project, and data is the
iface object. To get a list of all the functions available for
help(iface). Alternatively, this information is available online in the API documentation at http://qgis.org/api/classQgisInterface.html.