Start a case export

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 /case/{caseId}/export

Queues an export of the case's conversations (PDF, RSMF and other formats). The export runs in the background; poll GET /case/:caseId/export or listen on the case socket for progress, then download the export's file.

Headers

  • organization string Required

    id of the selected (active) organization

Path parameters

  • caseId string Required

    Id of the case

application/json

Body Required

  • collection string Deprecated
  • conversations array[array]
  • excludeConversations array[array]
  • excludeDeviceSources array[string]

    Device conversation sources to exclude from the export. Applies to device-conversation exports only.

    Values are message, whatsapp, voicemail, call_log, facebook_dump, instagram_dump, threads_dump, or email.

  • type string Required

    Values are doc, text, csv, pdf, goodfact, rsmf, eml, or files-zip.

  • source string

    Values are conversation, browser-history, emails, case-files, case-attachments, financial, linkedin, ai-chat, or contacts.

  • chunkType string

    Values are none, day, week, month, or year. Default value is none.

  • emails array[string]

    Additional email addresses to send email to when export completes (other than user email)

  • fileName string
  • exportConfig array[string]

    Values are phone-numbers, comments, tags, app-icons, device-name, images, hide-attachment-links, extra-texts, line-break, device-logs, custom-entry, recently-deleted, deleted-messages-inline, deleted-messages-page, deleted-messages-inline-page, ignore-conversations, search-history-page, hide-page-numbers, or print-footer-work-timestamp.

  • sortBy string Required

    Values are old-to-new or new-to-old.

  • startDate string
  • endDate string
  • tags array[array]
  • tagsPadding number
  • device string
  • emailExportConfig object
    Hide emailExportConfig attributes Show emailExportConfig attributes object
    • providerId string Required

      Email data provider to export from

    • emailSearch object
      Hide emailSearch attributes Show emailSearch attributes object
      • searchText string

        Text search applied to all indexed fields (subject, body, snippet, from/to/cc/bcc). Supports the same AND / OR / NOT / -prefix, parentheses, "quoted phrases" and wildcards as the boolean query parser.

      • folders array[string]
      • domains array[string]

        Filter by participant domain(s) (part after @), any-of. Case-insensitive. Requires the domains field on the emailtext Atlas index.

      • excludeDomains array[string]

        Exclude items whose domain(s) match any of these (any-of). Case-insensitive. Must not overlap domains.

      • tags array[string]
      • excludeTags array[string]

        Exclude items carrying any of these tag ids. Must not overlap tags.

      • untagged boolean

        When truthy (1/true), return only emails with no tags attached. Takes precedence over the tags filter.

      • participants array[string]

        Filter by participant email address(es), any-of.

      • excludeEmails array[string]

        Exclude items whose participant address matches any of these (any-of). Must not overlap participants.

      • startDate string(date-time)

        Only return emails whose date is at/after this instant (inclusive). Accepts an ISO-8601 date-time.

      • endDate string(date-time)

        Only return emails whose date is at/before this instant (inclusive). Accepts an ISO-8601 date-time.

      • ids array[string]

        Restrict to these email ids, AND-intersected with the other filters.

      • exportWholeThread boolean

        When true, export the full threads containing the matched emails. When false (default), export only the matched emails, grouped under their thread.

        Default value is false.

    • threadSearch object
      Hide threadSearch attributes Show threadSearch attributes object
      • folders array[string]
      • domains array[string]

        Filter by participant domain(s) (part after @), any-of. Case-insensitive.

      • excludeDomains array[string]

        Exclude items whose domain(s) match any of these (any-of). Case-insensitive. Must not overlap domains.

      • tags array[string]
      • excludeTags array[string]

        Exclude items carrying any of these tag ids. Must not overlap tags.

      • participants array[string]

        Filter by participant email address(es), any-of.

      • excludeEmails array[string]

        Exclude items whose participant address matches any of these (any-of). Must not overlap participants.

      • starred boolean
      • unread boolean
      • untagged boolean

        When truthy (1/true), return only threads with no tags attached. Takes precedence over the tags filter.

      • startDate string(date-time)

        Only return threads whose latestMessageReceivedDate is at/after this instant (inclusive). Accepts an ISO-8601 date-time.

      • endDate string(date-time)

        Only return threads whose latestMessageReceivedDate is at/before this instant (inclusive). Accepts an ISO-8601 date-time.

      • ids array[string]

        Restrict to these thread ids, AND-intersected with the other filters.

    • includeAttachments boolean

      When true, each email's attachments are bundled into the export alongside the rendered PDF/EML output. Attachments are streamed to S3 and are subject to the files-zip size limits.

      Default value is false.

  • includeHiddenEmailThreads boolean

    When true, hidden threads (hiddenAt != null) are included in the email export. Default false. Does not affect explicitly-provided emailDataThreads ids, which are always exported.

    Default value is false.

  • timezone string

    IANA timezone string (e.g. "America/New_York") for formatting the export timestamp

