File Operations

Upload, download, and manage case files through the API.


🎯 Overview

📌 TL;DR

Upload files directly or via URL, remove files when needed, and get notified when files are uploaded to cases you're involved with. This appendix works with any integration pattern.

This guide covers:

  • Uploading files directly to cases

  • Uploading files via URL (for larger files)

  • Removing files from cases

  • Receiving notifications when files are uploaded

Use this with:

  • Any originator or handler integration

  • Both webhook and polling patterns


📖 Key Terms

Term
Definition

Attachment

A file associated with a case

Direct Upload

Upload file content directly via multipart form

Stream Upload

Upload file from a URL (Lexamica fetches it)


📋 Prerequisites

Credentials:

Foundational Docs:

For file upload notifications (optional):


💡 Uploading Files

Method 1: Direct Upload

Best for smaller files uploaded directly from your server.

Endpoint: POST /organization/{orgId}/inbound-webhooks/case/{mapId}/file/upload

Request (multipart/form-data):

Response:

Node.js Example:

Method 2: Stream Upload (URL-based)

Best for larger files or files already hosted elsewhere. Lexamica fetches the file from the URL you provide.

Endpoint: POST /organization/{orgId}/inbound-webhooks/case/{mapId}/file/stream

Request:

Node.js Example:

💡 Tip: Stream upload is useful when your files are in cloud storage (S3, GCS, etc.) and you want to avoid downloading them to your server first.


💡 Removing Files

Endpoint: POST /organization/{orgId}/inbound-webhooks/case/{mapId}/file/remove

Request:

Node.js Example:


💡 Receiving File Upload Notifications

Get notified when files are uploaded to cases you're involved with.

Via Webhooks

Sample webhook payload:

Via Polling


💡 Downloading Files

Files include a url field that you can use to download the content.

Example:


🔧 Attachment Mapping

Create an Attachment mapping for file-related events:


🔧 Complete Example: File Sync Service


❓ FAQ

❓ "What file types are supported?"

Most common file types are supported: PDF, images (JPG, PNG), documents (DOC, DOCX), and more. Contact support for specific format questions.


❓ "What's the maximum file size?"

Direct upload has practical limits based on timeout. For large files (>50MB), use stream upload with a hosted URL. The stream upload will automatically handle file size limits and will retry the upload if it fails.


❓ "Are files visible to all case participants?"

Yes, files uploaded to a case are visible to all firms who are confirmed as a participant in the case (originator and handler).


❓ "How long are file URLs valid?"

File URLs are typically short-lived and expire after a few hours. Store files in your own system if you need guaranteed permanent access.


🔧 Troubleshooting

"File upload returns 400"

  • Check that caseId is valid and you have access to the case

  • Verify the mapping ID is for the Attachment model

  • For direct upload, ensure the file field is named file

"Stream upload fails"

  • Ensure the source URL is publicly accessible

  • Verify the file exists at the URL

  • Check that mimetype matches the actual file


Last updated: January 2026

Last updated