Microsoft Mail API

Access and manage Outlook mail messages and folders

Documentation

📖
Documentation
https://learn.microsoft.com/en-us/graph/overview
📖
Authentication
https://learn.microsoft.com/en-us/graph/auth/
📖
GettingStarted
https://learn.microsoft.com/en-us/graph/use-the-api
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/azure/
📖
APIReference
https://learn.microsoft.com/en-us/rest/api/?view=Azure
📖
Authentication
https://learn.microsoft.com/en-us/azure/active-directory/develop/
📖
Documentation
https://learn.microsoft.com/en-us/azure/ai-services/openai/
📖
APIReference
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart
📖
Authentication
https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/managed-identity
📖
Documentation
https://learn.microsoft.com/en-us/azure/ai-services/
📖
APIReference
https://learn.microsoft.com/en-us/rest/api/cognitiveservices/
📖
Documentation
https://learn.microsoft.com/en-us/microsoftteams/platform/
📖
APIReference
https://learn.microsoft.com/en-us/graph/teams-concept-overview
📖
Documentation
https://learn.microsoft.com/en-us/onedrive/developer/
📖
APIReference
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/
📖
Documentation
https://learn.microsoft.com/en-us/power-platform/admin/programmability-overview
📖
Documentation
https://learn.microsoft.com/en-us/bing/search-apis/
📖
APIReference
https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/reference/endpoints
📖
Documentation
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service
📖
APIReference
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints
📖
GettingStarted
https://learn.microsoft.com/en-us/sharepoint/dev/apis/sharepoint-rest-graph
📖
Documentation
https://learn.microsoft.com/en-us/power-bi/developer/
📖
APIReference
https://learn.microsoft.com/en-us/rest/api/power-bi/
📖
Authentication
https://learn.microsoft.com/en-us/power-bi/developer/embedded/register-app
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/azure/devops/
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/devops/integrate/how-to/call-rest-api
📖
Authentication
https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/authentication-guidance
📖
Documentation
https://learn.microsoft.com/en-us/rest/dynamics365/
📖
APIReference
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/about
📖
GettingStarted
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/overview
📖
Authentication
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-oauth
📖
Documentation
https://learn.microsoft.com/en-us/linkedin/
📖
Authentication
https://learn.microsoft.com/en-us/linkedin/shared/authentication/getting-access
📖
APIReference
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/concepts
📖
Documentation
https://learn.microsoft.com/en-us/azure/communication-services/
📖
APIReference
https://learn.microsoft.com/en-us/rest/api/communication/
📖
Documentation
https://learn.microsoft.com/en-us/entra/identity-platform/
📖
APIReference
https://learn.microsoft.com/en-us/graph/identity-network-access-overview
📖
GettingStarted
https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app
📖
Authentication
https://learn.microsoft.com/en-us/entra/identity-platform/v2-overview
📖
Documentation
https://learn.microsoft.com/en-us/outlook/
📖
GettingStarted
https://learn.microsoft.com/en-us/outlook/rest/get-started
📖
Documentation
https://learn.microsoft.com/en-us/graph/intune-concept-overview
📖
APIReference
https://learn.microsoft.com/en-us/graph/api/resources/intune-graph-overview
📖
Authentication
https://learn.microsoft.com/en-us/intune/intune-service/developer/intune-graph-apis

Specifications

Schemas & Data

Other Resources

