Export case data to a provider

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 /legal/cases/{caseId}/legal-sync/export-to-provider

Queues an export of the case data not yet sent to the destination in provider (Clio by default, Smokeball or Dropbox), narrowed by source types, extraction codes and formats, and returns what the request matched: queued, the job id and the record counts per source. A request while an export of the same case and destination is running joins it. queued: false means nothing matched and no job started; delivery status per record is on the legal sync status route. Returns 409 when a requested source is turned off for export or matches nothing and 404 for an unknown case. Requires a member role or above in the organization and access to the case; not available to opposing counsel.

Headers

  • organization string Required

    id of the selected (active) organization

Path parameters

  • caseId string Required
application/json

Body Required

  • provider string

    Values are clio, smokeball, or dropbox. Default value is clio.

  • includeFailed boolean

    Default value is false.

  • includeSkipped boolean

    Also export records previously skipped because the source was not enabled / the case was not linked when the data arrived. Requires sources to be set — see SkippedRequiresExplicitSources.

    Default value is false.

  • extractionCodeIds array[array]

    Custodian (extraction code) scope — orthogonal to filters.

  • sources array[object]

    Per-source selection + filters. OMIT to export every pending source with no filters. Each entry only accepts the filter keys valid for its sourceType (others are rejected) — see the example.

    Hide sources attributes Show sources attributes object
    • sourceType string

      Values are Device, UserEmailDataProvider, CaseFileProvider, FinancialAccountProvider, LegalDocumentProvider, DiscordUserProvider, RedditUserProvider, LinkedInUserProvider, or AiChatProvider.

    • format string

      Values are pdf, csv, rsmf, or eml.

    • filters object
      Hide filters attributes Show filters attributes object
      • conversations array[array]
      • excludeConversations array[array]
      • startDate string
      • endDate string
      • tags array[array]
      • threads array[array]

        Specific email threads to export. Omit to export every thread under the extraction code (minus excludeThreads).

      • excludeThreads array[array]
      • includeHidden boolean

        When true, threads the user hid in the platform (hiddenAt != null) are exported too. Default false, matching the download export. Ignored when threads is set — an explicit id selection is honored regardless of hidden state.

        Default value is false.

      • participants array[array]

        Correspondent emails (to/from) — matches thread participants

      • sourceEmail string
      • folders array[array]
      • searchText string
      • receivedAfter string
      • receivedBefore string
      • financial array[object]
        Hide financial attributes Show financial attributes object
        • exportType string Required

          Values are transactions, holdings, liabilities, recurring-transactions, investment-transactions, or statements-bundle.

        • accountTypes object
          Hide accountTypes attributes Show accountTypes attributes object
          • include array[string]

            Values are depository, credit, loan, investment, brokerage, or other.

          • exclude array[string]

            Values are depository, credit, loan, investment, brokerage, or other.

        • startDate string
        • endDate string
        • category string
        • transactionType string

          Values are debit or credit.

        • minAmount number
        • maxAmount number
        • type string
        • frequency string
        • isActive boolean
        • liabilityType string

          Values are credit, mortgage, or student.

        • isOverdue boolean
        • tags array[array]
    • options object
      Hide options attributes Show options attributes object
      • 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

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

      • chunkType string

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

      • timezone string

        IANA timezone (e.g. "America/New_York") for timestamps

      • tagsPadding number

        Minimum value is 0, maximum value is 20.

      • includeAttachments boolean

        Email only. Bundle each email's attachments alongside the rendered output instead of linking back to the platform. Changes the delivered artifact to a ZIP; subject to the files-zip size limits.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • data object Required
      Hide data attributes Show data attributes object
      • queued boolean Required

        False when nothing matched the request — no job was enqueued.

      • jobId string | null

        Bull job id. One in-flight export per (case, provider): a second request while the first is still running collapses onto it.

      • matched object Required

        Records matched per source type. A source the caller named explicitly is rejected with 409 when it matches nothing, so a zero here only ever appears for an unscoped request.

      • totalMatched number Required
    • statusCode number Required
    • timestamp string(date-time) Required
  • 409

    An explicitly requested source is disabled for outbound export, or matched no exportable records.

POST /legal/cases/{caseId}/legal-sync/export-to-provider
curl \
 --request POST 'http://api.example.com/legal/cases/{caseId}/legal-sync/export-to-provider' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --header "organization: string" \
 --data '{
  "provider": "clio",
  "includeFailed": false,
  "includeSkipped": false,
  "extractionCodeIds": [
    []
  ],
  "sources": [
    {
      "sourceType": "Device",
      "format": "pdf",
      "filters": {
        "conversations": [
          "665f0a1b2c3d4e5f00000001"
        ],
        "startDate": "2021-01-01",
        "endDate": "2021-12-31",
        "tags": [
          "665f0a1b2c3d4e5f00000002"
        ]
      }
    },
    {
      "sourceType": "UserEmailDataProvider",
      "filters": {
        "participants": [
          "jane@example.com"
        ],
        "receivedAfter": "2021-01-01",
        "receivedBefore": "2021-12-31"
      }
    },
    {
      "sourceType": "FinancialAccountProvider",
      "filters": {
        "financial": [
          {
            "exportType": "transactions",
            "startDate": "2021-01-01",
            "endDate": "2021-12-31",
            "category": "Travel",
            "transactionType": "debit",
            "accountTypes": {
              "include": [
                "depository"
              ]
            }
          },
          {
            "exportType": "statements-bundle",
            "startDate": "2021-01-01",
            "endDate": "2021-06-30"
          }
        ]
      }
    }
  ]
}'
Request examples
# Headers
organization: string

# Payload
{
  "provider": "clio",
  "includeFailed": false,
  "includeSkipped": false,
  "extractionCodeIds": [
    []
  ],
  "sources": [
    {
      "sourceType": "Device",
      "format": "pdf",
      "filters": {
        "conversations": [
          "665f0a1b2c3d4e5f00000001"
        ],
        "startDate": "2021-01-01",
        "endDate": "2021-12-31",
        "tags": [
          "665f0a1b2c3d4e5f00000002"
        ]
      }
    },
    {
      "sourceType": "UserEmailDataProvider",
      "filters": {
        "participants": [
          "jane@example.com"
        ],
        "receivedAfter": "2021-01-01",
        "receivedBefore": "2021-12-31"
      }
    },
    {
      "sourceType": "FinancialAccountProvider",
      "filters": {
        "financial": [
          {
            "exportType": "transactions",
            "startDate": "2021-01-01",
            "endDate": "2021-12-31",
            "category": "Travel",
            "transactionType": "debit",
            "accountTypes": {
              "include": [
                "depository"
              ]
            }
          },
          {
            "exportType": "statements-bundle",
            "startDate": "2021-01-01",
            "endDate": "2021-06-30"
          }
        ]
      }
    }
  ]
}
Response examples (200)
{
  "data": {
    "queued": true,
    "jobId": "legal-export-65a1b2c3d4e5f6a7b8c9d0e2-clio",
    "matched": {
      "Device": 3,
      "UserEmailDataProvider": 1
    },
    "totalMatched": 4
  },
  "statusCode": 200,
  "timestamp": "2026-01-15T10:15:00.000Z"
}