Skip to main content
Version: 1.27.19

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 typePermissionRate limit
Delegated (work or school account)App.ReadWrite.All (a signed-in user)Create, update, delete
ApplicationMail.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 without v1 is for signed-in users and answers 403 Forbidden to 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 primaryOwner or secondaryOwner. Without an owner, the call answers 400 with the code Mail.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 answers 400 with the code Mail.RequestorRequired and 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 permissions you 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.
warning

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​

HeaderValue
AuthorizationBearer token. (Required)
Content-Typeapplication/json

Request Body​

Mailbox properties table​

PropertyTypeDescription & Example
namestringUnique identifier for the mailbox. Example: "support". Required
displayNamestringHuman-readable display name. Example: "Customer Support". Optional
templateIdstring (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
permissionsobjectDefines user permissions for the mailbox. Required
metadataobjectKey-value pairs for custom metadata. Example: { "department": "HR", "createdBy": "Admin" }. Optional
capacityintegerMailbox storage capacity in MB. Example: 5000. Optional
statestringCurrent state of the mailbox. Example: "active". Optional
streetAddressstringPhysical address (if applicable). Example: "123 Corporate Blvd". Optional
officeLocationstringOffice location name. Example: "HQ - Floor 5". Optional
companyNamestringAssociated company name. Example: "Acme Corp". Optional
postalCodestringPostal code of the location. Example: "10001". Optional
citystringCity of the mailbox location. Example: "New York". Optional
countrystringCountry name. Example: "USA". Optional
businessPhonesarray<string>List of business phone numbers. Example: ["+1-800-555-1234", "+1-800-555-5678"]. Optional
phonestringPrimary contact phone number. Example: "+1-800-555-5678". Optional
departmentstringDepartment name associated with the mailbox. Example: "HR". Optional
primaryOwnerstring (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
secondaryOwnerstring (UUID)UUID of the secondary owner. Example: "6a95c23b-cbb3-4f06-9b05-5e96ac65c78c". Optional
requestorIdstring (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
termsAcceptedbooleanSend true when the template has terms of use. Without it the call answers 400 with the code Mail.TermsNotAccepted. Optional
resourceDelegatesarray<string (UUID)>Delegates who can book a room or equipment mailbox. A separate, optional list from the owners. Optional
automaticReplystringAuto-reply message for the mailbox. Example: "Thank you for contacting us.". Optional
isAllowAutomaticReplyOverridebooleanIf true, allows users to override auto-reply. Example: true. Optional
domainstringDomain of the mailbox. Example: "contoso.com". Required
audioDeviceNamestringAssociated audio device (for room/equipment). Example: "Bose Speaker System". Optional
displayDeviceNamestringAssociated display device. Example: "Samsung 85-inch Display". Optional
tagsarray<string>Tags for mailbox classification. Example: ["support", "helpdesk"]. Optional
videoDeviceNamestringAssociated video device. Example: "Logitech Video Conference Camera". Optional
isWheelChairAccessiblebooleanIf true, indicates wheelchair accessibility. Example: true. Optional
roomMailboxMetadataobjectRoom properties metadata. Optional
hideFromGALbooleanIf true, hides mailbox from the Global Address List (GAL). Example: false. Optional
notesstringAdditional notes for mailbox usage. Example: "This mailbox is monitored by the HR team.". Optional
reasonstringReason for creating the mailbox. Example: "For job applications". Optional
autoMappingbooleanIf true, mailbox is auto-mapped for assigned users. Example: true. Optional
aliasstringAlternate 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.

PropertyTypeDescription & Example
Custom KeystringAny 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)TypeDescription
User IDstringUnique identifier of a user Example: a5f1b3d7-49c2-4e87-b4f6-d8e2a9c3e7b1
Access Levelstring (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).

PropertyTypeDescription
hasConferencePhonebooleanIf true, the room has a conference phone.
hasWhiteboardbooleanIf true, the room has a whiteboard.
hasVideoConferencingbooleanIf 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.

StatusCodeWhen
400InvalidPayloadThe body is missing or cannot be read, or requestorId is not a GUID.
400Mail.ValueTooLongdisplayName 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.
400Mail.OwnerRequiredAn application sent no owner.
400Mail.OwnerNotAllowedAn owner is not an enabled member user, for example a guest or a user that was not found. The mailbox was not created.
400Mail.RequestorRequiredThe template has an approval and an application sent no requestorId.
400Mail.DomainRequireddomain is missing.
400Mail.TemplateNotActiveThe template is switched off.
400Mail.TemplateNotApplicableThe template is not for a shared, room or equipment mailbox.
400Mail.InvalidNameThe name is on the blocklist or is not valid.
400Mail.FeatureNotEnabledThe mailbox type of the template is not switched on for your tenant.
400Mail.TermsNotAcceptedThe template has terms of use and termsAccepted is not true.
401noneThe token is missing or not valid.
403noneThe token has no role that this route accepts, or the route is not the versioned route.
404Mail.TemplateNotFoundThe template does not exist, or templateId is missing.
404Mail.RequestorNotFoundrequestorId names no user.
429RateLimitedToo 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​

PropertyShared MailboxEquipment MailboxRoom 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