Create Mailbox
The EasyLife 365 Mail API supports the provisioning of three types of mailboxes:
-
Shared Mailboxes: Mailboxes that can be accessed by multiple users, typically used for shared email addresses like shared-mailbox@contoso.com.
-
Equipment Mailboxes: Mailboxes used to manage resources such as projectors, vehicles, or other equipment.
-
Room Mailboxes: Mailboxes used to manage meeting rooms or other physical spaces, allowing users to book them via calendar invites.
Create a new mailbox with the specified properties. The template you send decides which type of mailbox is created. The template, naming rules and blocked names apply as in EasyLife 365 Admin and EasyLife 365 Mail. An approval applies when the template has one and approvals are turned on for your tenant. The API does not check who a template is meant for: an application can use any active template of the right type.
Permissions
| Permission type | Permission | Rate limit |
|---|---|---|
| Delegated (work or school account) | App.ReadWrite.All (a signed-in user) | Create, update, delete |
| Application | Mail.Mailbox.Provisioning.ReadWrite.All or Mail.Provisioning.ReadWrite.All (either one) | Create, update, delete |
- This route is part of the App API. Grant the role on the EasyLife 365 Mail application in your tenant, not on EasyLife 365 Admin.
- Get the token with the scope
https://api.easylife365.cloud/mail/.default; see Get a token. - Only the versioned route (
/mail/v1/mailboxes) accepts an application role. The route withoutv1is for signed-in users and answers403 Forbiddento an application token. - An Admin API role, such as
Mail.Manage.ReadWrite.All, does not work here.
What an application sends
An application has no signed-in user, so nothing is taken from "who is calling":
- At least one owner is required. Send
primaryOwnerorsecondaryOwner. Without an owner, the call answers400with the codeMail.OwnerRequired. An owner must be an enabled member user of your tenant. The owners get full access to the mailbox. - A requestor is optional, unless the template has an approval and approvals are turned on for your tenant. In that case, send
requestorId, the object ID of the person the request is for. Without it, the call answers400with the codeMail.RequestorRequiredand nothing is created. The requestor is shown in the approval and is recorded on the request. Without a requestor, the{user:...}tokens of the naming conventions of the template resolve to nothing, so a name or description built from them can come out blank or odd. - Nobody is added for the caller. The
permissionsyou send and the owners are what the mailbox gets. - A template with an approval still goes to approval when approvals are turned on for your tenant. Nothing is created until it is approved. The response then has
"isApproval": true. - When audit logging is turned on, the creation is audited once, by the engine. The entry (
CREATE-MAILBOX) is written when the mailbox exists. In rare cases a mailbox exists without an entry. Its actor is the EasyLife engine, not your application. The description names the requestor and "requested by application" with your application (client) ID, so search the description. A request that fails or is never approved leaves no entry.
Treat every holder of a create role as a privileged identity, and give the role only to trusted automation. The API does not verify the requestor an application names, and the approver is worked out from that person, so the application decides who is asked to approve. The approver sees the requestor you name, not your application. The application also decides the owners and the permissions of the mailbox, including Full Access and Send As.
HTTP Request
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
HTTP request headers
| Header | Value |
|---|---|
| Authorization | Bearer token. (Required) |
| Content-Type | application/json |
Request Body
Mailbox properties table
| Property | Type | Description & Example |
|---|---|---|
name | string | Unique identifier for the mailbox. Example: "support". Required |
displayName | string | Human-readable display name. Example: "Customer Support". Optional |
templateId | string (UUID) | Template identifier for predefined mailbox template. Ensure that the type of template corresponds to the mailbox type being provisioned. Example: "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b". Required |
permissions | object | Defines user permissions for the mailbox. Required |
metadata | object | Key-value pairs for custom metadata. Example: { "department": "HR", "createdBy": "Admin" }. Optional |
capacity | integer | Mailbox storage capacity in MB. Example: 5000. Optional |
state | string | Current state of the mailbox. Example: "active". Optional |
streetAddress | string | Physical address (if applicable). Example: "123 Corporate Blvd". Optional |
officeLocation | string | Office location name. Example: "HQ - Floor 5". Optional |
companyName | string | Associated company name. Example: "Acme Corp". Optional |
postalCode | string | Postal code of the location. Example: "10001". Optional |
city | string | City of the mailbox location. Example: "New York". Optional |
country | string | Country name. Example: "USA". Optional |
businessPhones | array<string> | List of business phone numbers. Example: ["+1-800-555-1234", "+1-800-555-5678"]. Optional |
phone | string | Primary contact phone number. Example: "+1-800-555-5678". Optional |
department | string | Department name associated with the mailbox. Example: "HR". Optional |
primaryOwner | string (UUID) | UUID of the primary owner. Example: "49cf935a-284f-4c84-8df7-a5b11f1be527". Optional for a signed-in user, required for an application unless secondaryOwner is sent |
secondaryOwner | string (UUID) | UUID of the secondary owner. Example: "6a95c23b-cbb3-4f06-9b05-5e96ac65c78c". Optional |
requestorId | string (UUID) | Object ID of the person the request is for. Required for an application when the template has an approval and approvals are turned on for your tenant. Ignored for a signed-in user. Example: "a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4". Optional |
termsAccepted | boolean | Send true when the template has terms of use. Without it the call answers 400 with the code Mail.TermsNotAccepted. Optional |
resourceDelegates | array<string (UUID)> | Delegates who can book a room or equipment mailbox. A separate, optional list from the owners. Optional |
automaticReply | string | Auto-reply message for the mailbox. Example: "Thank you for contacting us.". Optional |
isAllowAutomaticReplyOverride | boolean | If true, allows users to override auto-reply. Example: true. Optional |
domain | string | Domain of the mailbox. Example: "contoso.com". Required |
audioDeviceName | string | Associated audio device (for room/equipment). Example: "Bose Speaker System". Optional |
displayDeviceName | string | Associated display device. Example: "Samsung 85-inch Display". Optional |
tags | array<string> | Tags for mailbox classification. Example: ["support", "helpdesk"]. Optional |
videoDeviceName | string | Associated video device. Example: "Logitech Video Conference Camera". Optional |
isWheelChairAccessible | boolean | If true, indicates wheelchair accessibility. Example: true. Optional |
roomMailboxMetadata | object | Room properties metadata. Optional |
hideFromGAL | boolean | If true, hides mailbox from the Global Address List (GAL). Example: false. Optional |
notes | string | Additional notes for mailbox usage. Example: "This mailbox is monitored by the HR team.". Optional |
reason | string | Reason for creating the mailbox. Example: "For job applications". Optional |
autoMapping | boolean | If true, mailbox is auto-mapped for assigned users. Example: true. Optional |
alias | string | Alternate email alias for the mailbox. Example: "recruitment@contoso.com" |
Expanded object type definitions
metadata (Object)
Stores additional information about the mailbox in key-value format.
| Property | Type | Description & Example |
|---|---|---|
| Custom Key | string | Any key-value pair that provides extra details. Example: { "manager": "John Doe", "createdBy": "Admin" } |
Example Usage
{
"metadata": {
"el-text-388": "Used for customer inquiries",
"manager": "John Doe",
"createdBy": "Admin"
}
}
permissions (Object)
Defines access rights for users to the mailbox.
| Property (UUID) | Type | Description |
|---|---|---|
| User ID | string | Unique identifier of a user Example: a5f1b3d7-49c2-4e87-b4f6-d8e2a9c3e7b1 |
| Access Level | string (enum) | One of: "None", "SendAs", "FullAccess" |
Example Usage
{
"permissions": {
"49cf935a-284f-4c84-8df7-a5b11f1be527": "FullAccess",
"f3c98a7b-129d-4f06-b8f1-e7a1d9c84e5a": "SendAs",
"a5f1b3d7-49c2-4e87-b4f6-d8e2a9c3e7b1": "None"
}
}
roomMailboxMetadata (Object)
Specific settings for room mailboxes (e.g., meeting rooms).
| Property | Type | Description |
|---|---|---|
hasConferencePhone | boolean | If true, the room has a conference phone. |
hasWhiteboard | boolean | If true, the room has a whiteboard. |
hasVideoConferencing | boolean | If true, the room has video conferencing equipment. |
Example Usage
{
"roomMailboxMetadata": {
"hasConferencePhone": true,
"hasWhiteboard": true,
"hasVideoConferencing": false
}
}
Example: Creating a mailbox
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
{
"name": "john.doe",
"displayName": "John Doe",
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"domain": "contoso.com",
"metadata": {
"el-text-388": "Custom text field content goes here!"
},
"primaryOwner": "49cf935a-284f-4c84-8df7-a5b11f1be527",
"secondaryOwner": "6a95c23b-cbb3-4f06-9b05-5e96ac65c78c"
}
Response
200 OK. The mailbox is created in the background, so the response returns the ID of the request. isApproval is true when the template needs an approval first.
{
"requestId": "72d2f4b8-76fe-4140-9460-3c7ef9091cb5",
"isApproval": false
}
Example: Creating a mailbox as an application with curl
The template has an approval, so the call sends requestorId.
curl -s -X POST "https://api.easylife365.cloud/mail/v1/mailboxes" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "support",
"displayName": "Customer Support",
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"domain": "contoso.com",
"primaryOwner": "49cf935a-284f-4c84-8df7-a5b11f1be527",
"requestorId": "a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4"
}'
Response for a template with an approval:
{
"requestId": "0b6a3c1e-9d47-4f58-a2e6-8c5d1f7b4a39",
"isApproval": true
}
Example: Creating a mailbox as an application with PowerShell
First get a token with the scope https://api.easylife365.cloud/mail/.default.
$headers = @{ Authorization = "Bearer $token" }
$body = @{
name = "support"
displayName = "Customer Support"
templateId = "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b"
domain = "contoso.com"
primaryOwner = "49cf935a-284f-4c84-8df7-a5b11f1be527"
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Headers $headers -ContentType "application/json" -Body $body `
-Uri "https://api.easylife365.cloud/mail/v1/mailboxes"
Error responses
Errors are application/problem+json. See Call the API as an application.
| Status | Code | When |
|---|---|---|
| 400 | InvalidPayload | The body is missing or cannot be read, or requestorId is not a GUID. |
| 400 | Mail.ValueTooLong | displayName is longer than 256 characters, notes longer than 1024 or name longer than 64. The field and maxLength members of the answer name the value and its limit. For notes, field says description. |
| 400 | Mail.OwnerRequired | An application sent no owner. |
| 400 | Mail.OwnerNotAllowed | An owner is not an enabled member user, for example a guest or a user that was not found. The mailbox was not created. |
| 400 | Mail.RequestorRequired | The template has an approval and an application sent no requestorId. |
| 400 | Mail.DomainRequired | domain is missing. |
| 400 | Mail.TemplateNotActive | The template is switched off. |
| 400 | Mail.TemplateNotApplicable | The template is not for a shared, room or equipment mailbox. |
| 400 | Mail.InvalidName | The name is on the blocklist or is not valid. |
| 400 | Mail.FeatureNotEnabled | The mailbox type of the template is not switched on for your tenant. |
| 400 | Mail.TermsNotAccepted | The template has terms of use and termsAccepted is not true. |
| 401 | none | The token is missing or not valid. |
| 403 | none | The token has no role that this route accepts, or the route is not the versioned route. |
| 404 | Mail.TemplateNotFound | The template does not exist, or templateId is missing. |
| 404 | Mail.RequestorNotFound | requestorId names no user. |
| 429 | RateLimited | Too many calls. |
{
"type": "https://docs.easylife365.cloud/errors/mail/owner-required",
"title": "At least one owner is required.",
"status": 400,
"code": "Mail.OwnerRequired",
"requestId": "3e7d5b21-8a4c-4f90-b6d2-1c9a0e5f7b48"
}
Example: Creating a Shared Mailbox with dedicated permissions
HTTP Request
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
Request Body
{
"name": "support",
"displayName": "Customer Support",
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"domain": "contoso.com",
"metadata": {
"el-text-388": "Used for customer inquiries",
"department": "Support"
},
"primaryOwner": "49cf935a-284f-4c84-8df7-a5b11f1be527",
"secondaryOwner": "6a95c23b-cbb3-4f06-9b05-5e96ac65c78c",
"permissions": {
"a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4": "FullAccess",
"49cf935a-284f-4c84-8df7-a5b11f1be527": "SendAs"
},
"alias": "support@contoso.com",
"autoMapping": true,
"hideFromGAL": false,
"notes": "Handles all customer support queries."
}
Example: Creating an equipment mailbox
HTTP Request
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
Request Body
{
"name": "projector-1",
"displayName": "Conference Room Projector",
"templateId": "7c1e5a90-3b64-4d2f-9a8e-0f6b2d4c8e13",
"domain": "contoso.com",
"metadata": {
"equipmentType": "Projector",
"el-text-388": "4K projector for executive conference rooms."
},
"primaryOwner": "35c2f1d5-789e-4c53-ade4-f1c7e65a3e9f",
"capacity": 500,
"permissions": {
"a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4": "FullAccess",
"49cf935a-284f-4c84-8df7-a5b11f1be527": "None"
},
"automaticReply": "This projector is available for booking via the calendar system.",
"isAllowAutomaticReplyOverride": false,
"notes": "Only authorized users can book this projector."
}
Example: Creating a room mailbox
HTTP Request
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
Request Body
{
"name": "executive-boardroom",
"displayName": "Executive Boardroom",
"templateId": "b2d9f6a4-5e1c-4a37-8c0d-9e3f1a7b6c25",
"domain": "contoso.com",
"officeLocation": "HQ - Floor 5",
"streetAddress": "123 Corporate Blvd",
"city": "New York",
"country": "USA",
"capacity": 20,
"isWheelChairAccessible": true,
"primaryOwner": "49cf935a-284f-4c84-8df7-a5b11f1be527",
"permissions": {
"a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4": "FullAccess",
"49cf935a-284f-4c84-8df7-a5b11f1be527": "SendAs"
},
"roomMailboxMetadata": {
"hasConferencePhone": true,
"hasWhiteboard": true,
"hasVideoConferencing": true
},
"automaticReply": "This room is available for booking during business hours.",
"isAllowAutomaticReplyOverride": true
}
Example: Create shared mailbox with additional metadata
HTTP Request
POST https://api.easylife365.cloud/mail/v1/mailboxes
Content-Type: application/json
Authorization: Bearer <token>
Request Body
{
"name": "hr-recruitment",
"displayName": "HR Recruitment",
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"domain": "contoso.com",
"metadata": {
"department": "HR",
"el-text-388": "Used for handling job applications."
},
"primaryOwner": "a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4",
"businessPhones": ["+1-800-555-1234"],
"phone": "+1-800-555-5678",
"permissions": {
"a9b7d6f3-c2e5-4a1b-b9e7-f1d5a3e9c6d4": "FullAccess",
"49cf935a-284f-4c84-8df7-a5b11f1be527": "SendAs"
},
"alias": "recruitment@contoso.com",
"autoMapping": true,
"hideFromGAL": false,
"notes": "Receives resumes and job inquiries."
}
Comparison of key properties by mailbox type
| Property | Shared Mailbox | Equipment Mailbox | Room Mailbox |
|---|---|---|---|
autoMapping | ✅ Yes | ❌ No | ❌ No |
alias | ✅ Yes | ❌ No | ❌ No |
capacity | ✅ Yes | ✅ Yes | ✅ Yes |
automaticReply | ✅ Yes | ✅ Yes | ✅ Yes |
permissions | ✅ Yes | ✅ Yes | ✅ Yes |
roomMailboxMetadata | ❌ No | ❌ No | ✅ Yes |
isWheelChairAccessible | ❌ No | ❌ No | ✅ Yes |
officeLocation | ❌ No | ❌ No | ✅ Yes |
equipmentType (custom metadata) | ❌ No | ✅ Yes | ❌ No |