# Web Cloud › Email and Collaborative Solutions › Microsoft Exchange › Trusted Exchange › External Contacts 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

> 5 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/trusted-exchange/external-contacts/

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

## Operations

- `GET /email/exchange/{organizationName}/service/{exchangeService}/externalContact` — List external contacts
- `GET /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}` — Get an external contact
- `POST /email/exchange/{organizationName}/service/{exchangeService}/externalContact` — Create an external contact
- `DELETE /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}` — Delete an external contact
- `PUT /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}` — Update an external contact

## List external contacts

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

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/trusted-exchange/external-contacts/#get-email-exchange-organizationname-service-exchangeservice-externalcontact

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

List external contacts. Returns the email addresses of the external contacts. Filter them by `externalEmailAddress`, `firstName`, `lastName`, `displayName` or `id`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `displayName` | query | string |  | Filter the value of displayName property (like) |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `externalEmailAddress` | query | string |  | Filter the value of externalEmailAddress property (like) |
| `firstName` | query | string |  | Filter the value of firstName property (like) |
| `id` | query | integer |  | Filter the value of id property (like) |
| `lastName` | query | string |  | Filter the value of lastName 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}/externalContact" \
  -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}/externalContact")

# 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}/externalContact");

print_r($result);
?>
```

## Get an external contact

`GET /1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/trusted-exchange/external-contacts/#get-email-exchange-organizationname-service-exchangeservice-externalcontact-externalemailaddress

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

Get an external contact. Returns the email address, names, display name, state and Global Address List visibility of the external contact.

### Parameters

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

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `displayName` | string |  | Contact display name |
| `externalEmailAddress` | string |  | Contact email |
| `firstName` | string |  | Contact first name |
| `hiddenFromGAL` | boolean |  | Hide the contact in Global Address List |
| `id` | integer | read-only | Contact id |
| `initials` | string |  | Contact initals |
| `lastName` | string |  | Contact last name |
| `organization2010` | string | read-only | If specified, indicates to which organization this external contact belongs (Exchange 2010 only) |
| `state` | email.exchange.ObjectStateEnum | read-only | Contact state — one of `creating`, `deleting`, `internalMigration`, `ok`, `reopening`, `suspended`, `suspending` |
| `taskPendingId` | integer | read-only | Task pending id |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "displayName": "string",
  "externalEmailAddress": "string",
  "firstName": "string",
  "hiddenFromGAL": true,
  "id": 0,
  "initials": "string",
  "lastName": "string",
  "organization2010": "string",
  "state": "creating",
  "taskPendingId": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}" \
  -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}/externalContact/{externalEmailAddress}")

# 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}/externalContact/{externalEmailAddress}");

print_r($result);
?>
```

## Create an external contact

`POST /1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/trusted-exchange/external-contacts/#post-email-exchange-organizationname-service-exchangeservice-externalcontact

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/externalContact/create`

Create an external contact. Creates an external contact from its `externalEmailAddress`, with optional names and display name, and returns the task.

### Parameters

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

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `displayName` | string |  | Contact display name |
| `externalEmailAddress` | string | yes | Contact email address |
| `firstName` | string |  | Contact first name |
| `hiddenFromGAL` | boolean |  | Hide the contact in Global Address List |
| `initials` | string |  | Contact initials |
| `lastName` | string |  | Contact last name |
| `organization2010` | string |  | Indicates to which organization this newly created external contact will belongs (Exchange 2010 only) |

```json
{
  "displayName": "string",
  "externalEmailAddress": "string",
  "firstName": "string",
  "hiddenFromGAL": true,
  "initials": "string",
  "lastName": "string",
  "organization2010": "string"
}
```

### 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}/externalContact" \
  -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: string
result = client.post("/email/exchange/{organizationName}/service/{exchangeService}/externalContact",
	displayName = None, # Contact display name (type: string, nullable)
	externalEmailAddress = None, # Contact email address (type: string)
	firstName = None, # Contact first name (type: string, nullable)
	hiddenFromGAL = None, # Hide the contact in Global Address List (type: boolean, nullable)
	initials = None, # Contact initials (type: string, nullable)
	lastName = None, # Contact last name (type: string, nullable)
	organization2010 = None, # Indicates to which organization this newly created external contact will belongs (Exchange 2010 only) (type: string, nullable)
)

# 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: string
$result = $ovh->post("/email/exchange/{organizationName}/service/{exchangeService}/externalContact", array(
	displayName => null, // Contact display name (type: string, nullable)
	externalEmailAddress => null, // Contact email address (type: string)
	firstName => null, // Contact first name (type: string, nullable)
	hiddenFromGAL => null, // Hide the contact in Global Address List (type: boolean, nullable)
	initials => null, // Contact initials (type: string, nullable)
	lastName => null, // Contact last name (type: string, nullable)
	organization2010 => null, // Indicates to which organization this newly created external contact will belongs (Exchange 2010 only) (type: string, nullable)
));

print_r($result);
?>
```

