---
updatedAt: 2025-04-22T20:06:54.000Z
agentTools:
  projectIndex: https://email.opensrs.guide/v1.0/llms.txt
---

# restore_deleted_contacts

The **restore_deleted_contacts** method restores deleted contacts for a specified user.

To get a list of the contacts that can be restored, use the [get\_deleted\_contacts](https://api-opensrs-email.readme.io/v1.0/docs/get_deleted_contacts?bypass=8272e34bb5) method.

## Syntax

```perl
{
    <credentials object>, 
    "user": <mailbox_name>, 
    "ids": ["list of ids"}
}
```

## Request fields for restore\_deleted\_contacts

The following fields can be used in the **restore\_deleted\_contacts** method:

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Field name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Definition/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        ids
      </td>

      <td>
        Required
      </td>

      <td>
        The IDs for the messages that you want to restore.

        To get a list of the messages that can be restored, use the [get\_deleted\_contacts](https://api-opensrs-email.readme.io/v1.0/docs/get_deleted_contacts?bypass=8272e34bb5) method.
      </td>
    </tr>

    <tr>
      <td>
        user
      </td>

      <td>
        Required
      </td>

      <td>
        The name of the mailbox.
      </td>
    </tr>
  </tbody>
</Table>

## Response fields for restore\_deleted\_contacts

The following fields may be returned in response to the **restore\_deleted\_contacts** method:

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Field name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Obligation/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        error
      </td>

      <td>
        Returned if **success = false**
      </td>

      <td>
        A text string that explains the error.
      </td>
    </tr>

    <tr>
      <td>
        A text string that explains the error.
      </td>

      <td>
        Returned if **success = false**
      </td>

      <td>
        A number that represents the error.
      </td>
    </tr>

    <tr>
      <td>
        ids
      </td>

      <td>
        Returned if success = true
      </td>

      <td>
        Contains a list of the contacts and indicates whether each one was successfully restored or not. Includes the following:

        * **error**—A text string that explains the error.

        * **error\_number**—A number that represents the error. 

        * **id**—The contact id number.

        * **success**—Indicates whether this contact was restored or not. Allowed values are true and false.
      </td>
    </tr>

    <tr>
      <td>
        success
      </td>

      <td>
        Always returned
      </td>

      <td>
        Indicates whether the request was successful or not. Allowed values are **true** and **false**.
      </td>
    </tr>
  </tbody>
</Table>

## Examples for restore\_deleted\_contacts

This example tries to restore some deleted contacts for <joe_user@example.com> - one that exists and one that does not.

**Request**

```perl
{
  "credentials": {
    "user": "domain_admin@example.com",
    "password": "pencil75"
  },
  "user": "joe_user@example.com",
  "ids": [
    "1321909823__1321909700169",
    "1321909823__1321909700180"
  ]
}
```

**Response**

```perl
{
  "success": true,
  "ids": [
    {
      "success": true,
      "id": "1321909823__1321909700169"
		}, 
		{
			"success": false,
			"error_number": 2,
      "error": "The requested object does not exist",
      "id": "1321909823__1321909700180"
    }
	] 
}
```