{
  "openapi": "3.0.1",
  "info": {
    "title": "Outlook Mail Intelligence – Microsoft 365",
    "description": "Read your Microsoft 365 work/school mailbox READ-ONLY via Microsoft Graph, with your organization's own Entra app: sign in on Microsoft's page with a short code (Mail.Read only), search, folders, JSON/CSV export, attachments, stats, duplicates, threads, phishing signs, new-mail checks. Free demo.",
    "version": "0.1",
    "x-build-id": "MvJjETcfjhuw2SBgs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/badr_xba~outlook-mail-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-badr_xba-outlook-mail-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/badr_xba~outlook-mail-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-badr_xba-outlook-mail-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/badr_xba~outlook-mail-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-badr_xba-outlook-mail-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "auto",
              "demo",
              "connect",
              "read",
              "disconnect"
            ],
            "type": "string",
            "description": "auto = demo when nothing is filled in, read when a passphrase is given (or a new sign-in when no connection is saved yet). demo = fictional sample mailbox (nothing charged). connect = sign in with your work or school account on microsoft.com/devicelogin with the short code shown in the status message (keep the run open up to 15 minutes), then read. read = use the saved connection. disconnect = delete the saved connection.",
            "default": "auto"
          },
          "connectionName": {
            "title": "Connection name",
            "type": "string",
            "description": "A name for this mailbox connection, for example 'personal' or 'work' (several mailboxes = several names). Letters, digits, spaces and _ . @ - only.",
            "default": "default"
          },
          "tokenPassphrase": {
            "title": "Connection passphrase",
            "type": "string",
            "description": "A passphrase YOU choose (at least 12 characters). It encrypts your saved Microsoft connection (AES-256-GCM) in your own Apify key-value store. Use the same one for every run of this connection; it is never stored, logged or shown. Lost it? Run Disconnect, then Connect again."
          },
          "rememberConnection": {
            "title": "Remember the connection",
            "type": "boolean",
            "description": "On (default): the connection is saved encrypted so that later and scheduled runs work without signing in again. Off: nothing is stored, the sign-in is used for this run only (a one-time export).",
            "default": true
          },
          "clientId": {
            "title": "Client ID (your organization's app)",
            "type": "string",
            "description": "Required to connect and read (not for the demo). The Application (client) ID of the app your Microsoft 365 administrator registered in your organization's Microsoft Entra (single tenant, 'Allow public client flows' = Yes, delegated permission Mail.Read with admin consent). A GUID. Not secret; no client secret is needed. See the README section 'For your administrator'."
          },
          "tenantId": {
            "title": "Tenant ID (your organization)",
            "type": "string",
            "description": "Required to connect and read (not for the demo). Your organization's Directory (tenant) ID (a GUID, shown next to the Client ID in the app's Overview page) or one of its verified domains, for example contoso.onmicrosoft.com. Personal Microsoft accounts are not supported."
          },
          "folders": {
            "title": "Folders",
            "type": "array",
            "description": "Folders to read, by name: Inbox, Sent Items, Archive, Junk Email, Deleted Items, Drafts, your own folders, or a path like Inbox/Clients. 'All' = every folder. Empty = Inbox. A folder that does not exist is reported in FAILED_INPUTS with the list of your folders.",
            "items": {
              "type": "string"
            }
          },
          "includeSubfolders": {
            "title": "Include subfolders",
            "type": "boolean",
            "description": "Also read the subfolders of the chosen folders (3 levels, 50 folders at most).",
            "default": false
          },
          "searchQuery": {
            "title": "Search (KQL)",
            "type": "string",
            "description": "Optional. Microsoft's own search (like the Outlook search box), for example: from:billing@example.com hasAttachments:true, or subject:invoice received>=2026-01-01. Microsoft returns at most 1,000 results per search. The date, unread and sender filters below are then applied to those results."
          },
          "fromAddresses": {
            "title": "From (sender)",
            "type": "array",
            "description": "Optional. Only e-mails from these senders. Full addresses are filtered by Microsoft; partial text (a name or a domain) is filtered by the Actor.",
            "items": {
              "type": "string"
            }
          },
          "subjectContains": {
            "title": "Subject contains",
            "type": "array",
            "description": "Optional. Only e-mails whose subject contains one of these words.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "From date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only e-mails received on or after this day (YYYY-MM-DD, UTC)."
          },
          "dateTo": {
            "title": "To date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only e-mails received on or before this day (YYYY-MM-DD, UTC)."
          },
          "unreadOnly": {
            "title": "Unread e-mails only",
            "type": "boolean",
            "description": "Only e-mails not yet read. They stay unread: this Actor never marks anything as read.",
            "default": false
          },
          "hasAttachments": {
            "title": "With attachments only",
            "type": "boolean",
            "description": "Only e-mails that have at least one attached file.",
            "default": false
          },
          "monitorNewOnly": {
            "title": "Only new e-mails since the last run",
            "type": "boolean",
            "description": "For scheduled runs: each run returns only the e-mails that arrived in the chosen folders since the previous run (Microsoft delta queries; the starting point is saved encrypted with your connection). The first run returns the e-mails since 'From date' (default: the last 24 hours). This is not live monitoring: schedule the Actor (for example every hour).",
            "default": false
          },
          "maxMessages": {
            "title": "Maximum e-mails",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of e-mails read in this run (newest first).",
            "default": 50
          },
          "requestTimeoutSecs": {
            "title": "Microsoft request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "How long to wait for one Microsoft answer before retrying (busy or failing requests are retried up to 3 times, honouring Retry-After).",
            "default": 30
          },
          "services": {
            "title": "Analyses",
            "type": "array",
            "description": "Free analyses added to the results: stats = mailbox report; duplicates = same e-mail found twice; threads = conversations; phishing = warning signs (indicators, never a verdict); classify = category by rules; attachments = one row per attachment (metadata).",
            "items": {
              "type": "string",
              "enum": [
                "stats",
                "duplicates",
                "threads",
                "phishing",
                "classify",
                "attachments"
              ],
              "enumTitles": [
                "Mailbox report",
                "Duplicates",
                "Conversations",
                "Phishing indicators",
                "Category (rules)",
                "Attachment rows"
              ]
            },
            "default": [
              "stats",
              "duplicates",
              "threads",
              "phishing",
              "classify"
            ]
          },
          "includeBody": {
            "title": "Include the e-mail text",
            "type": "boolean",
            "description": "Add the plain text of each e-mail (bodyText). Turn off to keep only headers, snippet and analyses.",
            "default": true
          },
          "bodyMaxChars": {
            "title": "Maximum text length",
            "minimum": 0,
            "maximum": 200000,
            "type": "integer",
            "description": "Longer texts are cut (bodyTruncated: true).",
            "default": 20000
          },
          "includeHtml": {
            "title": "Include the HTML version",
            "type": "boolean",
            "description": "Add the raw HTML (bodyHtml). It is never rendered or executed by the Actor.",
            "default": false
          },
          "includeHeaders": {
            "title": "Include useful headers",
            "type": "boolean",
            "description": "Add a short list of headers (Reply-To, Return-Path, Authentication-Results, List-Unsubscribe, priority...).",
            "default": true
          },
          "exportCsv": {
            "title": "Also save a CSV file",
            "type": "boolean",
            "description": "Save the e-mail list as EMAILS_CSV in the key-value store (one line per e-mail, spreadsheet-safe).",
            "default": true
          },
          "downloadAttachments": {
            "title": "Save attachment files",
            "type": "boolean",
            "description": "Save attached files to the run's key-value store, with their SHA-256 (never opened or executed). Risky types (.exe, .js, .html, macros...) and cloud links are never saved: metadata only.",
            "default": false
          },
          "maxAttachmentMb": {
            "title": "Maximum size per file (MB)",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Bigger files are listed but not saved (tooLarge).",
            "default": 10
          },
          "maxTotalAttachmentsMb": {
            "title": "Maximum total of saved files (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "When reached, other files are listed but not saved (runCapReached).",
            "default": 100
          },
          "aiProvider": {
            "title": "AI summary and category (your own key)",
            "enum": [
              "none",
              "openai",
              "anthropic",
              "gemini"
            ],
            "type": "string",
            "description": "Optional. Uses YOUR OpenAI, Anthropic or Gemini key: the AI cost is billed by your provider. E-mail text is sent as untrusted data; the AI has no tools and can only return a summary and a category.",
            "default": "none"
          },
          "aiApiKey": {
            "title": "AI API key",
            "type": "string",
            "description": "Your own API key for the chosen AI provider. Stored as a secret input; never logged or written to the results."
          },
          "aiModel": {
            "title": "AI model (optional)",
            "type": "string",
            "description": "Leave empty for a low-cost default model of the chosen provider."
          },
          "aiLanguage": {
            "title": "Summary language",
            "type": "string",
            "description": "Language of the AI summaries, for example English or French.",
            "default": "English"
          },
          "maxAiEmails": {
            "title": "Maximum e-mails sent to the AI",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Cost guard for your AI account.",
            "default": 25
          },
          "redactBeforeAi": {
            "title": "Mask addresses and phone numbers before the AI",
            "type": "boolean",
            "description": "E-mail addresses and phone numbers in the text are replaced by [redacted] before sending to your AI provider.",
            "default": true
          },
          "connectionStoreName": {
            "title": "Connection storage name",
            "type": "string",
            "description": "Name of the key-value store in YOUR Apify account that keeps the encrypted connection and the monitoring starting point. Change it only if you want to keep connections apart.",
            "default": "outlook-mail-intelligence"
          },
          "failRunOnError": {
            "title": "Mark the run as FAILED when the mailbox cannot be read",
            "type": "boolean",
            "description": "Off (default): the run ends SUCCEEDED with a clear message and FAILED_INPUTS (expired connection, admin consent needed, sign-in cancelled...). On: those problems end the run as FAILED (useful for scheduled monitoring).",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}