## Delete an external contact

`DELETE /1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/trusted-exchange/external-contacts/#delete-email-exchange-organizationname-service-exchangeservice-externalcontact-externalemailaddress

**Status:** Stable production version  
**IAM actions:** `emailExchange:apiovh:service/externalContact/delete`

Delete an external contact. Removes the external contact from the address book of the Exchange service and returns the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `exchangeService` | path | string | yes | The internal name of your exchange service |
| `externalEmailAddress` | path | string | yes | Contact email |
| `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 DELETE \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}" \
  -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.delete("/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}")

# 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->delete("/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}");

print_r($result);
?>
```

## Update an external contact

`PUT /1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/trusted-exchange/external-contacts/#put-email-exchange-organizationname-service-exchangeservice-externalcontact-externalemailaddress

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

Update an external contact. Updates the email address, names, display name and Global Address List visibility of the external contact.

### Parameters

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

### Request body (required)

Type: `email.exchange.exchangeExternalContact`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `displayName` | string |  | Contact display name |
| `externalEmailAddress` | string |  | Contact email |
| `firstName` | string |  | Contact first name |
| `hiddenFromGAL` | boolean |  | Hide the contact in Global Address List |
| `id` | integer | read-only | Contact id |
| `initials` | string |  | Contact initals |
| `lastName` | string |  | Contact last name |
| `organization2010` | string | read-only | If specified, indicates to which organization this external contact belongs (Exchange 2010 only) |
| `state` | email.exchange.ObjectStateEnum | read-only | Contact state — one of `creating`, `deleting`, `internalMigration`, `ok`, `reopening`, `suspended`, `suspending` |
| `taskPendingId` | integer | read-only | Task pending id |

```json
{
  "displayName": "string",
  "externalEmailAddress": "string",
  "firstName": "string",
  "hiddenFromGAL": true,
  "initials": "string",
  "lastName": "string"
}
```

### Responses

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

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}" \
  -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.exchangeExternalContact
result = client.put("/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}",
	displayName = None, # Contact display name (type: string)
	externalEmailAddress = None, # Contact email (type: string)
	firstName = None, # Contact first name (type: string, nullable)
	hiddenFromGAL = None, # Hide the contact in Global Address List (type: boolean)
	initials = None, # Contact initals (type: string, nullable)
	lastName = None, # Contact last name (type: string, nullable)
)

# 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.exchangeExternalContact
$result = $ovh->put("/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}", array(
	displayName => null, // Contact display name (type: string)
	externalEmailAddress => null, // Contact email (type: string)
	firstName => null, // Contact first name (type: string, nullable)
	hiddenFromGAL => null, // Hide the contact in Global Address List (type: boolean)
	initials => null, // Contact initals (type: string, nullable)
	lastName => null, // Contact last name (type: string, nullable)
));

print_r($result);
?>
```
