Gmail API
  1. users
Gmail API
  • users
    • /gmail/v1/users/{userId}/drafts
      GET
    • /gmail/v1/users/{userId}/drafts
      POST
    • /gmail/v1/users/{userId}/drafts/send
      POST
    • /gmail/v1/users/{userId}/drafts/{id}
      DELETE
    • /gmail/v1/users/{userId}/drafts/{id}
      GET
    • /gmail/v1/users/{userId}/drafts/{id}
      PUT
    • /gmail/v1/users/{userId}/history
      GET
    • /gmail/v1/users/{userId}/labels
      GET
    • /gmail/v1/users/{userId}/labels
      POST
    • /gmail/v1/users/{userId}/labels/{id}
      DELETE
    • /gmail/v1/users/{userId}/labels/{id}
      GET
    • /gmail/v1/users/{userId}/labels/{id}
      PATCH
    • /gmail/v1/users/{userId}/labels/{id}
      PUT
    • /gmail/v1/users/{userId}/messages
      GET
    • /gmail/v1/users/{userId}/messages
      POST
    • /gmail/v1/users/{userId}/messages/batchDelete
      POST
    • /gmail/v1/users/{userId}/messages/batchModify
      POST
    • /gmail/v1/users/{userId}/messages/import
      POST
    • /gmail/v1/users/{userId}/messages/send
      POST
    • /gmail/v1/users/{userId}/messages/{id}
      DELETE
    • /gmail/v1/users/{userId}/messages/{id}
      GET
    • /gmail/v1/users/{userId}/messages/{id}/modify
      POST
    • /gmail/v1/users/{userId}/messages/{id}/trash
      POST
    • /gmail/v1/users/{userId}/messages/{id}/untrash
      POST
    • /gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}
      GET
    • /gmail/v1/users/{userId}/profile
      GET
    • /gmail/v1/users/{userId}/settings/autoForwarding
      GET
    • /gmail/v1/users/{userId}/settings/autoForwarding
      PUT
    • /gmail/v1/users/{userId}/settings/cse/identities
      GET
    • /gmail/v1/users/{userId}/settings/cse/identities
      POST
    • /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}
      DELETE
    • /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}
      GET
    • /gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}
      PATCH
    • /gmail/v1/users/{userId}/settings/cse/keypairs
      GET
    • /gmail/v1/users/{userId}/settings/cse/keypairs
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}
      GET
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate
      POST
    • /gmail/v1/users/{userId}/settings/delegates
      GET
    • /gmail/v1/users/{userId}/settings/delegates
      POST
    • /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}
      GET
    • /gmail/v1/users/{userId}/settings/filters
      GET
    • /gmail/v1/users/{userId}/settings/filters
      POST
    • /gmail/v1/users/{userId}/settings/filters/{id}
      DELETE
    • /gmail/v1/users/{userId}/settings/filters/{id}
      GET
    • /gmail/v1/users/{userId}/settings/forwardingAddresses
      GET
    • /gmail/v1/users/{userId}/settings/forwardingAddresses
      POST
    • /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}
      GET
    • /gmail/v1/users/{userId}/settings/imap
      GET
    • /gmail/v1/users/{userId}/settings/imap
      PUT
    • /gmail/v1/users/{userId}/settings/language
      GET
    • /gmail/v1/users/{userId}/settings/language
      PUT
    • /gmail/v1/users/{userId}/settings/pop
      GET
    • /gmail/v1/users/{userId}/settings/pop
      PUT
    • /gmail/v1/users/{userId}/settings/sendAs
      GET
    • /gmail/v1/users/{userId}/settings/sendAs
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      PATCH
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      PUT
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}
      DELETE
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify
      POST
    • /gmail/v1/users/{userId}/settings/vacation
      GET
    • /gmail/v1/users/{userId}/settings/vacation
      PUT
    • /gmail/v1/users/{userId}/stop
      POST
    • /gmail/v1/users/{userId}/threads
      GET
    • /gmail/v1/users/{userId}/threads/{id}
      DELETE
    • /gmail/v1/users/{userId}/threads/{id}
      GET
    • /gmail/v1/users/{userId}/threads/{id}/modify
      POST
    • /gmail/v1/users/{userId}/threads/{id}/trash
      POST
    • /gmail/v1/users/{userId}/threads/{id}/untrash
      POST
    • /gmail/v1/users/{userId}/watch
      POST
  1. users

/gmail/v1/users/{userId}/threads

GET
/gmail/v1/users/{userId}/threads
users
Lists the threads in the user's mailbox.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://gmail.googleapis.com//gmail/v1/users//threads'
Response Response Example
{
  "nextPageToken": "string",
  "resultSizeEstimate": 0,
  "threads": [
    {
      "historyId": "string",
      "id": "string",
      "messages": [
        {
          "historyId": "string",
          "id": "string",
          "internalDate": "string",
          "labelIds": [
            "string"
          ],
          "payload": {
            "body": {
              "attachmentId": "string",
              "data": "string",
              "size": 0
            },
            "filename": "string",
            "headers": [
              {
                "name": "string",
                "value": "string"
              }
            ],
            "mimeType": "string",
            "partId": "string",
            "parts": [
              {}
            ]
          },
          "raw": "string",
          "sizeEstimate": 0,
          "snippet": "string",
          "threadId": "string"
        }
      ],
      "snippet": "string"
    }
  ]
}

Request

Path Params
userId
string 
required
The user's email address. The special value me can be used to indicate the authenticated user.
Query Params
includeSpamTrash
string 
optional
Include threads from SPAM and TRASH in the results.
labelIds
array[string]
optional
Only return threads with labels that match all of the specified label IDs.
maxResults
integer 
optional
Maximum number of threads to return. This field defaults to 100. The maximum allowed value for this field is 500.
pageToken
string 
optional
Page token to retrieve a specific page of results in the list.
q
string 
optional
Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope.

Responses

🟢200Successful response
application/json
Body
nextPageToken
string 
optional
Page token to retrieve the next page of results in the list.
resultSizeEstimate
integer <uint32>
optional
Estimated total number of results.
threads
array[object (Thread) {4}] 
optional
List of threads. Note that each thread resource does not contain a list of messages. The list of messages for a given thread can be fetched using the threads.get method.
historyId
string <uint64>
optional
The ID of the last history record that modified this thread.
id
string 
optional
The unique ID of the thread.
messages
array[object (Message) {9}] 
optional
The list of messages in the thread.
snippet
string 
optional
A short part of the message text.
Modified at 2023-08-15 05:40:23
Previous
/gmail/v1/users/{userId}/stop
Next
/gmail/v1/users/{userId}/threads/{id}
Built with