🔗
SDKs
https://learn.microsoft.com/en-us/graph/sdks/sdks-overview
🔗
Graph Explorer
https://developer.microsoft.com/en-us/graph/graph-explorer
🔗
ChangeLog
https://learn.microsoft.com/en-us/graph/whats-new-overview
🔗
GraphQL
https://raw.githubusercontent.com/api-evangelist/microsoft/refs/heads/main/graphql/microsoft-graphql.md
🔗
SDKs
https://azure.microsoft.com/en-us/downloads/
🔗
Pricing
https://azure.microsoft.com/en-us/pricing/
🔗
Pricing
https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
🔗
Pricing
https://azure.microsoft.com/en-us/pricing/details/cognitive-services/
🔗
SDKs
https://learn.microsoft.com/en-us/azure/ai-services/cognitive-services-apis-create-account-client-library
🔗
App Templates
https://learn.microsoft.com/en-us/microsoftteams/platform/samples/app-templates
🔗
SDKs
https://learn.microsoft.com/en-us/microsoftteams/platform/get-started/get-started-overview
🔗
Samples
https://github.com/OneDrive/samples
🔗
Power Apps API
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/overview
🔗
Power Automate API
https://learn.microsoft.com/en-us/power-automate/web-api
🔗
Pricing
https://www.microsoft.com/en-us/bing/apis/pricing
🔗
Microsoft Graph Integration
https://learn.microsoft.com/en-us/graph/sharepoint-concept-overview
🔗
SDKs
https://learn.microsoft.com/en-us/power-bi/developer/embedded/
🔗
Samples
https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/rest/samples
🔗
SDKs
https://learn.microsoft.com/en-us/linkedin/shared/development-resources/api-clients
🔗
SDKs
https://learn.microsoft.com/en-us/azure/communication-services/concepts/sdk-options
🔗
Pricing
https://azure.microsoft.com/en-us/products/communication-services/#pricing
🔗
GitHub
https://github.com/Azure/Communication
🔗
Mail API Reference
https://learn.microsoft.com/en-us/graph/outlook-mail-concept-overview
🔗
Calendar API Reference
https://learn.microsoft.com/en-us/graph/outlook-calendar-concept-overview
🔗
SDKs
https://learn.microsoft.com/en-us/intune/intune-service/developer/app-sdk-get-started

OpenAPI Specification

microsoft-mail-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Microsoft Azure Cognitive Services Accounts Mail API
  description: APIs for vision, speech, language, and decision-making AI capabilities including Computer Vision, Text Analytics, and Translator services.
  version: '3.2'
  contact:
    name: Microsoft Azure Support
    url: https://azure.microsoft.com/en-us/support/
  termsOfService: https://www.microsoft.com/en-us/legal/terms-of-use
servers:
- url: https://{region}.api.cognitive.microsoft.com
  description: Azure Cognitive Services Regional Endpoint
  variables:
    region:
      default: eastus
      description: Azure region for the Cognitive Services resource
security:
- apiKey: []
tags:
- name: Mail
  description: Access and manage Outlook mail messages and folders
