The Gmail API is a RESTful API from Google, part of Google Workspace for Developers. A RESTful API is an interface that a program calls over HTTPS, with one address for each kind of resource; here the resources are messages, threads, labels, drafts and mailbox settings.
An application first asks the user for access through OAuth 2.0, a standard in which the user approves named scopes. Each scope is a URI that names the data and the level of access, for example read-only access or the right to send mail. After approval the program can list, search and read messages, add or remove labels, create drafts and send mail. Push notifications through Google Cloud Pub/Sub tell the application when a mailbox changes, so it does not have to poll. The scopes that read mail are restricted, and a public application that uses them must complete Google's verification process. Quickstarts exist for JavaScript, Java, Python, Go, Node.js and Apps Script.
The API is used through a Google Cloud project. Each request costs quota units, with limits per minute; use below a daily threshold is not billed.