Search a linked mailbox's emails (internal)

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://docs.usehearsay.com/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "integrations MCP server": {
    "url": "https://docs.usehearsay.com/mcp"
  }
}

Close
POST /email-data/{caseId}/search-remote-emails

Inbox-connect plumbing: searches the emails in a linked OAuth mailbox at the provider, before anything is imported. Pass nextPageToken back as pageToken for the next page. An extraction-code user may only name a mailbox linked to their own code (404 otherwise).

Path parameters

  • caseId string Required
application/json

Body Required

  • anyEmail array[string]
  • to array[string]
  • bcc array[string]
  • cc array[string]
  • from array[string]
  • hasAttachment boolean
  • receivedAfter string
  • receivedBefore string
  • keywords array[string]
  • subject string
  • contactNames array[string]
  • folders array[string]

    Restrict the search to these folders (folder id/path as returned by fetch-folders). Optional; when omitted, all non-system folders are searched.

  • providerId string Required
  • pageToken string
  • limit number

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • data object Required
      Hide data attributes Show data attributes object
      • data array[object] Required
        Hide data attributes Show data attributes object
        • starred boolean Required
        • unread boolean Required
        • folders array[string] Required
        • subject string Required
        • threadId string Required
        • body string Required
        • grantId string Required
        • id string Required
        • object string Required
        • snippet string Required
        • bcc array[object] Required
        • cc array[string] Required
        • attachments array[object] Required
        • from array[string] Required
        • to array[string] Required
        • replyTo array[string] Required
        • date string(date-time) Required
        • trackingOptions object Required
        • hasAttachment boolean Required
        • isDraft boolean Required
      • nextPageToken string Required
    • statusCode number Required
    • timestamp string(date-time) Required
POST /email-data/{caseId}/search-remote-emails
curl \
 --request POST 'http://api.example.com/email-data/{caseId}/search-remote-emails' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "anyEmail": [
    "string"
  ],
  "to": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "cc": [
    "string"
  ],
  "from": [
    "string"
  ],
  "hasAttachment": true,
  "receivedAfter": "string",
  "receivedBefore": "string",
  "keywords": [
    "string"
  ],
  "subject": "string",
  "contactNames": [
    "string"
  ],
  "folders": [
    "string"
  ],
  "providerId": "string",
  "pageToken": "string",
  "limit": 42.0
}'
Request examples
{
  "anyEmail": [
    "string"
  ],
  "to": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "cc": [
    "string"
  ],
  "from": [
    "string"
  ],
  "hasAttachment": true,
  "receivedAfter": "string",
  "receivedBefore": "string",
  "keywords": [
    "string"
  ],
  "subject": "string",
  "contactNames": [
    "string"
  ],
  "folders": [
    "string"
  ],
  "providerId": "string",
  "pageToken": "string",
  "limit": 42.0
}
Response examples (200)
{
  "data": {
    "data": [
      {
        "starred": true,
        "unread": true,
        "folders": [
          "string"
        ],
        "subject": "string",
        "threadId": "string",
        "body": "string",
        "grantId": "string",
        "id": "string",
        "object": "string",
        "snippet": "string",
        "bcc": [
          {}
        ],
        "cc": [
          "string"
        ],
        "attachments": [
          {}
        ],
        "from": [
          "string"
        ],
        "to": [
          "string"
        ],
        "replyTo": [
          "string"
        ],
        "date": "2026-05-04T09:42:00Z",
        "trackingOptions": {},
        "hasAttachment": true,
        "isDraft": true
      }
    ],
    "nextPageToken": "string"
  },
  "statusCode": 200,
  "timestamp": "2026-01-15T10:15:00.000Z"
}