paths:
  /me/messages:
    get:
      operationId: listMessages
      summary: Microsoft List messages
      description: Get the messages in the signed-in user's mailbox, including the Deleted Items and Clutter folders. Returns messages from all mail folders.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/skip'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/select'
      - $ref: '#/components/parameters/orderby'
      - $ref: '#/components/parameters/search'
      responses:
        '200':
          description: Collection of messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  '@odata.context':
                    type: string
                  '@odata.nextLink':
                    type: string
                  value:
                    type: array
                    items:
                      $ref: '#/components/schemas/Message'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createMessage
      summary: Microsoft Create message draft
      description: Create a draft of a new message in either JSON or MIME format. When using JSON format, you can include an attachment and use a mention to call out another user.
      tags:
      - Mail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
      responses:
        '201':
          description: Message draft created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '400':
          $ref: '#/components/responses/BadRequest'
  /me/messages/{message-id}:
    get:
      operationId: getMessage
      summary: Microsoft Get message
      description: Retrieve the properties and relationships of a message object. You can use $select to retrieve specific properties and $expand to expand supported relationships.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId'
      - $ref: '#/components/parameters/select'
      responses:
        '200':
          description: Message object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      operationId: updateMessage
      summary: Microsoft Update message
      description: Update the properties of a message object.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
      responses:
        '200':
          description: Message updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
    delete:
      operationId: deleteMessage
      summary: Microsoft Delete message
      description: Delete a message in the specified user's mailbox, or delete a relationship of the message.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId'
      responses:
        '204':
          description: Message deleted successfully
        '404':
          $ref: '#/components/responses/NotFound'
  /me/sendMail:
    post:
      operationId: sendMail
      summary: Microsoft Send mail
      description: Send the message specified in the request body using either JSON or MIME format. The message is saved in the Sent Items folder by default.
      tags:
      - Mail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - message
              properties:
                message:
                  $ref: '#/components/schemas/Message'
                saveToSentItems:
                  type: boolean
                  description: Whether to save the message in Sent Items
                  default: true
      responses:
        '202':
          description: Mail sent successfully
        '400':
          $ref: '#/components/responses/BadRequest'
  /me/mailFolders:
    get:
      operationId: listMailFolders
      summary: Microsoft List mail folders
      description: Get the mail folder collection under the root folder of the signed-in user.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/top'
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/select'
      responses:
        '200':
          description: Collection of mail folders
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: array
                    items:
                      $ref: '#/components/schemas/MailFolder'
  /messages:
    get:
      operationId: listMessages
      summary: Microsoft List messages
      description: Get the messages in the signed-in user's mailbox.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/select_2'
      - $ref: '#/components/parameters/filter_2'
      - $ref: '#/components/parameters/top_2'
      - $ref: '#/components/parameters/skip_2'
      - $ref: '#/components/parameters/orderby_2'
      - $ref: '#/components/parameters/search_2'
      responses:
        '200':
          description: List of messages
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageCollection'
        '401':
          description: Unauthorized
  /messages/{messageId}:
    get:
      operationId: getMessage
      summary: Microsoft Get a message
      description: Retrieve a specific message.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId_2'
      - $ref: '#/components/parameters/select_2'
      responses:
        '200':
          description: Message details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message_2'
        '401':
          description: Unauthorized
        '404':
          description: Message not found
    patch:
      operationId: updateMessage
      summary: Microsoft Update a message
      description: Update the properties of a message.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId_2'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                isRead:
                  type: boolean
                categories:
                  type: array
                  items:
                    type: string
                importance:
                  type: string
                  enum:
                  - low
                  - normal
                  - high
      responses:
        '200':
          description: Message updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message_2'
        '401':
          description: Unauthorized
    delete:
      operationId: deleteMessage
      summary: Microsoft Delete a message
      description: Delete a message and move it to the Deleted Items folder.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/messageId_2'
      responses:
        '204':
          description: Message deleted
        '401':
          description: Unauthorized
  /sendMail:
    post:
      operationId: sendMail
      summary: Microsoft Send mail
      description: Send the message specified in the request body. The message is saved in the Sent Items folder by default.
      tags:
      - Mail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMailRequest'
      responses:
        '202':
          description: Mail sent
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /mailFolders:
    get:
      operationId: listMailFolders
      summary: Microsoft List mail folders
      description: Get the mail folder collection under the root folder.
      tags:
      - Mail
      parameters:
      - $ref: '#/components/parameters/top_2'
      responses:
        '200':
          description: List of mail folders
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: array
                    items:
                      $ref: '#/components/schemas/MailFolder_2'
        '401':
          description: Unauthorized