Responses

  • 200 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
      • organization object | null Required

        Not loaded by any route, so always null.

      • device object | null Required

        Not loaded by any route, so always null.

      • type string Required

        Values are doc, text, csv, pdf, goodfact, rsmf, eml, or files-zip.

      • source string Required

        Values are conversation, browser-history, emails, case-files, case-attachments, financial, linkedin, ai-chat, or contacts.

      • chunkType string Required

        Values are none, day, week, month, or year.

      • exportedBy string | null Required

        Id of the user who requested the export

      • tags array[object] | null Required

        Not loaded by any route, so always null or an empty list.

      • emails array[string] Required
      • caseFileIds array[string]

        Snapshot of CaseFile ids resolved at request time (only set when source = case-files)

      • fileName string | null Required
      • file object Required

        The full record on routes that load it; null (or an empty list) on routes that do not.

        Hide file attributes Show file attributes object
        • createdAt string(date-time) Required
        • updatedAt string(date-time) Required
        • id string Required
        • name string Required
        • providerId string Required
        • convertedName string | null Required
        • convertedProviderId string Required
        • provider string Required
        • size number Required

          Size in bytes

        • transferState number | null Required
      • sortBy string Required

        Values are old-to-new or new-to-old.

      • size number Required

        Size in bytes

      • errorMessage string | null Required
      • totalMessages number Required
      • messagesProcessed number Required
      • totalConversations number Required
      • conversationsProcessed number Required
      • status string Required

        Values are not-started, inprogress, completed, failed, or cancelled.

      • jobId string | null Required
      • totalJobs number Required

        Number of chunk jobs this export was split into

      • emailData array[array] Required
      • metadata object | null
      • failedThreadsCount number

        Email threads this export could not render

      • cmpSyncStatus string | null

        CMP delivery status when this export was sent to a provider (pending/processing/completed/failed/…). Null when the export was not sent to a CMP — i.e. a plain download-to-computer export.

        Values are pending, processing, completed, failed, disabled, or skipped.

      • progress number Required
      • conversationNames array[string] Required
      • caseName string Required
    • statusCode number Required
    • timestamp string(date-time) Required
POST /case/{caseId}/export
curl \
 --request POST 'http://api.example.com/case/{caseId}/export' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --header "organization: string" \
 --data '{
  "collection": "string",
  "conversations": [
    []
  ],
  "excludeConversations": [
    []
  ],
  "excludeDeviceSources": [
    "message"
  ],
  "type": "doc",
  "source": "conversation",
  "chunkType": "none",
  "emails": [
    "string"
  ],
  "fileName": "string",
  "exportConfig": [
    "phone-numbers"
  ],
  "sortBy": "old-to-new",
  "startDate": "string",
  "endDate": "string",
  "tags": [
    []
  ],
  "tagsPadding": 42.0,
  "device": "string",
  "emailExportConfig": {
    "providerId": "string",
    "emailSearch": {
      "searchText": "(discriminate OR racist) AND (\"Larry Graham\" OR Robinson)",
      "folders": [
        "string"
      ],
      "domains": [
        "string"
      ],
      "excludeDomains": [
        "string"
      ],
      "tags": [
        "string"
      ],
      "excludeTags": [
        "string"
      ],
      "untagged": true,
      "participants": [
        "string"
      ],
      "excludeEmails": [
        "string"
      ],
      "startDate": "2024-01-01T00:00:00.000Z",
      "endDate": "2024-12-31T23:59:59.999Z",
      "ids": [
        "string"
      ],
      "exportWholeThread": false
    },
    "threadSearch": {
      "folders": [
        "string"
      ],
      "domains": [
        "string"
      ],
      "excludeDomains": [
        "string"
      ],
      "tags": [
        "string"
      ],
      "excludeTags": [
        "string"
      ],
      "participants": [
        "string"
      ],
      "excludeEmails": [
        "string"
      ],
      "starred": true,
      "unread": true,
      "untagged": true,
      "startDate": "2024-01-01T00:00:00.000Z",
      "endDate": "2024-12-31T23:59:59.999Z",
      "ids": [
        "string"
      ]
    },
    "includeAttachments": false
  },
  "includeHiddenEmailThreads": false,
  "timezone": "string"
}'
Request examples
# Headers
organization: string

