Get message details

This page explains how to retrieve the details of a single quarantined message with the get method of the customers.quarantinedMessages resource in the Mail Admin Quarantine API. Use it to inspect a message's headers, subject, body, and attachments before you decide whether to release or deny it.

Prerequisites

Get a quarantined message

To get a quarantined message, send a GET request to the get method on the message's resource name and choose how much content to return with the view query parameter:

GET https://mailadminquarantine.googleapis.com/v1/customers/CUSTOMER_ID/quarantinedMessages/MESSAGE_OWNER:MESSAGE_ID?view=MESSAGE_VIEW_DETAILS
Authorization: Bearer ACCESS_TOKEN

Replace the following:

  • CUSTOMER_ID: your customer ID.
  • MESSAGE_OWNER: the email address of the mailbox owner, as returned in the messageOwner field.
  • MESSAGE_ID: the Gmail message ID, as returned in the messageId field.

To find these values, call the list or search method of the customers.quarantinedMessages resource. You can pass the name field from a list or search response directly as the request path, for example https://mailadminquarantine.googleapis.com/v1/customers/01abc23de/quarantinedMessages/user@example.com:18d3ef45a8b2c1d0.

Message views

The view query parameter determines which fields the response includes:

View Returned fields
MESSAGE_VIEW_BASIC (default) Quarantine metadata only: name, messageId, messageOwner, quarantines, receiveTime, direction, state, retentionExpireTime, and triggeredRules.
MESSAGE_VIEW_DETAILS name, messageId, messageOwner, and the parsed content object with subject, body, headers, attachments, labels, and classificationLabelValues.
MESSAGE_VIEW_RAW name, messageId, messageOwner, and rawMessage, the entire message in RFC 2822 format as a base64url-encoded string.

If you omit view, the API returns the basic view. An unrecognized view value returns a 400 INVALID_ARGUMENT error.

Example response

The following response uses view=MESSAGE_VIEW_DETAILS:

{
  "name": "customers/01abc23de/quarantinedMessages/user@example.com:18d3ef45a8b2c1d0",
  "messageId": "18d3ef45a8b2c1d0",
  "messageOwner": "user@example.com",
  "content": {
    "subject": "Urgent: Verify your account details",
    "body": "Please click the link below to verify your login credentials...",
    "headers": [
      {"name": "From", "value": "security-alert@external.example.net"},
      {"name": "To", "value": "user@example.com"},
      {"name": "Date", "value": "Tue, 22 Sep 2026 10:15:00 +0000"},
      {"name": "Subject", "value": "Urgent: Verify your account details"}
    ],
    "attachments": [
      {
        "filename": "invoice_update.pdf",
        "mimeType": "application/pdf",
        "sizeBytes": "142857",
        "attachmentId": "att_987654321"
      }
    ],
    "labels": ["^admin_quarantine"]
  }
}

The following table displays the content fields of a response:

Field Description
content.subject The subject of the message.
content.body The plain-text body or snippet of the message.
content.headers[] The message headers, with MIME-decoded values.
content.attachments[] The filename, MIME type, size in bytes, and ID of each attachment.
content.labels[] Standard Gmail labels applied to the message.
content.classificationLabelValues[] Classification labels applied to the message, if any.

Decode a raw message

With view=MESSAGE_VIEW_RAW, the rawMessage field contains the complete message in RFC 2822 format, encoded as a base64url string. Decode it to analyze the message with standard email tooling, for example:

import base64
import email

raw_message = response.json()['rawMessage']
mime_message = email.message_from_bytes(base64.urlsafe_b64decode(raw_message))
print(mime_message['Subject'])

Next steps