components:
  parameters:
    top_2:
      name: $top
      in: query
      schema:
        type: integer
    select:
      name: $select
      in: query
      required: false
      description: Comma-separated list of properties to include in the response
      schema:
        type: string
    top:
      name: $top
      in: query
      required: false
      description: Number of items to return (page size)
      schema:
        type: integer
        minimum: 1
    filter:
      name: $filter
      in: query
      required: false
      description: OData filter expression
      schema:
        type: string
    search_2:
      name: $search
      in: query
      schema:
        type: string
    search:
      name: $search
      in: query
      required: false
      description: Search expression to filter results
      schema:
        type: string
    filter_2:
      name: $filter
      in: query
      schema:
        type: string
    skip:
      name: $skip
      in: query
      required: false
      description: Number of items to skip for pagination
      schema:
        type: integer
        minimum: 0
    messageId_2:
      name: messageId
      in: path
      required: true
      description: Message unique identifier
      schema:
        type: string
    select_2:
      name: $select
      in: query
      schema:
        type: string
    skip_2:
      name: $skip
      in: query
      schema:
        type: integer
    orderby_2:
      name: $orderby
      in: query
      schema:
        type: string
    messageId:
      name: message-id
      in: path
      required: true
      description: Unique identifier of the message
      schema:
        type: string
    orderby:
      name: $orderby
      in: query
      required: false
      description: OData order by expression
      schema:
        type: string
  schemas:
    Recipient_2:
      type: object
      properties:
        emailAddress:
          type: object
          properties:
            name:
              type: string
            address:
              type: string
              format: email
    Message:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the message
          readOnly: true
        subject:
          type: string
          description: Subject of the message
        body:
          type: object
          properties:
            contentType:
              type: string
              enum:
              - text
              - html
              description: Type of the body content
            content:
              type: string
              description: Content of the message body
        bodyPreview:
          type: string
          description: First 255 characters of the message body
          readOnly: true
        from:
          $ref: '#/components/schemas/Recipient'
        toRecipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
          description: To recipients
        ccRecipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
          description: CC recipients
        bccRecipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
          description: BCC recipients
        replyTo:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
          description: Reply-to addresses
        importance:
          type: string
          enum:
          - low
          - normal
          - high
          description: Importance of the message
        isRead:
          type: boolean
          description: Whether the message has been read
        isDraft:
          type: boolean
          description: Whether the message is a draft
        hasAttachments:
          type: boolean
          description: Whether the message has attachments
          readOnly: true
        receivedDateTime:
          type: string
          format: date-time
          description: Date and time the message was received
          readOnly: true
        sentDateTime:
          type: string
          format: date-time
          description: Date and time the message was sent
          readOnly: true
        conversationId:
          type: string
          description: Identifier of the conversation the message belongs to
        internetMessageId:
          type: string
          description: Message ID in RFC2822 format
          readOnly: true
        webLink:
          type: string
          format: uri
          description: URL to open the message in Outlook on the web
          readOnly: true
        categories:
          type: array
          items:
            type: string
          description: Categories associated with the message
    Recipient:
      type: object
      properties:
        emailAddress:
          type: object
          properties:
            name:
              type: string
              description: Display name of the recipient
            address:
              type: string
              format: email
              description: Email address of the recipient
    MessageCollection:
      type: object
      properties:
        '@odata.context':
          type: string
        '@odata.nextLink':
          type: string
        value:
          type: array
          items:
            $ref: '#/components/schemas/Message_2'
    SendMailRequest:
      type: object
      required:
      - message
      properties:
        message:
          type: object
          properties:
            subject:
              type: string
            body:
              type: object
              properties:
                contentType:
                  type: string
                  enum:
                  - text
                  - html
                content:
                  type: string
            toRecipients:
              type: array
              items:
                $ref: '#/components/schemas/Recipient_2'
            ccRecipients:
              type: array
              items:
                $ref: '#/components/schemas/Recipient_2'
        saveToSentItems:
          type: boolean
          default: true
    Message_2:
      type: object
      properties:
        id:
          type: string
        subject:
          type: string
        bodyPreview:
          type: string
        body:
          type: object
          properties:
            contentType:
              type: string
              enum:
              - text
              - html
            content:
              type: string
        from:
          $ref: '#/components/schemas/Recipient_2'
        toRecipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient_2'
        ccRecipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient_2'
        receivedDateTime:
          type: string
          format: date-time
        sentDateTime:
          type: string
          format: date-time
        isRead:
          type: boolean
        isDraft:
          type: boolean
        hasAttachments:
          type: boolean
        importance:
          type: string
          enum:
          - low
          - normal
          - high
        categories:
          type: array
          items:
            type: string
    ODataError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Human-readable error message
            innerError:
              type: object
              properties:
                date:
                  type: string
                  format: date-time
                request-id:
                  type: string
                client-request-id:
                  type: string
    MailFolder:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier
          readOnly: true
        displayName:
          type: string
          description: Display name of the mail folder
        parentFolderId:
          type: string
          description: Unique identifier for the parent mail folder
        childFolderCount:
          type: integer
          description: Number of immediate child mail folders
        unreadItemCount:
          type: integer
          description: Number of unread items in the folder
        totalItemCount:
          type: integer
          description: Total number of items in the folder
        isHidden:
          type: boolean
          description: Whether the folder is hidden
    MailFolder_2:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        totalItemCount:
          type: integer
        unreadItemCount:
          type: integer
        parentFolderId:
          type: string
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ODataError'
    Unauthorized:
      description: Unauthorized - authentication required or token expired
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ODataError'
    BadRequest:
      description: Bad request - invalid input or malformed request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ODataError'
  securitySchemes:
    apiKey:
      type: apiKey
      name: Ocp-Apim-Subscription-Key
      in: header
      description: Azure Cognitive Services subscription key
externalDocs:
  description: Azure AI Services Documentation
  url: https://learn.microsoft.com/en-us/azure/ai-services/