If you try the Explorer API at the bottom of the page, you will see that only the message identifier is listed in the listing messages.
answer
{
"messages": [
{
"id": "1527ddcca0fd0e08",
"threadId": "1525a22606f6d608"
},
{
"id": "1527d0e3b13fab83",
"threadId": "152792b4f30977ae"
}, ...
],
"nextPageToken": "13090329777308767238",
"resultSizeEstimate": 100
}
You need to receive these messages individually with a message identifier, which you can try here :
answer
{
"id": "1527ddcca0fd0e08",
"threadId": "1525a22606f6d608",
"labelIds": [
"INBOX",
"IMPORTANT",
"CATEGORY_FORUMS"
],
"historyId": "721186",
"internalDate": "1453810567000",
"payload": {
"mimeType": "multipart/alternative",
"filename": "", ...
As you can see, this answer contains labelIds.
Example (only receiving the first message)
$messages = $service->users_messages->listUsersMessages('me', ['q' => 'newer_than:1d in:anywhere']);
$list = $messages->getMessages();
$messageId = $list[0]->getId();
$message = $service->users_messages->get('me', $messageId, ['format' => 'full']);
$labelIds = $message->getLabelIds();
source
share