# Payload
{
  "collection": "string",
  "conversations": [
    []
  ],
  "excludeConversations": [
    []
  ],
  "excludeDeviceSources": [
    "message"
  ],
  "type": "doc",
  "source": "conversation",
  "chunkType": "none",
  "emails": [
    "string"
  ],
  "fileName": "string",
  "exportConfig": [
    "phone-numbers"
  ],
  "sortBy": "old-to-new",
  "startDate": "string",
  "endDate": "string",
  "tags": [
    []
  ],
  "tagsPadding": 42.0,
  "device": "string",
  "emailExportConfig": {
    "providerId": "string",
    "emailSearch": {
      "searchText": "(discriminate OR racist) AND (\"Larry Graham\" OR Robinson)",
      "folders": [
        "string"
      ],
      "domains": [
        "string"
      ],
      "excludeDomains": [
        "string"
      ],
      "tags": [
        "string"
      ],
      "excludeTags": [
        "string"
      ],
      "untagged": true,
      "participants": [
        "string"
      ],
      "excludeEmails": [
        "string"
      ],
      "startDate": "2024-01-01T00:00:00.000Z",
      "endDate": "2024-12-31T23:59:59.999Z",
      "ids": [
        "string"
      ],
      "exportWholeThread": false
    },
    "threadSearch": {
      "folders": [
        "string"
      ],
      "domains": [
        "string"
      ],
      "excludeDomains": [
        "string"
      ],
      "tags": [
        "string"
      ],
      "excludeTags": [
        "string"
      ],
      "participants": [
        "string"
      ],
      "excludeEmails": [
        "string"
      ],
      "starred": true,
      "unread": true,
      "untagged": true,
      "startDate": "2024-01-01T00:00:00.000Z",
      "endDate": "2024-12-31T23:59:59.999Z",
      "ids": [
        "string"
      ]
    },
    "includeAttachments": false
  },
  "includeHiddenEmailThreads": false,
  "timezone": "string"
}
Response examples (200)
{
  "data": {
    "createdAt": "2026-01-15T14:30:00.000Z",
    "updatedAt": "2026-01-15T14:30:00.000Z",
    "id": "507f1f77bcf86cd799439011",
    "organization": {},
    "device": {},
    "type": "doc",
    "source": "conversation",
    "chunkType": "none",
    "exportedBy": "507f1f77bcf86cd799439011",
    "tags": [
      {}
    ],
    "emails": [
      "jane.doe@example.com"
    ],
    "caseFileIds": [
      "507f1f77bcf86cd799439015"
    ],
    "fileName": "doe-v-example-export.pdf",
    "file": {
      "createdAt": "2026-01-15T14:30:00.000Z",
      "updatedAt": "2026-01-15T14:30:00.000Z",
      "id": "507f1f77bcf86cd799439011",
      "name": "photo.heic",
      "providerId": "uploads/507f1f77bcf86cd799439011/photo.heic",
      "convertedName": "photo.jpg",
      "convertedProviderId": "uploads/507f1f77bcf86cd799439011/photo.jpg",
      "provider": "s3",
      "size": 204800,
      "transferState": 42.0
    },
    "sortBy": "old-to-new",
    "size": 1048576,
    "errorMessage": "string",
    "totalMessages": 1200,
    "messagesProcessed": 600,
    "totalConversations": 12,
    "conversationsProcessed": 6,
    "status": "not-started",
    "jobId": "job-1234",
    "totalJobs": 1,
    "emailData": [
      [
        {}
      ]
    ],
    "metadata": {},
    "failedThreadsCount": 0,
    "cmpSyncStatus": "pending",
    "progress": 100,
    "conversationNames": [
      "Jane Doe"
    ],
    "caseName": "Doe v. Example Corp"
  },
  "statusCode": 200,
  "timestamp": "2026-01-15T10:15:00.000Z"
}