Link an IMAP mailbox (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}/add-imap-email-provider

Inbox-connect plumbing: connects to the IMAP server to check the host and credentials, links the mailbox to the case and returns it. The credentials are stored encrypted and never returned.

Path parameters

  • caseId string Required
application/json

Body Required

  • extractionCode string Required
  • host string Required
  • port number Required
  • user string Required
  • pass string Required

Responses

  • 201 application/json
    Hide response attributes Show response attributes object
    • data object Required
      Hide data attributes Show data attributes object
      • createdAt string(date-time) Required
      • updatedAt string(date-time) Required
      • id string Required
      • email string Required
      • ecCode string

        Never sent today: no importer fills it.

      • grantId string | null Required
      • provider string | null Required
      • isValid boolean Required
      • lastAccessedAt string(date-time) | null Required
      • folders array[object] Required

        Mailbox folders saved when the account was connected or its folders were refreshed.

        Hide folders attributes Show folders attributes object
        • name string
        • id string
        • isSystemFolder boolean
        • backgroundColor string
        • metadata object

          A copy of the provider's folder record. OAuth (Nylas) accounts: id, name, object, grantId, and depending on the provider backgroundColor, textColor, systemFolder, parentId, childCount, totalCount, unreadCount, attributes. IMAP accounts: name, id, isSystemFolder, backgroundColor and an empty metadata object.

          Additional properties are allowed.

    • statusCode number Required
    • timestamp string(date-time) Required
POST /email-data/{caseId}/add-imap-email-provider
curl \
 --request POST 'http://api.example.com/email-data/{caseId}/add-imap-email-provider' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "extractionCode": "string",
  "host": "string",
  "port": 42.0,
  "user": "string",
  "pass": "string"
}'
Request examples
{
  "extractionCode": "string",
  "host": "string",
  "port": 42.0,
  "user": "string",
  "pass": "string"
}
Response examples (201)
{
  "data": {
    "createdAt": "2026-01-15T14:30:00.000Z",
    "updatedAt": "2026-01-15T14:30:00.000Z",
    "id": "507f1f77bcf86cd799439011",
    "email": "jane.doe@example.com",
    "ecCode": "K7Q2-9XPL",
    "grantId": "5f0c8b3e-2a41-4d7c-9a51-1c2b3d4e5f60",
    "provider": "google",
    "isValid": true,
    "lastAccessedAt": "2026-01-15T14:30:00.000Z",
    "folders": [
      {
        "backgroundColor": "#ffffff",
        "id": "INBOX",
        "isSystemFolder": true,
        "metadata": {
          "grantId": "5f0c8b3e-2a41-4d7c-9a51-1c2b3d4e5f60",
          "id": "INBOX",
          "name": "INBOX",
          "object": "folder",
          "systemFolder": true
        },
        "name": "INBOX"
      }
    ]
  },
  "statusCode": 201,
  "timestamp": "2026-01-15T10:15:00.000Z"
}