Users.messages: untrash

Removes the specified message from the trash. Try it now or see an example.


HTTP request



Parameter name Value Description
Path parameters
id string The ID of the message to remove from Trash.
userId string The user's email address. The special value me can be used to indicate the authenticated user.


This request requires authorization with at least one of the following scopes:


For more information, see the authentication and authorization page.

Request body

Do not supply a request body with this method.


If successful, this method returns a Users.messages resource in the response body.


Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).


Uses the Java client library.



// ...

public class MyClass {

  // ...

   * Remove the specified message from Trash.
   * @param service Authorized Gmail API instance.
   * @param userId User's email address. The special value "me"
   * can be used to indicate the authenticated user.
   * @param msgId ID of Message to remove from trash.
   * @throws IOException
  public static void untrashMessage(Gmail service, String userId, String msgId)
      throws IOException {
    service.users().messages().untrash(userId, msgId).execute();
    System.out.println("Message with id: " + msgId + " has been untrashed.");

  // ...

Try it!

Use the APIs Explorer below to call this method on live data and see the response.