Create extraction codes for cases (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 /admin/case/create-extraction-codes

Creates one extraction code for each entry in ecCodeData, on its caseId with the given custodian email, configuration and requested sources, marks those sources pending on the case and returns each case id with its new code. While the Plaid integration is on, a financial source needs the case's organization to have accepted the Plaid terms and have an active Plaid customer (400 or 404 otherwise); this check runs after the codes are saved. Super admin only.

application/json

Body Required

  • ecCodeData array[object] Required
    Hide ecCodeData attributes Show ecCodeData attributes object
    • custodianEmail string

      Minimum length is 3, maximum length is 100.

    • custodianName string

      Minimum length is 3, maximum length is 100.

    • custodianPhone string

      Minimum length is 3, maximum length is 50.

    • sendEmail boolean
    • label string

      Minimum length is 3, maximum length is 100.

    • allowShareAll boolean Deprecated

      Use config instead

    • config object
      Hide config attributes Show config attributes object
      • type string Required

        Values are allow_client, share_all, or auto_share. Default value is allow_client.

      • ignoreMediaPermissionAndroid boolean

        Default value is false.

      • origin string
      • enableFileUpload boolean

        Default value is false.

      • enableLocalExport object
        Hide enableLocalExport attributes Show enableLocalExport attributes object
        • formats array[string]

          Default value is [] (empty).

        • defaultConfig object
          Hide defaultConfig attributes Show defaultConfig attributes object
          • chunkType string Required

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

          • includeAttachments boolean

            Default value is true.

      • allowClient object
        Hide allowClient attributes Show allowClient attributes object
        • allowSocialApps array[string]

          Default value is [] (empty).

        • allowShareAll boolean

          Default value is false.

      • autoShare object
        Hide autoShare attributes Show autoShare attributes object
        • allowClientApproval boolean
        • allowAdditionalShare boolean
        • searches array[object]
          Hide searches attributes Show searches attributes object
          • type string Required

            Values are name, phone, keywords, or email. Default value is name.

          • values array[string] Required
          • apps array[string]

            Default value is [] (empty).

          • dateRange object
            Hide dateRange attributes Show dateRange attributes object
            • start string Required
            • end string Required
          • exactMatch boolean

            Default value is false.

          • include boolean

            Default value is true.

          • conversationType string Required

            Values are all, dm, or group. Default value is all.

      • shareAll object
        Hide shareAll attributes Show shareAll attributes object
        • apps array[string]
        • includeAttachments boolean

          Default value is true.

        • dateRange object
          Hide dateRange attributes Show dateRange attributes object
          • start string Required
          • end string Required
        • searchesExclude array[object]
          Hide searchesExclude attributes Show searchesExclude attributes object
          • type string Required

            Values are name, phone, keywords, or email. Default value is name.

          • values array[string] Required
          • apps array[string]
          • exactMatch boolean
          • conversationType string Required

            Values are all, dm, or group. Default value is all.

      • dateRange object
        Hide dateRange attributes Show dateRange attributes object
        • start string Required
        • end string Required
      • appConfig object
        Hide appConfig attributes Show appConfig attributes object
        • conversionConcurrency object
          Hide conversionConcurrency attributes Show conversionConcurrency attributes object
          • mediaType string Required

            Values are images, video, audio, or documents.

          • concurrency array[number]
        • compressionConcurrency object
          Hide compressionConcurrency attributes Show compressionConcurrency attributes object
          • mediaType string Required

            Values are images, video, audio, or documents.

          • concurrency array[number]
        • enableLocalMediaConversion boolean

          Default value is false.

        • enableLocalMediaCompression boolean

          Default value is false.

        • enableIosEncryptedBackupExtraction boolean

          Default value is false.

        • allowOnlyEncryptedIosBackup boolean

          Default value is false.

        • autoIncludeSafariData boolean

          Default value is false.

        • autoIncludeNotesData boolean

          Default value is false.

        • autoIncludeContacts boolean

          Default value is false.

        • shareAction string

          Values are share, export, or share_and_export. Default value is share.

    • requestedSources array[string]
    • dueDate string Required
    • sendReminders object
      Hide sendReminders attributes Show sendReminders attributes object
      • dueIn2Weeks boolean

        Default value is false.

      • dueIn1Week boolean

        Default value is false.

      • dueIn3Days boolean

        Default value is false.

      • dueIn1Day boolean

        Default value is false.

      • after1Week boolean

        Default value is false.

      • after2Weeks boolean

        Default value is false.

      • after1Month boolean

        Default value is false.

    • metadata object
    • watchlist boolean

      Default value is false.

    • ocRequired boolean

      OC cases only: when false, the OL creates/keeps this code without the opposing-council approval gate (code stays na, immediately usable, and the custodian email is sent). Ignored on non-OC cases. Defaults to true (gate on).

      Default value is true.

    • paymentRequired boolean

      Whether payment is required for this extraction code

    • paymentAmount number

      Payment amount in cents

    • paymentCurrency string

      Payment currency (defaults to usd)

      Default value is usd.

    • paymentSuccessRedirectUrl string

      Payment success redirect URL

    • productName string

      Product name

    • prepaidItems array[object]

      Prepaid basket. Each entry becomes its own Stripe line item and grants units on payment. Prices are negotiable — unitAmountCents is what the customer is charged, and is never validated against the catalog default.

      Hide prepaidItems attributes Show prepaidItems attributes object
      • productKey string Required

        Values are prepaid.device, prepaid.email, prepaid.device-email, or prepaid.support.

      • quantity number Required

        Default value is 1.

      • unitAmountCents number Required

        Negotiated unit price in cents

    • caseId string Required

Responses

  • 201 application/json
    Hide response attributes Show response attributes object
    • data object Required
      Hide data attribute Show data attribute object
      • data array[object] Required
        Hide data attributes Show data attributes object
        • caseId string Required
        • code string Required
    • statusCode number Required
    • timestamp string(date-time) Required
POST /admin/case/create-extraction-codes
curl \
 --request POST 'http://api.example.com/admin/case/create-extraction-codes' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "ecCodeData": [
    {
      "custodianEmail": "string",
      "custodianName": "string",
      "custodianPhone": "string",
      "sendEmail": true,
      "label": "string",
      "allowShareAll": true,
      "config": {
        "type": "allow_client",
        "ignoreMediaPermissionAndroid": false,
        "origin": "string",
        "enableFileUpload": false,
        "enableLocalExport": {
          "formats": [],
          "defaultConfig": {
            "chunkType": "none",
            "includeAttachments": true
          }
        },
        "allowClient": {
          "allowSocialApps": [],
          "allowShareAll": false
        },
        "autoShare": {
          "allowClientApproval": true,
          "allowAdditionalShare": true,
          "searches": [
            {
              "type": "name",
              "values": [
                "string"
              ],
              "apps": [],
              "dateRange": {
                "start": "string",
                "end": "string"
              },
              "exactMatch": false,
              "include": true,
              "conversationType": "all"
            }
          ]
        },
        "shareAll": {
          "apps": [
            "string"
          ],
          "includeAttachments": true,
          "dateRange": {
            "start": "string",
            "end": "string"
          },
          "searchesExclude": [
            {
              "type": "name",
              "values": [
                "string"
              ],
              "apps": [
                "string"
              ],
              "exactMatch": true,
              "conversationType": "all"
            }
          ]
        },
        "dateRange": {
          "start": "string",
          "end": "string"
        },
        "appConfig": {
          "conversionConcurrency": {
            "mediaType": "images",
            "concurrency": [
              42.0
            ]
          },
          "compressionConcurrency": {
            "mediaType": "images",
            "concurrency": [
              42.0
            ]
          },
          "enableLocalMediaConversion": false,
          "enableLocalMediaCompression": false,
          "enableIosEncryptedBackupExtraction": false,
          "allowOnlyEncryptedIosBackup": false,
          "autoIncludeSafariData": false,
          "autoIncludeNotesData": false,
          "autoIncludeContacts": false,
          "shareAction": "share"
        }
      },
      "requestedSources": [
        "string"
      ],
      "dueDate": "string",
      "sendReminders": {
        "dueIn2Weeks": false,
        "dueIn1Week": false,
        "dueIn3Days": false,
        "dueIn1Day": false,
        "after1Week": false,
        "after2Weeks": false,
        "after1Month": false
      },
      "metadata": {},
      "watchlist": false,
      "ocRequired": true,
      "paymentRequired": true,
      "paymentAmount": 42.0,
      "paymentCurrency": "usd",
      "paymentSuccessRedirectUrl": "string",
      "productName": "string",
      "prepaidItems": [
        {
          "productKey": "prepaid.device",
          "quantity": 1,
          "unitAmountCents": 42.0
        }
      ],
      "caseId": "string"
    }
  ]
}'
Request examples
{
  "ecCodeData": [
    {
      "custodianEmail": "string",
      "custodianName": "string",
      "custodianPhone": "string",
      "sendEmail": true,
      "label": "string",
      "allowShareAll": true,
      "config": {
        "type": "allow_client",
        "ignoreMediaPermissionAndroid": false,
        "origin": "string",
        "enableFileUpload": false,
        "enableLocalExport": {
          "formats": [],
          "defaultConfig": {
            "chunkType": "none",
            "includeAttachments": true
          }
        },
        "allowClient": {
          "allowSocialApps": [],
          "allowShareAll": false
        },
        "autoShare": {
          "allowClientApproval": true,
          "allowAdditionalShare": true,
          "searches": [
            {
              "type": "name",
              "values": [
                "string"
              ],
              "apps": [],
              "dateRange": {
                "start": "string",
                "end": "string"
              },
              "exactMatch": false,
              "include": true,
              "conversationType": "all"
            }
          ]
        },
        "shareAll": {
          "apps": [
            "string"
          ],
          "includeAttachments": true,
          "dateRange": {
            "start": "string",
            "end": "string"
          },
          "searchesExclude": [
            {
              "type": "name",
              "values": [
                "string"
              ],
              "apps": [
                "string"
              ],
              "exactMatch": true,
              "conversationType": "all"
            }
          ]
        },
        "dateRange": {
          "start": "string",
          "end": "string"
        },
        "appConfig": {
          "conversionConcurrency": {
            "mediaType": "images",
            "concurrency": [
              42.0
            ]
          },
          "compressionConcurrency": {
            "mediaType": "images",
            "concurrency": [
              42.0
            ]
          },
          "enableLocalMediaConversion": false,
          "enableLocalMediaCompression": false,
          "enableIosEncryptedBackupExtraction": false,
          "allowOnlyEncryptedIosBackup": false,
          "autoIncludeSafariData": false,
          "autoIncludeNotesData": false,
          "autoIncludeContacts": false,
          "shareAction": "share"
        }
      },
      "requestedSources": [
        "string"
      ],
      "dueDate": "string",
      "sendReminders": {
        "dueIn2Weeks": false,
        "dueIn1Week": false,
        "dueIn3Days": false,
        "dueIn1Day": false,
        "after1Week": false,
        "after2Weeks": false,
        "after1Month": false
      },
      "metadata": {},
      "watchlist": false,
      "ocRequired": true,
      "paymentRequired": true,
      "paymentAmount": 42.0,
      "paymentCurrency": "usd",
      "paymentSuccessRedirectUrl": "string",
      "productName": "string",
      "prepaidItems": [
        {
          "productKey": "prepaid.device",
          "quantity": 1,
          "unitAmountCents": 42.0
        }
      ],
      "caseId": "string"
    }
  ]
}
Response examples (201)
{
  "data": {
    "data": [
      {
        "caseId": "65a1b2c3d4e5f6a7b8c9d0e2",
        "code": "K7Q2MZ"
      }
    ]
  },
  "statusCode": 201,
  "timestamp": "2026-01-15T10:15:00.000Z"
}