# Web Cloud › Email and Collaborative Solutions › Microsoft Exchange › Hosted Exchange › Devices API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Web Cloud product's sections: https://developers.eu.ovhcloud.com/reference/web-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 4 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices.json?format=openapi3

## Operations

- `GET /email/exchange/{organizationName}/service/{exchangeService}/device` — List devices
- `GET /email/exchange/{organizationName}/service/{exchangeService}/device/{identity}` — Get a device
- `PUT /email/exchange/{organizationName}/service/{exchangeService}/device/{identity}` — Update a device
- `POST /email/exchange/{organizationName}/service/{exchangeService}/device/{identity}/clearDevice` — Reset a device to factory settings

## List devices

`GET /1.0/email/exchange/{organizationName}/service/{exchangeService}/device`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices/#get-email-exchange-organizationname-service-exchangeservice-device

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/device/get`

List devices. Returns the identities of the ActiveSync devices registered on the service. Filter them by `identity`, `IMEI` or `deviceState`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `IMEI` | query | string |  | Filter the value of IMEI property (like) |
| `deviceState` | query | email.exchange.DeviceActiveSyncStateEnum |  | Filter the value of deviceState property (=) — one of `allowed`, `blocked`, `deviceDiscovery`, `quarantined` |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `identity` | query | string |  | Filter the value of identity property (like) |
| `organizationName` | path | string | yes | The internal name of your exchange organization |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string[] | successful operation |

```json
[
  "string"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/device" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/email/exchange/{organizationName}/service/{exchangeService}/device")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/email/exchange/{organizationName}/service/{exchangeService}/device");

print_r($result);
?>
```

## Get a device

`GET /1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices/#get-email-exchange-organizationname-service-exchangeservice-device-identity

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/device/get`

Get a device. Returns the model, IMEI, device ID, ActiveSync state and last update date of the ActiveSync device.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `identity` | path | string | yes | Exchange identity |
| `organizationName` | path | string | yes | The internal name of your exchange organization |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.exchange.exchangeServiceDevice | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `IMEI` | string | read-only | International Mobile Equipment Identity |
| `creationDate` | string (date-time) | read-only | Creation date |
| `deviceId` | string | read-only | Device Id |
| `deviceModel` | string | read-only | Model device |
| `deviceState` | email.exchange.DeviceActiveSyncStateEnum |  | Device State — one of `allowed`, `blocked`, `deviceDiscovery`, `quarantined` |
| `guid` | string | read-only | user guid |
| `identity` | string | read-only | Exchange identity |
| `lastUpdate` | string (date-time) | read-only | Last update date |
| `taskPendingId` | integer | read-only | Pending task id |

```json
{
  "IMEI": "string",
  "creationDate": "2024-01-01T12:00:00Z",
  "deviceId": "string",
  "deviceModel": "string",
  "deviceState": "allowed",
  "guid": "string",
  "identity": "string",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "taskPendingId": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}");

print_r($result);
?>
```

## Update a device

`PUT /1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices/#put-email-exchange-organizationname-service-exchangeservice-device-identity

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/device/edit`

Update a device. Updates the ActiveSync state of the device with `deviceState`, for example to allow, block or quarantine it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `identity` | path | string | yes | Exchange identity |
| `organizationName` | path | string | yes | The internal name of your exchange organization |

### Request body (required)

Type: `email.exchange.exchangeServiceDevice`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `IMEI` | string | read-only | International Mobile Equipment Identity |
| `creationDate` | string (date-time) | read-only | Creation date |
| `deviceId` | string | read-only | Device Id |
| `deviceModel` | string | read-only | Model device |
| `deviceState` | email.exchange.DeviceActiveSyncStateEnum |  | Device State — one of `allowed`, `blocked`, `deviceDiscovery`, `quarantined` |
| `guid` | string | read-only | user guid |
| `identity` | string | read-only | Exchange identity |
| `lastUpdate` | string (date-time) | read-only | Last update date |
| `taskPendingId` | integer | read-only | Pending task id |

```json
{
  "deviceState": "allowed"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: email.exchange.exchangeServiceDevice
result = client.put("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}",
	deviceState = None, # Device State (type: email.exchange.DeviceActiveSyncStateEnum)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: email.exchange.exchangeServiceDevice
$result = $ovh->put("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}", array(
	deviceState => null, // Device State (type: email.exchange.DeviceActiveSyncStateEnum)
));

print_r($result);
?>
```

## Reset a device to factory settings

`POST /1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}/clearDevice`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/hosted-exchange/devices/#post-email-exchange-organizationname-service-exchangeservice-device-identity-cleardevice

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/device/clearDevice`

Reset a device to factory settings. Runs a factory reset on the device and returns the task. This cannot be undone: all data on the device is lost.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `identity` | path | string | yes | Exchange identity |
| `organizationName` | path | string | yes | The internal name of your exchange organization |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.exchange.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | email.exchange.TaskFunctionEnum | read-only | Function name — one of `activateSharepoint`, `addAccount`, `addAccountArchive`, `addAccountImpersonation`, `addActiveSyncMailNotification`, `addAlias`, `addDistributionGroup`, `addDistributionGroupManager`, `addDistributionGroupMember`, `addDistributionGroupSendAs`, `addDistributionGroupSendOnBehalfTo`, `addDomain`, … |
| `id` | integer | read-only | Task id |
| `status` | email.exchange.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "activateSharepoint",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}/clearDevice" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}/clearDevice")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/email/exchange/{organizationName}/service/{exchangeService}/device/{identity}/clearDevice");

print_r($result);
?>
```
