Gmail API Overview Stay organized with collections Save and categorize content based on your preferences.
The Gmail API is a RESTful API that can be used to access Gmail mailboxes andsend mail. For most web applications the Gmail API is the best choice forauthorized access to a user's Gmail data and is suitable for variousapplications, such as:
- Read-only mail extraction, indexing, and backup
- Automated or programmatic message sending
- Email account migration
- Email organization including filtering and sorting of messages
- Standardization of email signatures across an organization
Following is a list of common terms used in the Gmail API:
- Message
- An email message containing the sender, recipients, subject, and body. After amessage has been created, a message cannot be changed. A message is representedby amessage resource.
- Thread
- A collection of related messages forming a conversation. In an email clientapp, a thread is formed when one or more recipients respond to a message withtheir own message.
- Label
A mechanism for organizing messages and threads. For example,the label "taxes" might be created and applied to all messages and threadshaving to do with a user's taxes. There are two types of labels:
- System labels
- Internally-created labels, such as
INBOX,TRASH, orSPAM. These labelscannot be deleted or modified. However, some system labels, such asINBOXcan be applied to, or removed from, messages and threads. - User labels
- Labels created by a user. These labels can be deleted or modified by theuser or an application. A user label is represented by alabel resource.
- Draft
An unsent message. A message contained within the draft can be replaced.Sending a draft automatically deletes the draft and creates a message withthe
SENTsystem label. A draft is represented by adraft resource.
Next steps
To learn about developing with Google Workspace APIs, including handlingauthentication and authorization, refertoGet started as a Google Workspace developer.
To learn how to configure and run a simple Gmail API app, read theQuickstarts overview.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.