Method: users.messages.list
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
उपयोगकर्ता के मेलबॉक्स में मौजूद मैसेज की सूची दिखाता है. इसका इस्तेमाल करने का उदाहरण देखने के लिए, Gmail मैसेज की सूची देखें.
एचटीटीपी अनुरोध
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messages
यूआरएल में gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल किया गया है.
पाथ पैरामीटर
पैरामीटर |
userId |
string
उपयोगकर्ता का ईमेल पता. पुष्टि किए गए उपयोगकर्ता की जानकारी देने के लिए, खास वैल्यू me का इस्तेमाल किया जा सकता है.
|
क्वेरी पैरामीटर
पैरामीटर |
maxResults |
integer (uint32 format)
कितने मैसेज दिखाने हैं. यह फ़ील्ड डिफ़ॉल्ट रूप से 100 पर सेट होता है. इस फ़ील्ड के लिए ज़्यादा से ज़्यादा वैल्यू 500 है.
|
pageToken |
string
सूची में नतीजों के किसी खास पेज को वापस लाने के लिए पेज टोकन.
|
q |
string
सिर्फ़ तय की गई क्वेरी से मैच होने वाले मैसेज दिखाता है. यह Gmail के खोज बॉक्स की तरह ही क्वेरी फ़ॉर्मैट के साथ काम करता है. उदाहरण के लिए, "from:someuser@example.com rfc822msgid:<somemsgid@example.com>
is:unread" . gmail.metadata स्कोप का इस्तेमाल करके, एपीआई को ऐक्सेस करते समय पैरामीटर का इस्तेमाल नहीं किया जा सकता.
|
labelIds[] |
string
सिर्फ़ उन लेबल वाले मैसेज दिखाता है जो दिए गए सभी लेबल आईडी से मेल खाते हैं. किसी थ्रेड में मौजूद मैसेज में ऐसे लेबल हो सकते हैं जो उसी थ्रेड के अन्य मैसेज में नहीं हैं. ज़्यादा जानने के लिए, मैसेज और थ्रेड पर लेबल मैनेज करना लेख पढ़ें.
|
includeSpamTrash |
boolean
नतीजों में SPAM और TRASH के मैसेज शामिल करें.
|
अनुरोध का मुख्य भाग
अनुरोध का मुख्य हिस्सा खाली होना चाहिए.
जवाब का मुख्य भाग
अगर एपीआई सही से जुड़ जाता है, ताे जवाब के मुख्य भाग में नीचे दिए गए स्ट्रक्चर शामिल होता है.
JSON के काेड में दिखाना |
{
"messages": [
{
object (Message )
}
],
"nextPageToken": string,
"resultSizeEstimate": integer
} |
फ़ील्ड |
messages[] |
object (Message )
मैसेज की सूची. ध्यान दें कि हर मैसेज रिसॉर्स में सिर्फ़ एक id और एक threadId होता है. messages.get मेथड का इस्तेमाल करके, मैसेज की ज़्यादा जानकारी फ़ेच की जा सकती है.
|
nextPageToken |
string
सूची में नतीजों का अगला पेज पाने के लिए टोकन.
|
resultSizeEstimate |
integer (uint32 format)
नतीजों की अनुमानित कुल संख्या.
|
अनुमति के दायरे
इसके लिए, OAuth के इनमें से किसी एक स्कोप की ज़रूरत होती है:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/gmail.metadata
ज़्यादा जानकारी के लिए, अनुमति से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया."],[],[],null,["# Method: users.messages.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListMessagesResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nLists the messages in the user's mailbox. For example usage, see [List Gmail messages](https://developers.google.com/workspace/gmail/api/guides/list-messages).\n\n### HTTP request\n\n`GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messages`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------|\n| `userId` | `string` The user's email address. The special value `me` can be used to indicate the authenticated user. |\n\n### Query parameters\n\n| Parameters ||\n|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `maxResults` | `integer (`[uint32](https://developers.google.com/discovery/v1/type-format)` format)` Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500. |\n| `pageToken` | `string` Page token to retrieve a specific page of results in the list. |\n| `q` | `string` Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `\"from:someuser@example.com rfc822msgid:\u003csomemsgid@example.com\u003e is:unread\"`. Parameter cannot be used when accessing the api using the gmail.metadata scope. |\n| `labelIds[]` | `string` Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't have. To learn more, see [Manage labels on messages and threads](https://developers.google.com/workspace/gmail/api/guides/labels#manage_labels_on_messages_threads). |\n| `includeSpamTrash` | `boolean` Include messages from `SPAM` and `TRASH` in the results. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"messages\": [ { object (/workspace/gmail/api/reference/rest/v1/users.messages#Message) } ], \"nextPageToken\": string, \"resultSizeEstimate\": integer } ``` |\n\n| Fields ||\n|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `messages[]` | `object (`[Message](/workspace/gmail/api/reference/rest/v1/users.messages#Message)`)` List of messages. Note that each message resource contains only an `id` and a `threadId`. Additional message details can be fetched using the [messages.get](/workspace/gmail/api/v1/reference/users/messages/get) method. |\n| `nextPageToken` | `string` Token to retrieve the next page of results in the list. |\n| `resultSizeEstimate` | `integer (`[uint32](https://developers.google.com/discovery/v1/type-format)` format)` Estimated total number of results. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://mail.google.com/`\n- `\n https://www.googleapis.com/auth/gmail.modify`\n- `\n https://www.googleapis.com/auth/gmail.readonly`\n- `\n https://www.googleapis.com/auth/gmail.metadata`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]