{
  "openapi": "3.0.1",
  "info": {
    "title": "IMAP Mail Intelligence – iCloud",
    "description": "Read your own mailbox READ-ONLY with an app-specific password (iCloud, Yahoo, Zoho, GMX, Fastmail, any IMAP) or import MBOX / EML: search, export, attachments, stats, duplicates, threads, phishing signs, AI summary with your key. Free demo.",
    "version": "0.1",
    "x-build-id": "K1X1bN9bj5kU5a2Ow"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/badr_xba~imap-mail-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-badr_xba-imap-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~imap-mail-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-badr_xba-imap-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~imap-mail-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-badr_xba-imap-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": {
          "source": {
            "title": "Source",
            "enum": [
              "auto",
              "demo",
              "imap",
              "file"
            ],
            "type": "string",
            "description": "auto = demo when no account and no file is given, IMAP when an e-mail address or password is given, file import when a file is given. demo = fictional sample mailbox (no account needed, nothing charged).",
            "default": "auto"
          },
          "provider": {
            "title": "Mail provider",
            "enum": [
              "icloud",
              "yahoo",
              "aol",
              "zoho",
              "zoho-eu",
              "gmx-com",
              "gmx-net",
              "fastmail",
              "ovh",
              "gmail",
              "outlook",
              "custom"
            ],
            "type": "string",
            "description": "Server settings are filled in for you. iCloud: imap.mail.me.com:993 (SSL). Outlook.com / Hotmail no longer accept app passwords over IMAP (Microsoft requires modern sign-in): not supported here. Gmail: needs 2-Step Verification and a Google app password; it does NOT work for Google Workspace accounts whose administrator blocks app passwords, nor for accounts with Advanced Protection. Choose 'Other IMAP server' to type the server yourself.",
            "default": "icloud"
          },
          "emailAddress": {
            "title": "E-mail address",
            "type": "string",
            "description": "The mailbox to read (your own, or one you are authorised to read). Used as the IMAP user name unless you fill in 'IMAP user name'."
          },
          "appPassword": {
            "title": "App-specific password",
            "type": "string",
            "description": "NEVER your main password. Create an app-specific password at your provider (iCloud: account.apple.com > Sign-In and Security > App-Specific Passwords; two-factor authentication required) and revoke it when you no longer need it. Stored encrypted by Apify as a secret input; never logged or written to the results."
          },
          "imapUsername": {
            "title": "IMAP user name (optional)",
            "type": "string",
            "description": "Only when the server expects another user name than the e-mail address (for example the part before @ on some iCloud accounts)."
          },
          "imapHost": {
            "title": "IMAP server (Other IMAP server)",
            "type": "string",
            "description": "Server name, for example imap.example.com. Overrides the provider preset when filled in."
          },
          "imapPort": {
            "title": "IMAP port",
            "minimum": 1,
            "maximum": 65535,
            "type": "integer",
            "description": "993 for SSL/TLS (recommended), 143 for STARTTLS.",
            "default": 993
          },
          "imapSecurity": {
            "title": "Connection security",
            "enum": [
              "ssl",
              "starttls"
            ],
            "type": "string",
            "description": "ssl = TLS from the start (port 993); starttls = upgrade to TLS (port 143). Unencrypted IMAP is never used.",
            "default": "ssl"
          },
          "folders": {
            "title": "Folders",
            "type": "array",
            "description": "Folders to read (default: INBOX for IMAP, every folder of an imported file or of the demo). Names or aliases: INBOX, Sent, Drafts, Junk, Trash, Archive. A folder that does not exist is reported in FAILED_INPUTS with the list of available folders.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "From date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only e-mails sent on or after this day (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "To date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Only e-mails sent on or before this day (YYYY-MM-DD)."
          },
          "fromContains": {
            "title": "Sender contains",
            "type": "array",
            "description": "Keep e-mails whose sender name or address contains any of these texts (for example a domain).",
            "items": {
              "type": "string"
            }
          },
          "toContains": {
            "title": "Recipient contains",
            "type": "array",
            "description": "Keep e-mails whose To or Cc contains any of these texts.",
            "items": {
              "type": "string"
            }
          },
          "subjectContains": {
            "title": "Subject contains",
            "type": "array",
            "description": "Keep e-mails whose subject contains any of these texts.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords (subject or body)",
            "type": "array",
            "description": "Keep e-mails whose subject or text contains any of these words. Searched on the server first when possible, then checked locally.",
            "items": {
              "type": "string"
            }
          },
          "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
          },
          "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
          },
          "maxMessagesPerFolder": {
            "title": "Maximum e-mails per folder",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Optional cap per folder (empty = only the global maximum)."
          },
          "maxMessageMb": {
            "title": "Maximum e-mail size (MB)",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Bigger e-mails are read with their headers only (bodyTruncated: true).",
            "default": 25
          },
          "connectTimeoutSecs": {
            "title": "Server timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "How long to wait for the mail server before reporting SERVER_UNREACHABLE or TIMEOUT.",
            "default": 30
          },
          "services": {
            "title": "Analyses",
            "type": "array",
            "description": "Free analyses added to the results: stats = mailbox report; duplicates = same e-mail in several folders; 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 (never opened or executed). Risky types (.exe, .js, .html, macros...) 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
          },
          "importFileUrl": {
            "title": "Import file URL",
            "type": "string",
            "description": "Public or signed https link to an MBOX, EML or ZIP export (for example Apple Mail > Mailbox > Export Mailbox, zipped). A signed link works like a password, so it is stored encrypted and never written to logs or results. The Actor never connects to your computer."
          },
          "importKeyValueStoreRecord": {
            "title": "Import from an Apify key-value store",
            "type": "string",
            "description": "storeIdOrName/KEY of a record you uploaded to your own Apify key-value store (MBOX, EML or ZIP)."
          },
          "maxImportMb": {
            "title": "Maximum import size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Bigger files are refused (IMPORT_TOO_LARGE).",
            "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
          },
          "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. On: missing or refused credentials, unreachable server or unreadable file 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}